This commit is contained in:
Tadgh 2020-05-26 12:08:00 -07:00
parent 35b1533db1
commit 48fcf8a39d
6 changed files with 38 additions and 13 deletions

View File

@ -17,13 +17,13 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.batch</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>spring-batch-core</artifactId> <artifactId>hapi-fhir-server-empi</artifactId>
<version>4.2.2.RELEASE</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.batch</groupId> <groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId> <artifactId>spring-batch-core</artifactId>
<version>4.2.2.RELEASE</version> <version>4.2.2.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
@ -31,12 +31,18 @@
<artifactId>spring-batch-infrastructure</artifactId> <artifactId>spring-batch-infrastructure</artifactId>
<version>4.2.2.RELEASE</version> <version>4.2.2.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId> <artifactId>spring-data-jpa</artifactId>
<version>${spring_data_version}</version> <version>${spring_data_version}</version>
</dependency> </dependency>
<!--test dependencies -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
<version>4.2.2.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId> <artifactId>java-hamcrest</artifactId>

View File

@ -1,9 +1,8 @@
package ca.uhn.fhir.jpa.batch.config; package ca.uhn.fhir.jpa.batch.config;
import ca.uhn.fhir.jpa.batch.svc.DummyService; 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.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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -11,12 +10,15 @@ import org.springframework.context.annotation.Configuration;
@EnableBatchProcessing @EnableBatchProcessing
public class BatchConfig { public class BatchConfig {
@Autowired
private JobRepository myJobRepository;
@Bean @Bean
public DummyService dummyService() { public DummyService dummyService() {
return new DummyService(); return new DummyService();
} }
@Bean
public BatchConfigurer jpaBatchConfigurer() {
return new JpaBatchConfigurer();
}
} }

View File

@ -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;
}
}

View File

@ -10,6 +10,6 @@ public class DummyService {
private static final Logger ourLog = getLogger(DummyService.class); private static final Logger ourLog = getLogger(DummyService.class);
public void test() { public void test() {
ourLog.warn("test"); ourLog.warn("test testing again");
} }
} }

View File

@ -1,8 +1,6 @@
package ca.uhn.fhir.jpa.batch.svc; package ca.uhn.fhir.jpa.batch.svc;
import ca.uhn.fhir.jpa.batch.BaseBatchR4Test; import ca.uhn.fhir.jpa.batch.BaseBatchR4Test;
import ca.uhn.fhir.jpa.entity.EmpiLink;
import org.junit.After;
import org.junit.Test; import org.junit.Test;
public class BatchSvcTest extends BaseBatchR4Test { public class BatchSvcTest extends BaseBatchR4Test {

View File

@ -29,6 +29,7 @@ public class EmpiLinkSvcTest extends BaseEmpiR4Test {
myExpungeEverythingService.expungeEverythingByType(EmpiLink.class); myExpungeEverythingService.expungeEverythingByType(EmpiLink.class);
super.after(); super.after();
} }
@Test @Test
public void compareEmptyPatients() { public void compareEmptyPatients() {
Patient patient = new Patient(); Patient patient = new Patient();