diff --git a/hapi-fhir-jpaserver-batch/pom.xml b/hapi-fhir-jpaserver-batch/pom.xml index 258f7cd997c..378baf298c5 100644 --- a/hapi-fhir-jpaserver-batch/pom.xml +++ b/hapi-fhir-jpaserver-batch/pom.xml @@ -17,13 +17,13 @@ - org.springframework.batch - spring-batch-core - 4.2.2.RELEASE + ca.uhn.hapi.fhir + hapi-fhir-server-empi + ${project.version} org.springframework.batch - spring-batch-test + spring-batch-core 4.2.2.RELEASE @@ -31,12 +31,18 @@ spring-batch-infrastructure 4.2.2.RELEASE - org.springframework.data spring-data-jpa ${spring_data_version} + + + org.springframework.batch + spring-batch-test + 4.2.2.RELEASE + test + org.hamcrest java-hamcrest diff --git a/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConfig.java b/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConfig.java index 6d5f3627369..0f619c622f5 100644 --- a/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConfig.java +++ b/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConfig.java @@ -1,9 +1,8 @@ package ca.uhn.fhir.jpa.batch.config; import ca.uhn.fhir.jpa.batch.svc.DummyService; +import org.springframework.batch.core.configuration.annotation.BatchConfigurer; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -11,12 +10,15 @@ import org.springframework.context.annotation.Configuration; @EnableBatchProcessing public class BatchConfig { - @Autowired - private JobRepository myJobRepository; - @Bean public DummyService dummyService() { return new DummyService(); } + @Bean + public BatchConfigurer jpaBatchConfigurer() { + return new JpaBatchConfigurer(); + } + + } diff --git a/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/JpaBatchConfigurer.java b/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/JpaBatchConfigurer.java new file mode 100644 index 00000000000..838fb0172fc --- /dev/null +++ b/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/JpaBatchConfigurer.java @@ -0,0 +1,18 @@ +package ca.uhn.fhir.jpa.batch.config; + +import org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.PlatformTransactionManager; + +@Component +public class JpaBatchConfigurer extends DefaultBatchConfigurer { + + @Autowired + private PlatformTransactionManager myPlatformTransactionManager; + + @Override + public PlatformTransactionManager getTransactionManager() { + return myPlatformTransactionManager; + } +} diff --git a/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/DummyService.java b/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/DummyService.java index 0ff414f80bc..6289b16162a 100644 --- a/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/DummyService.java +++ b/hapi-fhir-jpaserver-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/DummyService.java @@ -10,6 +10,6 @@ public class DummyService { private static final Logger ourLog = getLogger(DummyService.class); public void test() { - ourLog.warn("test"); + ourLog.warn("test testing again"); } } diff --git a/hapi-fhir-jpaserver-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java b/hapi-fhir-jpaserver-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java index 5773eaaab47..37dde16a429 100644 --- a/hapi-fhir-jpaserver-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java +++ b/hapi-fhir-jpaserver-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java @@ -1,8 +1,6 @@ package ca.uhn.fhir.jpa.batch.svc; import ca.uhn.fhir.jpa.batch.BaseBatchR4Test; -import ca.uhn.fhir.jpa.entity.EmpiLink; -import org.junit.After; import org.junit.Test; public class BatchSvcTest extends BaseBatchR4Test { diff --git a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiLinkSvcTest.java b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiLinkSvcTest.java index c3b3a22f104..292fbba5e8b 100644 --- a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiLinkSvcTest.java +++ b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiLinkSvcTest.java @@ -29,6 +29,7 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test { myExpungeEverythingService.expungeEverythingByType(EmpiLink.class); super.after(); } + @Test public void compareEmptyPatients() { Patient patient = new Patient();