[jboss-user] [JBoss jBPM] - Re: Superstate-enter event not fired

tom.baeyens@jboss.com do-not-reply at jboss.com
Wed Sep 5 08:11:16 EDT 2007


before the test "if (destination.getSuperState()!=null)", look at how the destination is set to the first node inside the superstate:

    Node destination = to;
  |     while (destination instanceof SuperState) {
  |       destination = (Node) ((SuperState) destination).getNodes().get(0);
  |     }
  |     
  |     ...
  | 
  |     // performance optimisation: check if at least there is a candidate superstate to be entered.
  |     if ( destination.getSuperState()!=null ) {
  | 

the following test succeeds:

  public void testSuperStateEnterViaTransitionToSuperState() {
  |     processDefinition = ProcessDefinition.parseXmlString(
  |       "<process-definition>" +
  |       "  <start-state name='start'>" +
  |       "    <transition to='superstate'/>" +
  |       "  </start-state>" +
  |       "  <super-state name='superstate'>" +
  |       "    <event type='superstate-enter'>" +
  |       "      <action class='org.jbpm.graph.exe.SuperStateActionExecutionTest$Recorder' />" +
  |       "    </event>" +
  |       "    <super-state name='nestedsuperstate'>" +
  |       "      <event type='superstate-enter'>" +
  |       "        <action class='org.jbpm.graph.exe.SuperStateActionExecutionTest$Recorder' />" +
  |       "      </event>" +
  |       "      <state name='insidenestedsuperstate' />" +
  |       "    </super-state>" +
  |       "  </super-state>" +
  |       "</process-definition>"
  |     );
  |     // create the process instance
  |     processInstance = new ProcessInstance(processDefinition);
  |     processInstance.signal();
  |     assertEquals(3, executedActions.size());
  | 
  |     // the first action called is the superstate-enter on the 'superstate'
  |     ExecutedAction executedAction = (ExecutedAction) executedActions.get(0);
  |     assertEquals("superstate-enter", executedAction.event.getEventType());
  |     assertSame(processDefinition.getNode("superstate"), executedAction.event.getGraphElement());
  |     assertSame(processDefinition.getNode("superstate"), executedAction.eventSource);
  |     assertSame(processInstance.getRootToken(), executedAction.token);
  |     assertNull(executedAction.node);
  |     
  |     // the second action called is the superstate-enter on the 'nestedsuperstate'
  |     executedAction = (ExecutedAction) executedActions.get(1);
  |     assertEquals("superstate-enter", executedAction.event.getEventType());
  |     assertSame(processDefinition.findNode("superstate/nestedsuperstate"), executedAction.event.getGraphElement());
  |     assertSame(processDefinition.findNode("superstate/nestedsuperstate"), executedAction.eventSource);
  |     assertSame(processInstance.getRootToken(), executedAction.token);
  |     assertNull(executedAction.node);
  | 
  |     // the third action called is the *propagated* event of the 'nestedsuperstate' to the 'superstate'
  |     executedAction = (ExecutedAction) executedActions.get(2);
  |     assertEquals("superstate-enter", executedAction.event.getEventType());
  |     assertSame(processDefinition.findNode("superstate"), executedAction.event.getGraphElement());
  |     assertSame(processDefinition.findNode("superstate/nestedsuperstate"), executedAction.eventSource);
  |     assertSame(processInstance.getRootToken(), executedAction.token);
  |     assertNull(executedAction.node);
  |   }
  | 

do you see any difference with your scenario ?  i can't seem to reproduce like this.   i'll give it another try and see if persistenting the execution makes any difference.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081275#4081275

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081275



More information about the jboss-user mailing list