Skip to content
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

Closed

Conversation

cppwfs
Copy link
Contributor

@cppwfs cppwfs commented Nov 14, 2023

Updated MARIADB schema to use sequences instead of tables for Boot 3 batch tables


public void setupSearchableExecutionDaoTest(JdbcDatabaseContainer dbContainer, String schemaName,
DatabaseType databaseType) throws Exception {
this.dataSource = createDataSourceForContainer(dbContainer);
Copy link
Contributor

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?

Copy link
Contributor

@onobc onobc left a 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
@cppwfs cppwfs force-pushed the SCDF-ADD-BASE-BATCH-DAO-TESTS branch from b539ca4 to 2f494a0 Compare November 28, 2023 21:44
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
@cppwfs cppwfs force-pushed the SCDF-ADD-BASE-BATCH-DAO-TESTS branch from 2f494a0 to 988e78f Compare November 28, 2023 21:47
@cppwfs cppwfs changed the title Add support for Job instance and execution dao tests Add support for Job instance and execution dao tests [Do not merge till 5577 is merged] Nov 28, 2023
@onobc
Copy link
Contributor

onobc commented Nov 29, 2023

Awesome work @cppwfs !

Closing via c98116a

@onobc onobc closed this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants