-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Job instance and execution dao tests [Do not merge till 5577 is merged] #5553
Conversation
spring-cloud-dataflow-server-core/src/main/resources/schemas/mariadb/V6-dataflow.sql
Outdated
Show resolved
Hide resolved
...ver-core/src/test/java/org/springframework/cloud/dataflow/server/batch/AbstractDaoTests.java
Show resolved
Hide resolved
|
||
public void setupSearchableExecutionDaoTest(JdbcDatabaseContainer dbContainer, String schemaName, | ||
DatabaseType databaseType) throws Exception { | ||
this.dataSource = createDataSourceForContainer(dbContainer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[This Comment Applies to all concrete impls]
The pattern I am seeing is that a concrete subclass provides a testcontainer and then calls a base method via @BeforeEach
that initializes the DB to clean slate before running each test.
The current impl requires each concrete test to do these things:
this.dataSource = createDataSourceForContainer(dbContainer);
this.jdbcTemplate = new JdbcTemplate(this.dataSource);
createDataFlowSchema(dbContainer, schemaName);
I propose that we pull up the DS and JDBCT to the AbstractDaoTests
and then provide a base method called prepareForTest
that can be called by the concrete tests. Something like this:
protected void prepareForTest(JdbcDatabaseContainer dbContainer, String schemaName) {
this.dataSource = createDataSourceForContainer(dbContainer);
this.jdbcTemplate = new JdbcTemplate(this.dataSource);
createDataFlowSchema(dbContainer, schemaName);
}
Otherwise, all the ADT is really providing is 2 util methods that everyone has to call.
Wdyt?
.../springframework/cloud/dataflow/server/batch/AbstractJdbcJobSearchableExecutionDaoTests.java
Show resolved
Hide resolved
...g/springframework/cloud/dataflow/server/batch/JdbcJobSearchableExecutionMariadbDaoTests.java
Show resolved
Hide resolved
...g/springframework/cloud/dataflow/server/batch/AbstractJdbcJobSearchableInstanceDaoTests.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good @cppwfs . I have left some minor suggestions and feedback. Thanks
Updated MARIADB schema to use sequences instead of tables for Boot 3 batch tables
b539ca4
to
2f494a0
Compare
Tests no long have test in the name but more of a TDD title Set the access to be package level for all tests and variables Database changes removed Compararator added so that schema scripts are called in the proper order Rebased Use of mysql type for mariadb test has an explanation and a todo
2f494a0
to
988e78f
Compare
Updated MARIADB schema to use sequences instead of tables for Boot 3 batch tables