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>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>4.2.2.RELEASE</version>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-server-empi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
<artifactId>spring-batch-core</artifactId>
<version>4.2.2.RELEASE</version>
</dependency>
<dependency>
@ -31,12 +31,18 @@
<artifactId>spring-batch-infrastructure</artifactId>
<version>4.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring_data_version}</version>
</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>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>

View File

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

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);
public void test() {
ourLog.warn("test");
ourLog.warn("test testing again");
}
}

View File

@ -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 {

View File

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