-
1. Re: Signaling executions for processes that containt tasks d
kukeltje Sep 11, 2009 8:36 AM (in response to lmarinkov)and what are the errors (stacktrace, preferably logging on debug lever etc..)? And if possible, can you post the full unittests here or one minimal (saves us copy pasting and reduces chances we do something different they you by accident)
-
2. Re: Signaling executions for processes that containt tasks d
lmarinkov Sep 11, 2009 9:04 AM (in response to lmarinkov)The error that occurs is:
org.hibernate.NonUniqueResultException: query did not return a unique result: 2
If you have check out the 4.1 branch from svn. Just replace the state in the process definition with task and then run:
mvn -Dtest="SignalExecutionTest" test
As you requested below is shown the full code for the shortest test(AvgDurationTest):package org.jbpm.test.history; import java.util.Map; import org.jbpm.api.Execution; import org.jbpm.test.JbpmTestCase; public class AvgDurationTest extends JbpmTestCase { public void testAvgDuration() throws Exception { deployJpdlXmlString( "<process name='Insurance claim' key='ICL'>" + " <start>" + " <transition to='one' />" + " </start>" + " <task name='one'>" + " <transition to='two' />" + " </task>" + " <task name='two'>" + " <transition to='three' />" + " </task>" + " <task name='three'>" + " <transition to='end' />" + " </task>" + " <end name='end' />" + "</process>" ); executeProcess(); executeProcess(); executeProcess(); Map<String, Long> avgDurations = historyService.avgDurationPerActivity("ICL-1"); Long avgDurationOne = avgDurations.get("one"); assertNotNull(avgDurationOne); assertTrue("expected avg duration bigger then 40, but was"+avgDurationOne, avgDurationOne>40); Long avgDurationTwo = avgDurations.get("two"); assertNotNull(avgDurationTwo); assertTrue("expected avg duration bigger then 10, but was"+avgDurationTwo, avgDurationTwo>10); Long avgDurationThree = avgDurations.get("three"); assertNotNull(avgDurationThree); assertTrue("expected avg duration bigger then 0, but was"+avgDurationThree, avgDurationThree>=0); assertEquals(3, avgDurations.size()); } protected void executeProcess() throws InterruptedException { Execution execution = executionService.startProcessInstanceByKey("ICL"); Thread.sleep(50); executionService.signalExecutionById(execution.getId()); Thread.sleep(20); executionService.signalExecutionById(execution.getId()); executionService.signalExecutionById(execution.getId()); } }
Logging output in eclipse console with logging set to org.jbpm.level=FINE12:20:41,500 FIN | [BaseJbpmTestCase] === starting testSignalExecutionById ============================= 12:20:44,559 FIN | [ProcessDefinitionImpl] creating new execution for process 'Insurance claim' 12:20:44,567 FIN | [DefaultIdGenerator] generated execution id ICL.82436 12:20:44,577 FIN | [ExecuteActivity] executing activity(18662247) 12:20:44,578 FIN | [ExecuteActivity] executing activity(a) 12:20:44,600 FIN | [Signal] signalling activity(a), signalName=null 12:20:44,605 FIN | [ExecuteActivity] executing activity(b) 12:20:44,624 FIN | [Signal] signalling activity(b), signalName=null ### EXCEPTION ########################################### 12:20:44,627 INF | [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.SignalCmd@b48b11 org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835) at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findTaskByExecution(DbSessionImpl.java:383) at org.jbpm.jpdl.internal.activity.TaskActivity.signal(TaskActivity.java:116) at org.jbpm.jpdl.internal.activity.TaskActivity.signal(TaskActivity.java:102) at org.jbpm.pvm.internal.model.op.Signal.perform(Signal.java:68) at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637) at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597) at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:398) at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61) at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:35) at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42) at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54) at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46) at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55) at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:84) at com.cg.wfl.jbpm.examples.wfl_examples.execution.SignalExecutionTest.testSignalExecutionById(SignalExecutionTest.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:154) at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80) at junit.framework.TestCase.runBare(TestCase.java:127) 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) ### EXCEPTION ########################################### 12:20:44,636 SEV | [BaseJbpmTestCase] ### EXCEPTION ########################################### 12:20:44,636 SEV | [BaseJbpmTestCase] TEST THROWS EXCEPTION: query did not return a unique result: 2 org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835) at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findTaskByExecution(DbSessionImpl.java:383) at org.jbpm.jpdl.internal.activity.TaskActivity.signal(TaskActivity.java:116) at org.jbpm.jpdl.internal.activity.TaskActivity.signal(TaskActivity.java:102) at org.jbpm.pvm.internal.model.op.Signal.perform(Signal.java:68) at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637) at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597) at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:398) at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61) at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:35) at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42) at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54) at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46) at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55) at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:84) at com.cg.wfl.jbpm.examples.wfl_examples.execution.SignalExecutionTest.testSignalExecutionById(SignalExecutionTest.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:154) at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80) at junit.framework.TestCase.runBare(TestCase.java:127) 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) ### EXCEPTION ########################################### 12:20:44,637 SEV | [BaseJbpmTestCase] 12:20:44,670 FIN | [DbSessionImpl] deleting history process instance ICL.82436 12:20:44,707 FIN | [DbSessionImpl] deleting process instance ICL.82436 12:20:44,718 FIN | [DeleteDeploymentCmd] deleting deployment 1 12:20:44,762 FIN | [BaseJbpmTestCase] === ending testSignalExecutionById ============================= 12:20:44,765 FIN | [BaseJbpmTestCase] === starting testSignalExecutionWithVariables ============================= 12:20:44,806 FIN | [ProcessDefinitionImpl] creating new execution for process 'Insurance claim' 12:20:44,810 FIN | [DefaultIdGenerator] generated execution id ICL.82436 12:20:44,810 FIN | [ExecuteActivity] executing activity(19679080) 12:20:44,811 FIN | [ExecuteActivity] executing activity(a) 12:20:44,822 FIN | [Signal] signalling activity(a), signalName=null 12:20:44,824 FIN | [ScopeInstanceImpl] create variable 'amount' in 'execution[ICL.82436]' with value '763.74' 12:20:44,825 FIN | [ScopeInstanceImpl] create variable 'type' in 'execution[ICL.82436]' with value 'Accident' 12:20:44,825 FIN | [ScopeInstanceImpl] create variable 'customer' in 'execution[ICL.82436]' with value 'John Doe' 12:20:44,834 FIN | [ExecuteActivity] executing activity(b) 12:20:44,869 FIN | [DbSessionImpl] deleting history process instance ICL.82436 12:20:44,885 FIN | [DbSessionImpl] deleting process instance ICL.82436 12:20:44,891 FIN | [DeleteDeploymentCmd] deleting deployment 2 12:20:44,901 FIN | [BaseJbpmTestCase] === ending testSignalExecutionWithVariables ============================= 12:20:44,901 FIN | [BaseJbpmTestCase] === starting testDefaultSignalWithoutTransitions ============================= 12:20:45,014 FIN | [ProcessDefinitionImpl] creating new execution for process 'p' 12:20:45,019 FIN | [DefaultIdGenerator] generated execution id p.3 12:20:45,022 FIN | [ExecuteActivity] executing activity(12812631) 12:20:45,023 FIN | [ExecuteActivity] executing activity(a) 12:20:45,041 FIN | [Signal] signalling activity(a), signalName=null 12:20:45,042 FIN | [ExecutionImpl] execution[p.3] ends 12:20:45,057 FIN | [DbSessionImpl] deleting process instance p.3 12:20:45,059 SEV | [BaseJbpmTestCase] ### EXCEPTION ########################################### 12:20:45,059 SEV | [BaseJbpmTestCase] ASSERTION FAILURE: null junit.framework.AssertionFailedError at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.assertTrue(Assert.java:20) at junit.framework.Assert.assertTrue(Assert.java:27) at com.cg.wfl.jbpm.examples.wfl_examples.execution.SignalExecutionTest.testDefaultSignalWithoutTransitions(SignalExecutionTest.java:91) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:154) at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80) at junit.framework.TestCase.runBare(TestCase.java:127) 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) ### EXCEPTION ########################################### 12:20:45,059 SEV | [BaseJbpmTestCase] 12:20:45,106 FIN | [DeleteDeploymentCmd] deleting deployment 3 12:20:45,115 FIN | [BaseJbpmTestCase] === ending testDefaultSignalWithoutTransitions =============================
best regards! -
3. Re: Signaling executions for processes that containt tasks d
kukeltje Sep 11, 2009 9:27 AM (in response to lmarinkov)does this stacktrace belong to the class you posted? It seems totally different (and I think the class you posted is wrong)
-
4. Re: Signaling executions for processes that containt tasks d
lmarinkov Sep 11, 2009 9:45 AM (in response to lmarinkov)Here is the error for the AvgDurationTest class. Sorry the log that i posted was for the unit test that i wrote. But the error in both tests is the same!
------------------------------------------------------------------------------- Test set: org.jbpm.test.history.AvgDurationTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.764 sec <<< FAILURE! testAvgDuration(org.jbpm.test.history.AvgDurationTest) Time elapsed: 2.717 sec <<< ERROR! org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835) at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findTaskByExecution(DbSessionImpl.java:383) at org.jbpm.jpdl.internal.activity.TaskActivity.signal(TaskActivity.java:116) at org.jbpm.jpdl.internal.activity.TaskActivity.signal(TaskActivity.java:102) at org.jbpm.pvm.internal.model.op.Signal.perform(Signal.java:68) at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637) at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597) at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:398) at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61) at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:35) at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42) at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54) at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46) at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55) at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:84) at org.jbpm.test.history.AvgDurationTest.executeProcess(AvgDurationTest.java:79) at org.jbpm.test.history.AvgDurationTest.testAvgDuration(AvgDurationTest.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:164) at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80) 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:120) at junit.framework.TestSuite.runTest(TestSuite.java:230) at junit.framework.TestSuite.run(TestSuite.java:225) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
-
5. Re: Signaling executions for processes that containt tasks d
kukeltje Sep 11, 2009 10:36 AM (in response to lmarinkov)According to the last log, the error is in
at org.jbpm.test.history.AvgDurationTest.executeProcess(AvgDurationTest.java:79)
But there is no line 79 in the code above. -
6. Re: Signaling executions for processes that containt tasks d
lmarinkov Sep 11, 2009 11:58 AM (in response to lmarinkov)/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jbpm.test.history; import java.util.Map; import org.jbpm.api.Execution; import org.jbpm.test.JbpmTestCase; /** * @author Tom Baeyens */ public class AvgDurationTest extends JbpmTestCase { public void testAvgDuration() throws Exception { deployJpdlXmlString( "<process name='Insurance claim' key='ICL'>" + " <start>" + " <transition to='one' />" + " </start>" + " <task name='one'>" + " <transition to='two' />" + " </task>" + " <task name='two'>" + " <transition to='three' />" + " </task>" + " <task name='three'>" + " <transition to='end' />" + " </task>" + " <end name='end' />" + "</process>" ); executeProcess(); executeProcess(); executeProcess(); Map<String, Long> avgDurations = historyService.avgDurationPerActivity("ICL-1"); Long avgDurationOne = avgDurations.get("one"); assertNotNull(avgDurationOne); assertTrue("expected avg duration bigger then 40, but was"+avgDurationOne, avgDurationOne>40); Long avgDurationTwo = avgDurations.get("two"); assertNotNull(avgDurationTwo); assertTrue("expected avg duration bigger then 10, but was"+avgDurationTwo, avgDurationTwo>10); Long avgDurationThree = avgDurations.get("three"); assertNotNull(avgDurationThree); assertTrue("expected avg duration bigger then 0, but was"+avgDurationThree, avgDurationThree>=0); assertEquals(3, avgDurations.size()); } protected void executeProcess() throws InterruptedException { Execution execution = executionService.startProcessInstanceByKey("ICL"); Thread.sleep(50); executionService.signalExecutionById(execution.getId()); Thread.sleep(20); executionService.signalExecutionById(execution.getId()); executionService.signalExecutionById(execution.getId()); } }
-
7. Re: Signaling executions for processes that containt tasks d
lmarinkov Sep 11, 2009 12:02 PM (in response to lmarinkov)Hi Roland do you need something more?