-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
20 changed files
with
420 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lombok.anyconstructor.addconstructorproperties = true | ||
lombok.addLombokGeneratedAnnotation = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
neo4j-adapter/src/test/java/com/github/valb3r/springbatch/adapters/neo4j/dao/BaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.github.valb3r.springbatch.adapters.neo4j.dao; | ||
|
||
import com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.TestApplication; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.neo4j.ogm.session.SessionFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import java.util.Collections; | ||
|
||
@ActiveProfiles("test") | ||
@SpringBootTest(classes = TestApplication.class) | ||
public abstract class BaseTest { | ||
|
||
@Autowired | ||
private SessionFactory factory; | ||
|
||
@AfterEach | ||
void dropDatabase() { | ||
factory.openSession().query("MATCH (n) DETACH DELETE n", Collections.emptyMap()); | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
...a/com/github/valb3r/springbatch/adapters/neo4j/dao/SimpleExecutionFlowValidationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package com.github.valb3r.springbatch.adapters.neo4j.dao; | ||
|
||
import com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider; | ||
import lombok.val; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.batch.core.repository.dao.JobExecutionDao; | ||
import org.springframework.batch.core.repository.dao.JobInstanceDao; | ||
import org.springframework.batch.core.repository.dao.StepExecutionDao; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.CHUNK_ONE; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.CHUNK_TWO; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.DONE; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.ONE_STEP_TASKLET; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.READER_WRITER; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.READS_ONE; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.READS_TWO; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.STEP_ONE; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.STEP_TWO; | ||
import static com.github.valb3r.springbatch.adapters.neo4j.dao.testconfig.JobProvider.TWO_STEPS_TASKLET; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class SimpleExecutionFlowValidationTest extends BaseTest { | ||
|
||
@Autowired | ||
private JobProvider provider; | ||
|
||
@Autowired | ||
private JobInstanceDao instanceDao; | ||
|
||
@Autowired | ||
private JobExecutionDao executionDao; | ||
|
||
@Autowired | ||
private StepExecutionDao stepExecutionDao; | ||
|
||
@Test | ||
void runOneStepTasklet() { | ||
val job = provider.oneStepTaskletJobEmptyParams(); | ||
job.exec(); | ||
|
||
assertThat(job.getStats().getResult()).hasValue(DONE); | ||
assertThat(job.getStats().getTaskletsDone()).hasValue(1); | ||
assertThat(instanceDao.getJobNames()).containsExactly(ONE_STEP_TASKLET); | ||
assertThat(executionDao.findJobExecutions(job.getInstance())).hasSize(1); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_ONE)).isNotNull(); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_TWO)).isNull(); | ||
} | ||
|
||
@Test | ||
void runTwoStepsTasklet() { | ||
val job = provider.twoStepTaskletJobEmptyParams(); | ||
job.exec(); | ||
|
||
assertThat(job.getStats().getResult()).hasValue(DONE); | ||
assertThat(job.getStats().getTaskletsDone()).hasValue(2); | ||
assertThat(instanceDao.getJobNames()).containsExactly(TWO_STEPS_TASKLET); | ||
assertThat(executionDao.findJobExecutions(job.getInstance())).hasSize(1); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_ONE)).isNotNull(); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_TWO)).isNotNull(); | ||
} | ||
|
||
@Test | ||
void runOneStepReaderWriter() { | ||
val job = provider.oneStepReaderWriterJobEmptyParams(); | ||
job.exec(); | ||
|
||
assertThat(job.getStats().getResult()).hasValue(DONE); | ||
assertThat(job.getStats().getTaskletsDone()).hasValue(0); | ||
assertThat(job.getStats().getReads()).hasValue(READS_ONE); | ||
assertThat(job.getStats().getProcesses()).hasValue(READS_ONE); | ||
assertThat(job.getStats().getWrites()).hasValue(READS_ONE / CHUNK_ONE); | ||
assertThat(instanceDao.getJobNames()).containsExactly(READER_WRITER); | ||
assertThat(executionDao.findJobExecutions(job.getInstance())).hasSize(1); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_ONE)).isNotNull(); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_TWO)).isNull(); | ||
} | ||
|
||
@Test | ||
void runTwoStepsReaderWriter() { | ||
val job = provider.twoStepReaderWriterJobEmptyParams(); | ||
job.exec(); | ||
|
||
assertThat(job.getStats().getResult()).hasValue(DONE); | ||
assertThat(job.getStats().getTaskletsDone()).hasValue(0); | ||
assertThat(job.getStats().getReads()).hasValue(READS_ONE + READS_TWO); | ||
assertThat(job.getStats().getProcesses()).hasValue(READS_ONE + READS_TWO); | ||
assertThat(job.getStats().getWrites()).hasValue(READS_ONE / CHUNK_ONE + READS_TWO / CHUNK_TWO); | ||
assertThat(instanceDao.getJobNames()).containsExactly(READER_WRITER); | ||
assertThat(executionDao.findJobExecutions(job.getInstance())).hasSize(1); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_ONE)).isNotNull(); | ||
assertThat(stepExecutionDao.getLastStepExecution(job.getInstance(), STEP_TWO)).isNotNull(); | ||
} | ||
} |
Oops, something went wrong.