parent
93da042d19
commit
c11b6eeab6
|
@ -25,21 +25,21 @@ import org.springframework.batch.core.explore.JobExplorer;
|
|||
import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
|
||||
public class NonPersistedBatchConfigurer extends DefaultBatchConfigurer {
|
||||
@Autowired
|
||||
@Qualifier("hapiTransactionManager")
|
||||
private PlatformTransactionManager myHapiPlatformTransactionManager;
|
||||
|
||||
private PlatformTransactionManager myPlatformTransactionManager;
|
||||
private MapJobRepositoryFactoryBean myJobRepositoryFactory;
|
||||
|
||||
@Override
|
||||
public PlatformTransactionManager getTransactionManager() {
|
||||
if (myPlatformTransactionManager == null) {
|
||||
myPlatformTransactionManager = new ResourcelessTransactionManager();
|
||||
}
|
||||
return myPlatformTransactionManager;
|
||||
return myHapiPlatformTransactionManager;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,11 +48,8 @@ import org.slf4j.Logger;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -102,30 +99,19 @@ abstract public class BaseEmpiR4Test extends BaseJpaR4Test {
|
|||
EmpiSearchParameterLoader myEmpiSearchParameterLoader;
|
||||
@Autowired
|
||||
SearchParamRegistryImpl mySearchParamRegistry;
|
||||
@Autowired
|
||||
private PlatformTransactionManager myPlatformTransactionManager;
|
||||
|
||||
private TransactionTemplate myTxTemplate;
|
||||
|
||||
@PostConstruct
|
||||
public void initTxTemplate() {
|
||||
myTxTemplate = new TransactionTemplate(myPlatformTransactionManager);
|
||||
}
|
||||
|
||||
protected ServletRequestDetails myRequestDetails = new ServletRequestDetails(null);
|
||||
|
||||
@Override
|
||||
@After
|
||||
public void after() {
|
||||
// TODO KHS Why does adding Spring Batch now require us to wrap this in a transaction?
|
||||
myTxTemplate.executeWithoutResult(t -> myEmpiLinkDao.deleteAll());
|
||||
myEmpiLinkDao.deleteAll();
|
||||
assertEquals(0, myEmpiLinkDao.count());
|
||||
super.after();
|
||||
}
|
||||
|
||||
// TODO KHS Why does adding Spring Batch now require us to wrap this in a transaction?
|
||||
protected void saveLink(EmpiLink theNoMatchLink) {
|
||||
myTxTemplate.executeWithoutResult(t -> myEmpiLinkDaoSvc.save(theNoMatchLink));
|
||||
protected void saveLink(EmpiLink theEmpiLink) {
|
||||
myEmpiLinkDaoSvc.save(theEmpiLink);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
Loading…
Reference in New Issue