Package org.jbpm.graph.exe

Examples of org.jbpm.graph.exe.ProcessInstance


      "  </task-node>" +
      "  <end-state name='end' />" +
      "</process-definition>"
    );

    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("testSwimlanePoolReassignmentOfNonTakenTask");
    processInstance.signal();

    processInstance = saveAndReload(processInstance);

    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    SwimlaneInstance swimlaneInstance = taskMgmtInstance.getSwimlaneInstance("hero");
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
   
    assertNull(changeNappy.getActorId());
    assertEquals(3, changeNappy.getPooledActors().size());
    assertEquals(changeNappy.getPooledActors(), swimlaneInstance.getPooledActors());
   
    changeNappy.end();

    processInstance = saveAndReload(processInstance);

    taskMgmtInstance = processInstance.getTaskMgmtInstance();
    swimlaneInstance = taskMgmtInstance.getSwimlaneInstance("hero");
   
    TaskInstance makeBottle = (TaskInstance) taskMgmtInstance.getUnfinishedTasks(processInstance.getRootToken()).iterator().next();
    assertNull(makeBottle.getActorId());
    assertEquals(3, makeBottle.getPooledActors().size());
    assertEquals(makeBottle.getPooledActors(), swimlaneInstance.getPooledActors());
  }
View Full Code Here


      "  </task-node>" +
      "  <end-state name='end' />" +
      "</process-definition>"
    );

    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("testSwimlanePoolReassignmentOfTakenTask");
    processInstance.signal();
   
    processInstance = saveAndReload(processInstance);
   
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    SwimlaneInstance swimlaneInstance = taskMgmtInstance.getSwimlaneInstance("hero");
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
    changeNappy.setActorId("should-be-one-of-the-actors-in-the-pool-but-doesnt-have-to");
   
    assertEquals("should-be-one-of-the-actors-in-the-pool-but-doesnt-have-to", changeNappy.getActorId());
    assertEquals(3, changeNappy.getPooledActors().size());
    assertEquals(changeNappy.getPooledActors(), swimlaneInstance.getPooledActors());
   
    changeNappy.end();

    processInstance = saveAndReload(processInstance);

    taskMgmtInstance = processInstance.getTaskMgmtInstance();
    swimlaneInstance = taskMgmtInstance.getSwimlaneInstance("hero");
    TaskInstance makeBottle = (TaskInstance) taskMgmtInstance.getUnfinishedTasks(processInstance.getRootToken()).iterator().next();
    assertEquals("should-be-one-of-the-actors-in-the-pool-but-doesnt-have-to", makeBottle.getActorId());
    assertEquals(3, makeBottle.getPooledActors().size());
    assertEquals(makeBottle.getPooledActors(), swimlaneInstance.getPooledActors());
  }
View Full Code Here

      "    <task name='change nappy' swimlane='hero' />'" +
      "  </task-node>" +
      "</process-definition>"
    );

    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("testNullActorsForSwimlaneInitialization");
    processInstance.signal();
   
    processInstance = saveAndReload(processInstance);
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    SwimlaneInstance swimlaneInstance = taskMgmtInstance.getSwimlaneInstance("hero");
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
   
    assertNull(swimlaneInstance.getActorId());
    assertEquals(0, swimlaneInstance.getPooledActors().size());
View Full Code Here

      "</process-definition>"
    );
    processDefinition = saveAndReload(processDefinition);
   
    // create the process instance
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
    jbpmContext.save(processInstance);
   
    commitAndCloseSession();
   
    SchedulerThread schedulerThread = new SchedulerThread(jbpmConfiguration);
View Full Code Here

  public void testStates() {
    log.info("");
    log.info("=== CREATING PROCESS INSTANCE =======================================================");
    log.info("");
    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("states");
    ContextInstance contextInstance = processInstance.getContextInstance();
    contextInstance.setVariable("hotel", "best western");
    contextInstance.setVariable("city", "wengen");
    contextInstance.setVariable("ski conditions", "excellent");
    contextInstance.setVariable("slopes", "well prepared and sunny");
    contextInstance.setVariable("food", "just enough");
    processInstance.signal();

    newTransaction();
   
    log.info("");
    log.info("=== PERFORMING TASK ONE =======================================================");
View Full Code Here

  public void testStates() {
    log.info("");
    log.info("=== CREATING PROCESS INSTANCE =======================================================");
    log.info("");
    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("states");
    processInstance.signal();

    newTransaction();
    long processInstanceId = processInstance.getId();
   
    log.info("");
    log.info("=== STATE CHANGE ONE --> TWO =======================================================");
    log.info("");
    processInstance = jbpmContext.loadProcessInstanceForUpdate(processInstanceId);
    processInstance.signal();

    newTransaction();
   
    log.info("");
    log.info("=== STATE CHANGE TWO --> END =======================================================");
    log.info("");
    processInstance = jbpmContext.loadProcessInstanceForUpdate(processInstanceId);
    processInstance.signal();
  }
View Full Code Here

    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
     
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
     
      assertEquals(1, testSchedulerService.createdTimers.size());
      Timer scheduledTimer = (Timer) testSchedulerService.createdTimers.get(0);
      assertEquals("reminder", scheduledTimer.name);
      assertEquals(processDefinition.getNode("catch crooks"), scheduledTimer.graphElement);
      System.out.println("due date: "+scheduledTimer.dueDate);
      assertNotNull(scheduledTimer.dueDate);
      assertEquals("10 business minutes", scheduledTimer.repeat);
      assertEquals("the-remainder-action-class-name", scheduledTimer.action.getActionDelegation().getClassName());
      assertSame(processInstance.getRootToken(), scheduledTimer.token);
      assertEquals("time-out-transition", scheduledTimer.transitionName);
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
     
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
     
      assertEquals(1, testSchedulerService.createdTimers.size());
      Timer scheduledTimer = (Timer) testSchedulerService.createdTimers.get(0);
      assertEquals("reminder", scheduledTimer.name);
      assertEquals(processDefinition.getNode("catch crooks"), scheduledTimer.graphElement);
      System.out.println("due date: "+scheduledTimer.dueDate);
      assertNotNull(scheduledTimer.dueDate);
      assertEquals("10 business minutes", scheduledTimer.repeat);
      assertEquals("the-remainder-action-class-name", scheduledTimer.action.getActionDelegation().getClassName());
      assertSame(processInstance.getRootToken(), scheduledTimer.token);
      assertEquals("time-out-transition", scheduledTimer.transitionName);
 
      // while we are at it, i might as well check if the cancel timer is not executed ;)
      processInstance.signal();
      assertEquals(0, testSchedulerService.cancelledTimersByName.size());
     
    } finally {
      jbpmContext.close();
    }
View Full Code Here

   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
     
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
      processInstance.signal();
     
      List cancelledTimerNames = testSchedulerService.cancelledTimersByName;
      assertEquals(1, cancelledTimerNames.size());
      Object[] cancelledTimer = (Object[]) cancelledTimerNames.get(0);
      assertEquals("reminder", cancelledTimer[0]);
      assertSame(processInstance.getRootToken(), cancelledTimer[1]);
     
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "</process-definition>"
    );
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      assertNull(TimerCreateAction.timer);
      processInstance.signal();
      assertNotNull(TimerCreateAction.timer);
      assertEquals("the-timer-create-event-class-name", TimerCreateAction.timer.action.getActionDelegation().getClassName());

    } finally {
      jbpmContext.close();
View Full Code Here

TOP

Related Classes of org.jbpm.graph.exe.ProcessInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.