Hi guys,I'm using spring with activiti and I like to have unit tests that does not commit. But it seems committing also using @TransactionConfiguration(defaultRollback = true) .Here the only important part of my code: @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();
….
}
After that I found records into dbms …. My spring configuration is like this:<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 />
Any ideas ? Where is my error ?In my log I see: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_ = ?
….
After begin transaction message, I see two new connections be opened without transaction begins messages … It seems are done by deploy action of activiti.Any Ideas ?Thx in advance.