Ejemplo n.º 1
0
  /** Test consuming tokens after join. */
  @Test
  public void testConsumingTokensAfterJoin() {
    instance.createToken(node3);
    token.setCurrentNode(node2);
    node2.getIncomingBehaviour().join(token);

    assertTrue(
        instance.getAssignedTokens().size() == 1, "There should be now just one token left.");
    assertTrue(
        util.getTokensWhichAreOnNode(node3, instance).size() == 0,
        "Start nodes should be token free.");
    assertTrue(
        util.getTokensWhichAreOnNode(node, instance).size() == 0,
        "Start nodes should be token free.");
  }
Ejemplo n.º 2
0
  /** Set up. An instance is build. */
  @BeforeMethod
  public void setUp() {

    // Place
    node = new NodeImpl(new NullActivity(), null, new PlaceSplitBehaviour());
    node.setAttribute("name", "1");

    // Transition, we start right here (just for testing purposes)
    node2 =
        new NodeImpl(
            new NullActivity(), new TransitionJoinBehaviour(), new TransitionSplitBehaviour());
    node2.setAttribute("name", "2");

    // Place
    node3 = new NodeImpl(new NullActivity(), null, new PlaceSplitBehaviour());
    node3.setAttribute("name", "3");

    // Place
    node4 = new NodeImpl(new NullActivity(), null, new PlaceSplitBehaviour());
    node4.setAttribute("name", "4");

    node.controlFlowTo(node2);
    node3.controlFlowTo(node2);
    node2.controlFlowTo(node4);

    util = new TokenUtil();
    TokenBuilder tokenBuilder = new PetriNetTokenBuilder(Mockito.mock(Navigator.class), null);
    instance = new ProcessInstance(null, tokenBuilder);
    token = instance.createToken(node);
  }
Ejemplo n.º 3
0
 /** Test true join ability. */
 @Test
 public void testTrueJoinAbility() {
   instance.createToken(node3);
   assertTrue(
       node2.getIncomingBehaviour().joinable(token, node2),
       "It should return true," + " because the missing token is there.");
 }
Ejemplo n.º 4
0
  /** Tests the join. */
  @Test
  public void testJoin() {
    instance.createToken(node3);
    token.setCurrentNode(node2);

    Collection<Token> newTokens = null;
    newTokens = node2.getIncomingBehaviour().join(token);

    assertTrue(newTokens.size() == 1, "One token was moved, so the size should be 1.");
  }