コード例 #1
0
 public void testNoRootTokenCreateLog() {
   // the root token logs are replaced by the process instance logs
   ProcessDefinition processDefinition = new ProcessDefinition();
   ProcessInstance processInstance = new ProcessInstance(processDefinition);
   LoggingInstance loggingInstance = processInstance.getLoggingInstance();
   assertEquals(0, loggingInstance.getLogs(TokenCreateLog.class).size());
 }
コード例 #2
0
  public void testUseSuperStateTransitionLogs() {
    ProcessDefinition processDefinition =
        ProcessDefinition.parseXmlString(
            "<process-definition>"
                + "  <start-state>"
                + "    <transition to='superstate/state' />"
                + "  </start-state>"
                + "  <super-state name='superstate'>"
                + "    <state name='state'/>"
                + "    <transition to='end' />"
                + "  </super-state>"
                + "  <end-state name='end' />"
                + "</process-definition>");

    // start a process instance
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    processInstance.signal();
    processInstance.signal();

    // check the transition log (from the start state to the state)
    LoggingInstance loggingInstance = processInstance.getLoggingInstance();
    List transitionLogs = loggingInstance.getLogs(TransitionLog.class);
    assertEquals(2, transitionLogs.size());
    TransitionLog transitionLog = (TransitionLog) transitionLogs.get(1);
    assertSame(token, transitionLog.getToken());
    assertNotNull(transitionLog.getDate());
    assertSame(processDefinition.findNode("superstate/state"), transitionLog.getSourceNode());
    assertSame(processDefinition.getNode("end"), transitionLog.getDestinationNode());
  }
コード例 #3
0
 public void testProcessInstanceCreateLog() {
   ProcessDefinition processDefinition = new ProcessDefinition();
   ProcessInstance processInstance = new ProcessInstance(processDefinition);
   LoggingInstance loggingInstance = processInstance.getLoggingInstance();
   List processInstanceCreateLogs = loggingInstance.getLogs(ProcessInstanceCreateLog.class);
   assertEquals(1, processInstanceCreateLogs.size());
   ProcessInstanceCreateLog processInstanceCreateLog =
       (ProcessInstanceCreateLog) processInstanceCreateLogs.get(0);
   assertSame(processInstance.getRootToken(), processInstanceCreateLog.getToken());
 }