Package org.apache.agila.engine

Examples of org.apache.agila.engine.Token


        answer = dao.lockTaskForUser(taskID, new UserID(2));
        assertTrue("Managed to lock task", answer);
    }

    public void testNewToken() {
        Token token = dao.newToken(new InstanceID(1), new NodeID(1), Token.PRE);

        assertNotNull( "Token should not be null", token );
    }
View Full Code Here


        assertNotNull( "Token should not be null", token );
    }

    public void testGetTokenByID() {
        Token token = dao.newToken(new InstanceID(1), new NodeID(1), Token.PRE);

        Token retrievedToken = dao.getTokenByID(token.getTokenID());

        assertNotNull("Token should not be null", token);

        assertEquals( token.getInstanceID(), retrievedToken.getInstanceID() );
        assertEquals( token.getCurrentNodeID(), retrievedToken.getCurrentNodeID() );
        assertEquals( token.getCurrentState(), retrievedToken.getCurrentState() );
        assertEquals( token.isActive(), retrievedToken.isActive() );
        assertEquals( token.getTokenID(), retrievedToken.getTokenID() );
    }
View Full Code Here

    public void testSaveToken() {
        // retrieve a token from the service given the ff. instance and node id's
        InstanceID instanceId = new InstanceID(instanceCounter++);
        int nodeId = nodeCounter++;
       
        Token token = tokenService.newToken(instanceId, new NodeID(nodeId), Token.PRE);
        TokenID tokenId = token.getTokenID();
       
        // check the retrieved token like in testNewToken()
        assertNotNull(token);
        assertEquals(instanceId, token.getInstanceID());
        assertEquals(nodeId, token.getCurrentNodeID().getID());
        assertEquals(Token.PRE, token.getCurrentState());
        assertTrue(token.isActive());
       
        // set the token data to new values
        int newNodeId = nodeCounter++;
        token.setActive(false);
        token.setCurrentNodeID(new NodeID(newNodeId));
        token.setCurrentState(Token.MID);
       
        tokenService.saveToken(token);
       
        token = tokenService.getTokenByID(tokenId);
       
        // now check for the new values
        assertNotNull(token);
        assertEquals(instanceId, token.getInstanceID());
        assertEquals(newNodeId, token.getCurrentNodeID().getID());
        assertEquals(Token.MID, token.getCurrentState());
        assertFalse(token.isActive());
    }
View Full Code Here

    public void testNewToken() {
        // retrieve a token from the service given the ff. instance and node id's
        InstanceID instanceId = new InstanceID(instanceCounter++);
        int nodeId = nodeCounter++;
       
        Token token = tokenService.newToken(instanceId, new NodeID(nodeId), Token.PRE);
       
        assertNotNull(token);
        assertEquals(instanceId, token.getInstanceID());
        assertEquals(nodeId, token.getCurrentNodeID().getID());
        assertEquals(Token.PRE, token.getCurrentState());
    }
View Full Code Here

       
        Node parentNode = new FullBaseNode();
        parentNode.setDisplayName("parent_node");
        parentNode.setNodeId(new NodeID(nodeCounter++));
       
        Token parentToken = tokenService.newToken(instanceId, parentNode.getNodeId(), Token.PRE);
        TokenID tokenId = parentToken.getTokenID();
       
        // create n child nodes
        Node[] childrenNode = new Node[5];
        for(int i = 0; i < childrenNode.length; i++) {
            Node childNode = new FullBaseNode();
            childNode.setDisplayName("child_node_"+ i);
            childNode.setNodeId(new NodeID(nodeCounter++));

            childrenNode[i] = childNode;
        }
       
        // create childrenNode.length connections
        Connection[] connections = new Connection[childrenNode.length];
        for(int i = 0; i < connections.length; i++) {
            Connection connection = new ConnectionImpl("connection_"+ i);           
           
            connection.setParentNode(parentNode);
            connection.setChildNode(childrenNode[i]);
           
            parentNode.addOutboundConnection(connection);
            childrenNode[i].addInboundConnection(connection);
           
            connections[i] = connection;
        }
       
        // tokens are created in the order of connections -- this test will be using that fact.
        // question: would it be proper to do so? Is that a property of the engine?
        Token[] tokens = tokenService.nextToken(connections, parentToken);
       
        for(int i = 0; i < tokens.length; i++) {
            Token token = tokens[i];
           
            InstanceID instance_id = token.getInstanceID();
            NodeID currentNodeId = token.getCurrentNodeID();
            int currentState = token.getCurrentState();
            Node currentNode = childrenNode[i];
            Connection[] inbound = currentNode.getInboundConnections();
           
            assertNotNull(instance_id);
            assertEquals(instanceId, instance_id);
View Full Code Here

    }
   
    public void testTraverse(){
      TokenService tokenService = new TokenServiceImpl();
      InstanceID instanceId = new InstanceID(1);
      Token token = tokenService.newToken(instanceId, new NodeID(2), Token.PRE);
     
      Node child = createNode(50);
      connectionImpl.setChildNode(child);
           
      connectionImpl.traverse(token);
      assertEquals(50,token.getCurrentNodeID().getID());
    }
View Full Code Here

        }

        assertEquals("Type must be 'move token'", EngineMessage.TYPE_MOVE_TOKEN, engineMessage.getMessageType());

        TokenID tokenId = engineMessage.getCurrentTokenID();
        Token token = tokenService.getTokenByID(tokenId);
        assertEquals(1, token.getCurrentNodeID().getID());
        assertTrue(token.isActive());
        assertEquals(Token.PRE, token.getCurrentState());
        assertNotNull(bpService.getGraphByID(instanceService.getInstanceByID(token.getInstanceID()).getBusinessProcessID()));
        assertSame(bProcess.getRoot(),
                bpService.getGraphByID(instanceService.getInstanceByID(token.getInstanceID()).getBusinessProcessID()).getRoot());
    }
View Full Code Here

        }

        // Instance variables should now reflect the new assigned values
        tasks = taskService.getTasksForUser( new UserID( 1 ), Task.TASK_INCOMPLETE );
        task = (Task)tasks.get( 0 );
        Token token = tokenService.getTokenByID( task.getSourceTokenID() );

        Instance instance = instanceService.getInstanceByID( token.getInstanceID() );

        assertEquals( "40", instance.getInstanceVariables().get( "numdays" ) );
    }
View Full Code Here

        for(int i = 0; i < connSet.length; i++) {

            Connection conn = connSet[i];

            Token newToken = dao.newToken( parentToken.getInstanceID(), conn.getChildNode().getNodeId(), Token.PRE );

            conn.traverse(newToken);
            newSet[i] = newToken;
        }
View Full Code Here

        return retVal;
    }
*/

    public Token newToken( InstanceID instanceID, NodeID nodeID, int state ) {
        Token retVal = null;

        Connection connection = null;

        try {
            String sql = "insert into bpm_token ( tokenid, instanceid," +
View Full Code Here

TOP

Related Classes of org.apache.agila.engine.Token

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.