From e8970bce465603e1a1fe641875c03d9d2a98bc8b Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 2 Jun 2020 16:08:19 -0700 Subject: [PATCH] Running batch job --- .../java/ca/uhn/fhir/jpa/config/TestDstu3Config.java | 4 ---- .../test/java/ca/uhn/fhir/jpa/config/TestR4Config.java | 10 +++++++++- .../src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java | 2 -- .../ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java | 8 -------- .../java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java | 4 +++- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java index 9bfe6a68e2e..78399337d0b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java @@ -50,10 +50,6 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { return new CircularQueueCaptureQueriesListener(); } - @Bean - public IBatchJobSubmitter batchJobSubmitter() { - return new BatchJobSubmitterImpl(); - } @Bean public BasicDataSource basicDataSource() { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java index cc2b8fe7a43..2ba8b1d37f4 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java @@ -1,5 +1,7 @@ package ca.uhn.fhir.jpa.config; +import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; +import ca.uhn.fhir.jpa.batch.svc.BatchJobSubmitterImpl; import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.bulk.batch.BulkItemReader; @@ -67,6 +69,11 @@ public class TestR4Config extends BaseJavaConfigR4 { private Exception myLastStackTrace; + @Bean + public IBatchJobSubmitter batchJobSubmitter() { + return new BatchJobSubmitterImpl(); + } + @Bean public CircularQueueCaptureQueriesListener captureQueriesListener() { return new CircularQueueCaptureQueriesListener(); @@ -82,7 +89,7 @@ public class TestR4Config extends BaseJavaConfigR4 { @Bean public Step readPidsStep() { return myStepBuilderFactory.get("readPidsToBeExportedStep") - . chunk(100) + . chunk(2) .reader(myBulkItemReader(null)) .writer(mySimplePrinter()) .build(); @@ -103,6 +110,7 @@ public class TestR4Config extends BaseJavaConfigR4 { public BulkItemReader myBulkItemReader(@Value("#{jobParameters['jobUUID']}") String theJobUUID) { BulkItemReader bulkItemReader = new BulkItemReader(); bulkItemReader.setJobUUID(theJobUUID); + bulkItemReader.setName("bulkItemReader"); return bulkItemReader; } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java index 9bbbf835971..c9ff08dec08 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java @@ -123,8 +123,6 @@ public abstract class BaseJpaTest extends BaseTest { protected IPartitionLookupSvc myPartitionConfigSvc; @Autowired private IdHelperService myIdHelperService; - @Autowired - protected IBatchJobSubmitter myBatchJobSubmitter; @After public void afterPerformCleanup() { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java index 6eafe8843ad..4be3991207f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java @@ -35,9 +35,6 @@ public class ExpungeHookTest extends BaseJpaDstu3Test { @Autowired private DaoConfig myDaoConfig; - @Autowired - private Job testJob; - PointcutLatch myEverythingLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING); PointcutLatch myExpungeResourceLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE); @@ -94,9 +91,4 @@ public class ExpungeHookTest extends BaseJpaDstu3Test { IIdType hookId = hookParams.get(IIdType.class); assertEquals(expungeId.getValue(), hookId.getValue()); } - - @Test - public void testSubmitJob() { - myBatchJobSubmitter.runJob(testJob, new JobParameters()); - } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java index 478c7c90b27..7e6956a6fab 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java @@ -14,6 +14,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSubscription; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; +import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; import ca.uhn.fhir.jpa.binstore.BinaryAccessProvider; import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor; import ca.uhn.fhir.jpa.bulk.IBulkDataExportSvc; @@ -181,7 +182,6 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBui private static IValidationSupport ourJpaValidationSupportChainR4; private static IFhirResourceDaoValueSet ourValueSetDao; - @Autowired protected IPartitionLookupSvc myPartitionConfigSvc; @Autowired @@ -460,6 +460,8 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBui private IBulkDataExportSvc myBulkDataExportSvc; @Autowired private IdHelperService myIdHelperService; + @Autowired + protected IBatchJobSubmitter myBatchJobSubmitter; @After() public void afterCleanupDao() {