Examples of ProcessDefinition


Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _02_WaitStateExternalActivityTest extends TestCase {

  public void testWaitState() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .node("a").initial().behaviour(new WaitState())
          .transition().to("b")
        .node("b").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.signal();
  }
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _01_SequenceTest extends TestCase {

  public void testSequence() {
    ProcessDefinition processDefinition = ProcessFactory.build("sequence")
        .compositeNode("sequence").initial().behaviour(new Sequence())
          .needsPrevious()
          .node("one").behaviour(new Display("one"))
          .node("2").behaviour(new WaitState())
          .node("two").behaviour(new Display("two"))
        .compositeEnd()
    .done();

    Execution execution = processDefinition.startExecution();
    execution.signal();
    assertTrue(execution.isEnded());
    assertEquals("sequence", execution.getNode().getName());
  }
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _01_AutomaticDecisionTest extends TestCase {

  public void testAutomaticDecision() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .node("initial").initial().behaviour(new WaitState())
          .transition().to("creditRate?")
        .node("creditRate?").behaviour(new AutomaticCreditRating())
          .transition("good").to("a")
          .transition("average").to("b")
          .transition("bad").to("c")
        .node("a").behaviour(new WaitState())
        .node("b").behaviour(new WaitState())
        .node("c").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.setVariable("creditRate", 13);
    execution.signal();
    assertEquals("a", execution.getNode().getName());

    execution = processDefinition.startExecution();
    execution.setVariable("creditRate", 2);
    execution.signal();
    assertEquals("b", execution.getNode().getName());

    execution = processDefinition.startExecution();
    execution.setVariable("creditRate", -13);
    execution.signal();
    assertEquals("c", execution.getNode().getName());
  }
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _01_DisplayActivityTest extends TestCase {

  public void testDisplay() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .node("a").initial().behaviour(new Display("hello"))
          .transition().to("b")
        .node("b").behaviour(new Display("world"))
    .done();
   
    Execution execution = processDefinition.startExecution();
    assertEquals("b", execution.getNode().getName());
    assertTrue(execution.isEnded());
  }
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _02_ConditionalBranchingTest extends TestCase {

  public void testCompositeConditionalBranching() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .compositeNode("creditRate?").initial().behaviour(new CompositeCreditRating())
          .node("good").behaviour(new WaitState())
          .node("average").behaviour(new WaitState())
          .node("bad").behaviour(new WaitState())
        .compositeEnd()
    .done();
   
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("creditRate", 13);
    Execution execution = processDefinition.startExecution(variables);
    assertEquals("good", execution.getNode().getName());

    variables = new HashMap<String, Object>();
    variables.put("creditRate", 2);
    execution = processDefinition.startExecution(variables);
    assertEquals("average", execution.getNode().getName());

    variables = new HashMap<String, Object>();
    variables.put("creditRate", -18);
    execution = processDefinition.startExecution(variables);
    assertEquals("bad", execution.getNode().getName());
  }
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _01_ExecutionAndThreadTest extends TestCase {

  public void testExecutionAndThread() {
    ProcessDefinition processDefinition = ProcessFactory.build("automatic")
        .node("wait 1").initial().behaviour(new WaitState())
          .transition().to("automatic 1")
        .node("automatic 1").behaviour(new Display("one"))
          .transition().to("wait 2")
        .node("wait 2").behaviour(new WaitState())
          .transition().to("automatic 2")
        .node("automatic 2").behaviour(new Display("two"))
          .transition().to("automatic 3")
        .node("automatic 3").behaviour(new Display("three"))
          .transition().to("automatic 4")
        .node("automatic 4").behaviour(new Display("four"))
          .transition().to("wait 3")
        .node("wait 3").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    assertEquals("wait 1", execution.getNode().getName());
    execution.signal();
    assertEquals("wait 2", execution.getNode().getName());
    execution.signal();
    assertEquals("wait 3", execution.getNode().getName());
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _01_HumanTaskTest extends TestCase {

  public void testHumanTask() {
    ProcessDefinition processDefinition = ProcessFactory.build("task")
        .node("initial").initial().behaviour(new AutomaticActivity())
          .transition().to("shred evidence")
        .node("shred evidence").behaviour(new TaskActivity())
          .transition().to("next")
        .node("next").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();

    assertEquals("shred evidence", execution.getNode().getName());

    Task task = TaskService.getTaskList("johndoe").get(0);
    task.complete();
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _05_EventPropagationTest extends TestCase {

  public void testPropagationProcess(){
    ProcessDefinition processDefinition = ProcessFactory.build("propagate")
        .compositeNode("composite")
          .event(Node.EVENT_NODE_LEAVE)
            .listener(new DisplaySource())
          .node("a").initial().behaviour(new WaitState())
            .transition().to("b")
          .node("b").behaviour(new WaitState())
            .transition().to("c")
        .compositeEnd()
        .node("c").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.signal();
    execution.signal();
  }
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

    execution.signal();
    execution.signal();
  }

  public void testPropagationDisabledProcess(){
    ProcessDefinition processDefinition = ProcessFactory.build("propagate")
        .compositeNode("composite")
          .event(Node.EVENT_NODE_LEAVE)
            .listener(new DisplaySource())
            .propagationDisabled()
          .node("a").initial().behaviour(new WaitState())
            .transition().to("b")
          .node("b").behaviour(new WaitState())
            .transition().to("c")
        .compositeEnd()
        .node("c").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.signal();
    execution.signal();
  }
View Full Code Here

Examples of org.jbpm.pvm.ProcessDefinition

* @author Tom Baeyens
*/
public class _02_ExternalDecisionTest extends TestCase {

  public void testExternalTransitionDecision() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .node("initial").initial().behaviour(new WaitState())
          .transition().to("creditRate?")
        .node("creditRate?").behaviour(new ExternalSelection())
          .transition("good").to("a")
          .transition("average").to("b")
          .transition("bad").to("c")
        .node("a").behaviour(new WaitState())
        .node("b").behaviour(new WaitState())
        .node("c").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.signal();
    assertEquals("creditRate?", execution.getNode().getName());
    execution.signal("good");
    assertEquals("a", execution.getNode().getName());

    execution = processDefinition.startExecution();
    execution.signal();
    execution.signal("average");
    assertEquals("b", execution.getNode().getName());

    execution = processDefinition.startExecution();
    execution.signal();
    execution.signal("bad");
    assertEquals("c", execution.getNode().getName());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.