1 Reply Latest reply on Jun 14, 2008 10:50 AM by kukeltje

    subprocess tescase problem

      Hi I want to execute this code but when I try it I have this error.
      here is my poarent process xml code:


      <?xml version="1.0" encoding="UTF-8"?>

      <process-definition
      xmlns="urn:jbpm.org:jpdl-3.2" name="ana">
      <state name="state">
      <transition name="" to="subprocess"></transition>
      </state>
      <process-state name="subprocess">
      <sub-process name="cocuk" version="1"/>
      <transition name="" to="end"></transition>
      </process-state>
      <end-state name="end"></end-state>
      </process-definition>


      here is my child xml code:

      <?xml version="1.0" encoding="UTF-8"?>
      <process-definition
      xmlns="urn:jbpm.org:jpdl-3.2" name="cocuk">
      <start-state name="start">
      <transition name="" to="state">
      </transition>
      </start-state>
      <state name="state">
      <transition name="" to="end">
      </transition>
      </state>
      <end-state name="end"></end-state>
      </process-definition>

      ana my tescase code:

      public class Subproces extends TestCase {

      public void testBasicScenario() {
      ProcessDefinition superProcessDefinition = ProcessDefinition.parseXmlResource("ana/processdefinition.xml");
      ProcessDefinition subProcessDefinition = ProcessDefinition.parseXmlResource("cocuk/processdefinition.xml");
      ProcessState processState = (ProcessState) superProcessDefinition.getNode("subprocess");
      processState.setSubProcessDefinition(subProcessDefinition);

      ProcessInstance superProcessInstance = new ProcessInstance(superProcessDefinition);
      superProcessInstance.signal();
      Token superToken = superProcessInstance.getRootToken();
      assertSame(processState, superToken.getNode());
      ProcessInstance subProcessInstance = superToken.getSubProcessInstance();
      assertSame(subProcessDefinition, subProcessInstance.getProcessDefinition()); Token subToken = subProcessInstance.getRootToken();

      assertSame(subProcessDefinition.getNode("state"), subToken.getNode());

      subToken.signal();

      assertSame(subProcessDefinition.getNode("end"), subToken.getNode());
      assertTrue(subToken.hasEnded());
      assertTrue(subProcessInstance.hasEnded());

      assertSame(superProcessDefinition.getNode("end"), superToken.getNode());
      assertTrue(superToken.hasEnded());
      assertTrue(superProcessInstance.hasEnded());


      }

      }

      when I run it this error has been occured:

      org.jbpm.JbpmException: token 'Token(/)' can't be signalled cause it is currently not positioned in a node
      at org.jbpm.graph.exe.Token.signal(Token.java:134)
      at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:270)
      at com.sub.sub.testBasicScenario(sub.java:24)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      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:128)
      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)



        • 1. Re: subprocess tescase problem
          kukeltje

          2 hints:

          - use [ c o d e ] tags instead of quote. Now some info is missing
          - if you use a testcase with embedded processdefinitions as strings, I can more easily run them to see what goes on

          Currently we have no clue on where the error occurs (linenumber etc..) so it is hard to tell