Package org.jbpm.graph.def

Examples of org.jbpm.graph.def.Event


      "  </task-node>" +
      "</process-definition>"
    );
    TaskNode taskNode = (TaskNode) processDefinition.getNode("a");
    Task task = taskNode.getTask("clean ceiling");
    Event event = task.getEvent(Event.EVENTTYPE_TASK_CREATE);
    assertNotNull(event);
    CreateTimerAction createTimerAction = (CreateTimerAction) event.getActions().get(0);
    assertNotNull(createTimerAction);
    assertEquals("2 business minutes", createTimerAction.getDueDate());

    // test default cancel event
    event = task.getEvent(Event.EVENTTYPE_TASK_END);
    assertNotNull(event);
    CancelTimerAction cancelTimerAction = (CancelTimerAction) event.getActions().get(0);
    assertNotNull(cancelTimerAction);
  }
View Full Code Here


      "  </task-node>" +
      "</process-definition>"
    );
    TaskNode taskNode = (TaskNode) processDefinition.getNode("a");
    Task task = taskNode.getTask("clean ceiling");
    Event event = task.getEvent(Event.EVENTTYPE_TASK_CREATE);
    assertNotNull(event);
    assertSame(CreateTimerAction.class, event.getActions().get(0).getClass());

    event = task.getEvent(Event.EVENTTYPE_TASK_START);
    assertNotNull(event);
    assertSame(CancelTimerAction.class, event.getActions().get(0).getClass());

    event = task.getEvent(Event.EVENTTYPE_TASK_ASSIGN);
    assertNotNull(event);
    assertSame(CancelTimerAction.class, event.getActions().get(0).getClass());

    event = task.getEvent(Event.EVENTTYPE_TASK_END);
    assertNotNull(event);
    assertSame(CancelTimerAction.class, event.getActions().get(0).getClass());
  }
View Full Code Here

      "    <action class='two'/>" +
      "    <action class='three'/>" +
      "  </event>" +
      "</process-definition>"
    );
    Event event = processDefinition.getEvent("node-enter");
    assertEquals(3, event.getActions().size());
    assertEquals("one", ((Action)event.getActions().get(0)).getActionDelegation().getClassName());
    assertEquals("two", ((Action)event.getActions().get(1)).getActionDelegation().getClassName());
    assertEquals("three", ((Action)event.getActions().get(2)).getActionDelegation().getClassName());
  }
View Full Code Here

    assertEquals("three", ((Action)event.getActions().get(2)).getActionDelegation().getClassName());
  }

  public void testWriteProcessDefinitionAction() throws Exception {
    ProcessDefinition processDefinition = new ProcessDefinition();
    Event event = new Event("node-enter");
    processDefinition.addEvent(event);
    event.addAction(new Action(new Delegation("one")));
    event.addAction(new Action(new Delegation("two")));
    event.addAction(new Action(new Delegation("three")));
   
    Element eventElement = toXmlAndParse( processDefinition, "/process-definition/event" );
   
    List actionElements = eventElement.elements("action");
View Full Code Here

  public void testWriteNodeEnterAction() throws Exception {
    ProcessDefinition processDefinition = new ProcessDefinition();
    Node node = processDefinition.addNode( new Node() );
    Delegation instantiatableDelegate = new Delegation();
    instantiatableDelegate.setClassName("com.foo.Fighting");
    node.addEvent(new Event("node-enter")).addAction(new Action(instantiatableDelegate));
    Element element = AbstractXmlTestCase.toXmlAndParse( processDefinition, "/process-definition/node[1]/event[1]" );
   
    assertNotNull(element);
    assertEquals("event", element.getName());
    assertEquals("node-enter", element.attributeValue("type"));
View Full Code Here

      "  </state>" +
      "</process-definition>"
    );
   
    Node node = processDefinition.getNode("a");
    Event event = node.getEvent("node-enter");
    Action action = (Action) event.getActions().iterator().next();
    Delegation instantiatableDelegate = action.getActionDelegation();
    assertEquals("org.foo.Burps", instantiatableDelegate.getClassName());
    assertEquals("constructor-text", instantiatableDelegate.getConfigType());
    assertTrue(instantiatableDelegate.getConfiguration().indexOf("this text should be passed in the constructor")!=-1 );
  }
View Full Code Here

    );
   
    Node node = processDefinition.getNode("a");
    assertEquals( 1, node.getLeavingTransitionsMap().size() );
    Transition transition = node.getDefaultLeavingTransition();
    Event event = transition.getEvent(Event.EVENTTYPE_TRANSITION);
    Action action = (Action) event.getActions().iterator().next();
    Delegation instantiatableDelegate = action.getActionDelegation();
    assertEquals("org.foo.Burps", instantiatableDelegate.getClassName());
  }
View Full Code Here

      "</process-definition>"
    );
   
    Node node = processDefinition.getNode("a");
    Transition transition = node.getDefaultLeavingTransition();
    Event event = transition.getEvent(Event.EVENTTYPE_TRANSITION);
    Action transitionAction = (Action) event.getActions().iterator().next();
   
    Action processAction = processDefinition.getAction("scratch");
    assertEquals("scratch", processAction.getName());
    assertSame(processAction, transitionAction.getReferencedAction());
   
View Full Code Here

    );
    Transition transition = processDefinition.getNode("a").getDefaultLeavingTransition();
   
    Delegation instantiatableDelegate = new Delegation();
    instantiatableDelegate.setClassName("com.foo.Fighting");
    transition.addEvent(new Event(Event.EVENTTYPE_TRANSITION)).addAction(new Action(instantiatableDelegate));
    Element element = AbstractXmlTestCase.toXmlAndParse( processDefinition, "/process-definition/state/transition" );

    assertNotNull(element);
    assertEquals("transition", element.getName());
    assertEquals(1, element.elements("action").size());
View Full Code Here

    State state = (State) processDefinition.addNode( new State("a") );
    Delegation instantiatableDelegate = new Delegation();
    instantiatableDelegate.setClassName("com.foo.Fighting");
    instantiatableDelegate.setConfigType("bean");
    instantiatableDelegate.setConfiguration("<id>4</id><greeting>aloha</greeting>");
    state.addEvent(new Event("node-enter")).addAction(new Action(instantiatableDelegate));
    Element element = AbstractXmlTestCase.toXmlAndParse( processDefinition, "/process-definition/state[1]/event[1]/action[1]" );

    assertNotNull(element);
    assertEquals("action", element.getName());
    assertEquals("bean", element.attributeValue("config-type"));
View Full Code Here

TOP

Related Classes of org.jbpm.graph.def.Event

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.