06-23-2011 09:45 AM
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/testApplicationContext.xml" }
@TransactionConfiguration(defaultRollback = true)
@Transactional
public class HelloProcessTest
@Test
public void simpleProcessTest() {
DeploymentBuilder db = repositoryService.createDeployment();
if (enableDuplicateFiltering) {
db.enableDuplicateFiltering();
}
InputStream in = pDef.openStream();
try {
db.addInputStream(classPathUrl, in);
} finally {
IOUtils.closeQuietly(in);
}
db.deploy();
runtimeService.startProcessInstanceByKey(ProcessDefintion.TEST_HELLO.getProcessName());
Task task = taskService.createTaskQuery().singleResult();
….
}
<bean id="appDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/wgs" />
</bean>
<bean id="appEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="appDataSource" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="appEmf" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<context:annotation-config />
20110623 152802 INFO [org.springframework.test.context.transaction.TransactionalTestExecutionListener] (main) Began transaction (1): transaction manager [org.springframework.orm.jpa.JpaTransactionManager@5c232697]; rollback [true]
20110623 152802 DEBUG [net.tinvention.edita21.wgs.mid.manager.WorkFlowManager] (main) deployng: /diagrams/test/hello.bpmn20.xml
20110623 152802 DEBUG [java.sql.Connection] (main) ooo Connection Opened
20110623 152802 DEBUG [java.sql.Connection] (main) ooo Connection Opened
20110623 152802 DEBUG [java.sql.PreparedStatement] (main) ==> Executing: select * from ACT_GE_PROPERTY where NAME_ = ?
….
06-23-2011 11:45 AM
06-27-2011 05:09 AM
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="appEmf" />
</bean>
But when I change it to <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="appDataSource" />
</bean>
All seems working, also not committing tests configurations.<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="appDataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jpaEntityManagerFactory" ref="appEmf" />
<property name="jpaHandleTransaction" value="true" />
<property name="jpaCloseEntityManager" value="true" />
<property name="jobExecutorActivate" value="true" />
</bean>
11-18-2011 06:14 AM
11-18-2011 07:24 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.