Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{drop:'BATCH_JOB_INSTANCE'}
{drop:'BATCH_JOB_EXECUTION'}
{drop:'BATCH_STEP_EXECUTION'}
{drop:'BATCH_SEQUENCES'}
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,14 @@ abstract class AbstractMongoDBDaoIntegrationTests {

@BeforeEach
void setUp(@Autowired MongoTemplate mongoTemplate) throws IOException {
mongoTemplate.dropCollection("BATCH_JOB_INSTANCE");
mongoTemplate.dropCollection("BATCH_JOB_EXECUTION");
mongoTemplate.dropCollection("BATCH_STEP_EXECUTION");
mongoTemplate.createCollection("BATCH_JOB_INSTANCE");
mongoTemplate.createCollection("BATCH_JOB_EXECUTION");
mongoTemplate.createCollection("BATCH_STEP_EXECUTION");
// sequences
mongoTemplate.dropCollection("BATCH_SEQUENCES");
Resource resource = new FileSystemResource(
"src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl");
try (Stream<String> lines = Files.lines(resource.getFilePath())) {
lines.forEach(mongoTemplate::executeCommand);
}
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-drop-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
}

protected void assertTemporalEquals(LocalDateTime lhs, LocalDateTime rhs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ public class MongoDBJobExplorerIntegrationTests {

@BeforeAll
static void setUp(@Autowired MongoTemplate mongoTemplate) throws IOException {
Resource resource = new FileSystemResource(
"src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl");
Files.lines(resource.getFilePath()).forEach(line -> mongoTemplate.executeCommand(line));
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-drop-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ public class MongoDBJobRepositoryIntegrationTests {

@BeforeEach
public void setUp() throws IOException {
Resource resource = new FileSystemResource(
"src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl");
Files.lines(resource.getFilePath()).forEach(line -> mongoTemplate.executeCommand(line));
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-drop-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

/**
* @author Mahmoud Ben Hassine
* @author Yanming Zhou
*/
@Testcontainers(disabledWithoutDocker = true)
@SpringJUnitConfig(MongoDBIntegrationTestConfiguration.class)
Expand All @@ -62,14 +63,14 @@ public class MongoDBJobRestartIntegrationTests {

@BeforeEach
public void setUp() throws IOException {
// TODO put drop statements in schema-drop-mongodb.jsonl
mongoTemplate.dropCollection("BATCH_JOB_INSTANCE");
mongoTemplate.dropCollection("BATCH_JOB_EXECUTION");
mongoTemplate.dropCollection("BATCH_STEP_EXECUTION");
mongoTemplate.dropCollection("BATCH_SEQUENCES");
Resource resource = new FileSystemResource(
"src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl");
Files.lines(resource.getFilePath()).forEach(line -> mongoTemplate.executeCommand(line));
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-drop-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
Files
.lines(new FileSystemResource("src/main/resources/org/springframework/batch/core/schema-mongodb.jsonl")
.getFilePath())
.forEach(mongoTemplate::executeCommand);
}

@Test
Expand Down