Package org.jbpm.graph.def

Examples of org.jbpm.graph.def.Action


  public void testWriteNodeActionName() throws Exception {
    ProcessDefinition processDefinition = new ProcessDefinition();
    Node node = processDefinition.addNode( new Node() );
    Delegation instantiatableDelegate = new Delegation();
    instantiatableDelegate.setClassName("com.foo.Fighting");
    node.setAction(new Action(instantiatableDelegate));
   
    Element actionElement = AbstractXmlTestCase.toXmlAndParse( processDefinition, "/process-definition/node/action" );
    assertNotNull(actionElement);
    assertEquals("action", actionElement.getName());
    assertEquals("com.foo.Fighting", actionElement.attributeValue("class"));
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

      "      <action name='burps' class='org.foo.Burps'/>" +
      "    </event>" +
      "  </node>" +
      "</process-definition>"
    );
    Action burps = (Action)processDefinition.getNode("a").getEvent("node-enter").getActions().get(0);
    assertSame(burps, processDefinition.getAction("burps"));
    Element processDefinitionElement = toXmlAndParse( processDefinition, "/process-definition" );
    assertEquals(0, processDefinitionElement.elements("action").size());
  }
View Full Code Here

      "</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

    );
   
    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());
   
    Delegation instantiatableDelegate = processAction.getActionDelegation();
    assertEquals("com.itch.Scratch", instantiatableDelegate.getClassName());
  }
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

    // add a global action with name 'pina colada'
    Delegation instantiatableDelegate = new Delegation();
    instantiatableDelegate.setClassName("com.foo.Fighting");
    instantiatableDelegate.setConfigType("bean");
    instantiatableDelegate.setConfiguration("<id>4</id><greeting>aloha</greeting>");
    Action action = new Action();
    action.setName("pina colada");
    action.setActionDelegation(instantiatableDelegate);
    processDefinition.addAction(action);
   
    // now create a reference to it from event node-enter on state 'a'
    State state = (State) processDefinition.addNode( new State() );
    Action refAction = new Action();
    refAction.setReferencedAction(action);
    state.addEvent(new Event(Event.EVENTTYPE_NODE_ENTER)).addAction(refAction);
   
    AbstractXmlTestCase.toXmlAndParse( processDefinition, "/process-definition/state[1]/event[1]/action[1]" );
  }
View Full Code Here

import org.jbpm.graph.def.Action;

public class ActionLogDbTest extends AbstractDbTestCase {
 
  public void testActionLog() {
    Action action = new Action();
    session.save(action);
    ActionLog actionLog = new ActionLog(action);
   
    actionLog = (ActionLog) saveAndReload(actionLog);
    assertNotNull(actionLog.getAction());
View Full Code Here

TOP

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

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.