AnsweredAssumed Answered

JUnit: execution does not exist

Question asked by christoph.rettig on Jun 25, 2011
Latest reply on Aug 16, 2011 by ronald.van.kuijk
Hi, I have created my first process as a copy of the groovy examples and when I run the JUnit test with the code


  @Deployment
  public void testMyProcess() {
    
    int[] inputArray = new int[] {1, 2, 3, 4, 5};
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("myProcess", CollectionUtil.singletonMap("inputArray", inputArray));

    for (Execution execution : runtimeService.createExecutionQuery().list()) {
       System.out.println(String.format("[EXECUTION %s] %s", execution.getId(), execution.getProcessInstanceId()));
    }
   
    Integer result = (Integer) runtimeService.getVariable(pi.getId(), "y");
    assertEquals(2, result.intValue());
  }


it fails with

org.activiti.engine.ActivitiException: execution 5 doesn't exist
   at org.activiti.engine.impl.cmd.GetExecutionVariableCmd.execute(GetExecutionVariableCmd.java:49)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(RuntimeServiceImpl.java:97)
   at com.braintribe.bpm.samples.DemoTest.testMyProcess(DemoTest.java:22)
   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:168)
   at org.activiti.engine.impl.test.PvmTestCase.runTest(PvmTestCase.java:75)
   at junit.framework.TestCase.runBare(TestCase.java:134)
   at org.activiti.engine.impl.test.AbstractActivitiTestCase.runBare(AbstractActivitiTestCase.java:89)
   at junit.framework.TestResult$1.protect(TestResult.java:110)
   at junit.framework.TestResult.runProtected(TestResult.java:128)
   at junit.framework.TestResult.run(TestResult.java:113)
   at junit.framework.TestCase.run(TestCase.java:124)
   at junit.framework.TestSuite.runTest(TestSuite.java:232)
   at junit.framework.TestSuite.run(TestSuite.java:227)
   at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

which is correct because

runtimeService.createExecutionQuery().list()

does not pass anything back.

My question is if I did miss a setting to keep the process alive (I copied all the files from the groovy example and just changed
created a new process myself)?

  regards, Chris

P.S. sorry for asking that simple questions, I am new to the topic

Outcomes