Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-ebi committed Oct 17, 2024
1 parent 91b080b commit 9e8519e
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.batch.test.JobRepositoryTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.annotation.DirtiesContext;
Expand All @@ -56,6 +57,7 @@
import static org.springframework.data.mongodb.core.query.Query.query;
import static uk.ac.ebi.eva.accession.deprecate.configuration.BeanNames.DEPRECATE_STUDY_SUBMITTED_VARIANTS_JOB;
import static uk.ac.ebi.eva.accession.deprecate.configuration.BeanNames.DEPRECATE_STUDY_SUBMITTED_VARIANTS_STEP;
import static uk.ac.ebi.eva.accession.deprecate.test.configuration.BatchTestConfiguration.JOB_LAUNCHER_FROM_MONGO;

@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {BatchTestConfiguration.class, MongoTestConfiguration.class})
Expand All @@ -65,7 +67,8 @@ public class DeprecateStudySubmittedVariantsJobConfigurationTest {
private static final String TEST_DB = "test-db";

@Autowired
private JobLauncherTestUtils jobLauncherTestUtils;
@Qualifier(JOB_LAUNCHER_FROM_MONGO)
private JobLauncherTestUtils jobLauncherTestUtilsFromMongo;

@Autowired
private JobExplorer jobExplorer;
Expand Down Expand Up @@ -113,7 +116,7 @@ public void tearDown() {

@Test
public void basicJobCompletion() throws Exception {
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
JobExecution jobExecution = jobLauncherTestUtilsFromMongo.launchJob();

List<String> expectedSteps = Collections.singletonList(DEPRECATE_STUDY_SUBMITTED_VARIANTS_STEP);
assertStepsExecuted(expectedSteps, jobExecution);
Expand All @@ -131,7 +134,7 @@ private void assertStepsExecuted(List expectedSteps, JobExecution jobExecution)
@Test
@DirtiesContext
public void restartCompletedJobThatIsAlreadyInTheRepository() throws Exception {
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
JobExecution jobExecution = jobLauncherTestUtilsFromMongo.launchJob();

List<String> expectedSteps = Collections.singletonList(DEPRECATE_STUDY_SUBMITTED_VARIANTS_STEP);
assertStepsExecuted(expectedSteps, jobExecution);
Expand All @@ -143,7 +146,7 @@ public void restartCompletedJobThatIsAlreadyInTheRepository() throws Exception {
jobExecution.getJobParameters())
.getJobInstance().getInstanceId();

jobExecution = jobLauncherTestUtils.launchJob();
jobExecution = jobLauncherTestUtilsFromMongo.launchJob();
expectedSteps = Collections.singletonList(DEPRECATE_STUDY_SUBMITTED_VARIANTS_STEP);
assertStepsExecuted(expectedSteps, jobExecution);
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
Expand Down

0 comments on commit 9e8519e

Please sign in to comment.