Hi all.
I have some very strange problems when writing Tests for Commands. I extended
AbstractDbTestCase. The tests worked standalone in Eclipse, but when running the whole
test suite with Maven, other tests failed.
Okay, problems with test isolation. So lets clean up after my tests. Hence I deleted the
ProcessDefinitions afterwards.Now my tests throw Exceptions :-/
I stripped it down to the following code, which results in a exception what I don't
understand completly yet. Anybody an idea?
| public class WhateverTest extends AbstractDbTestCase
| {
| public void testDBProblem() {
| String xml = "<process-definition name='Test'>"
| +" <start-state name='start'>"
| +" <transition to='end' />"
| +" </start-state>"
| +" <end-state name='end' />"
| +"</process-definition>";
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(xml);
| jbpmContext.deployProcessDefinition(processDefinition);
| ProcessInstance processInstance = processDefinition.createProcessInstance();
| Token token =
jbpmContext.loadTokenForUpdate(processInstance.getRootToken().getId());
| jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
| }
| }
|
The Exception is
| org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:223)
| at org.jbpm.svc.Services.close(Services.java:236)
| at org.jbpm.JbpmContext.close(JbpmContext.java:136)
| at org.jbpm.db.AbstractDbTestCase.closeJbpmContext(AbstractDbTestCase.java:193)
| at org.jbpm.db.AbstractDbTestCase.commitAndCloseSession(AbstractDbTestCase.java:116)
| at org.jbpm.db.AbstractDbTestCase.tearDown(AbstractDbTestCase.java:71)
| at junit.framework.TestCase.runBare(TestCase.java:130)
| at junit.framework.TestResult$1.protect(TestResult.java:106)
| at junit.framework.TestResult.runProtected(TestResult.java:124)
| at junit.framework.TestResult.run(TestResult.java:109)
| at junit.framework.TestCase.run(TestCase.java:118)
| at junit.framework.TestSuite.runTest(TestSuite.java:208)
| at junit.framework.TestSuite.run(TestSuite.java:203)
| at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
| Caused by: org.hibernate.AssertionFailure: null id in
org.jbpm.graph.exe.ProcessInstance entry (don't flush the Session after an exception
occurs)
| at
org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:55)
| at
org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:164)
| at
org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:120)
| at
org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
| at
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
| at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| at
org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:262)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:218)
| ... 18 more
|
The problem is the jbpmContext.loadTokenForUpdate, if I remove the statement, the test
works... But that should work because of Hibernate SessionCache, or am I totally wrong
here?
Thanks for any help or hints!
Cheers
Bernd
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4195487#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...