0 Replies Latest reply on Mar 2, 2006 2:17 AM by Zhang Davis

    Help about TransitionLogTest

    Zhang Davis Newbie

      why this test case can't pass

       public void testBasicTransitionLogs() {
       ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       " <start-state>" +
       " <transition to='state' />" +
       " </start-state>" +
       " <state name='state'>" +
       " <transition to='end' />" +
       " </state>" +
       " <end-state name='end' />" +
       "</process-definition>"
       );
       processDefinition = this.saveAndReload(processDefinition);
      
       // start a process instance
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
       processInstance = this.saveAndReload(processInstance);
       Token token = processInstance.getRootToken();
       processInstance.signal();
       processInstance = this.saveAndReload(processInstance);
      
       // check the transition log (from the start state to the state)
       LoggingInstance loggingInstance = processInstance.getLoggingInstance();
       List transitionLogs = loggingInstance.getLogs(TransitionLog.class);
       assertEquals(1, transitionLogs.size());
       TransitionLog transitionLog = (TransitionLog) transitionLogs.get(0);
       assertSame(token, transitionLog.getToken());
       assertNotNull(transitionLog.getDate());
       assertSame(processDefinition.getStartState(), transitionLog.getSourceNode());
       assertSame(processDefinition.getNode("state"), transitionLog.getDestinationNode());
       processInstance = this.saveAndReload(processInstance);
       // signal the process to continue (which will move it to the end state)
       processInstance.signal();
       processInstance = this.saveAndReload(processInstance);
       // check the transition log (from the state to the end state)
       transitionLogs = loggingInstance.getLogs(TransitionLog.class);
       assertEquals(2, transitionLogs.size());
       transitionLog = (TransitionLog) transitionLogs.get(1);
       assertSame(token, transitionLog.getToken());
       assertNotNull(transitionLog.getDate());
       assertSame(processDefinition.getNode("state"), transitionLog.getSourceNode());
       assertSame(processDefinition.getNode("end"), transitionLog.getDestinationNode());
       }
      


      but this test case can pass

      
       public void testBasicTransitionLogs() {
       ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       " <start-state>" +
       " <transition to='state' />" +
       " </start-state>" +
       " <state name='state'>" +
       " <transition to='end' />" +
       " </state>" +
       " <end-state name='end' />" +
       "</process-definition>"
       );
      
       // start a process instance
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
       Token token = processInstance.getRootToken();
       processInstance.signal();
      
       // check the transition log (from the start state to the state)
       LoggingInstance loggingInstance = processInstance.getLoggingInstance();
       List transitionLogs = loggingInstance.getLogs(TransitionLog.class);
       assertEquals(1, transitionLogs.size());
       TransitionLog transitionLog = (TransitionLog) transitionLogs.get(0);
       assertSame(token, transitionLog.getToken());
       assertNotNull(transitionLog.getDate());
       assertSame(processDefinition.getStartState(), transitionLog.getSourceNode());
       assertSame(processDefinition.getNode("state"), transitionLog.getDestinationNode());
      
       // signal the process to continue (which will move it to the end state)
       processInstance.signal();
      
       // check the transition log (from the state to the end state)
       transitionLogs = loggingInstance.getLogs(TransitionLog.class);
       assertEquals(2, transitionLogs.size());
       transitionLog = (TransitionLog) transitionLogs.get(1);
       assertSame(token, transitionLog.getToken());
       assertNotNull(transitionLog.getDate());
       assertSame(processDefinition.getNode("state"), transitionLog.getSourceNode());
       assertSame(processDefinition.getNode("end"), transitionLog.getDestinationNode());
       }
      



      Thanks :)