Package org.apache.agila.engine

Examples of org.apache.agila.engine.InstanceID


        super.tearDown();
    }

    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();
       
View Full Code Here


        assertFalse(token.isActive());
    }

    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);
View Full Code Here

    }

    public void testNextToken() {
       
        // retrieve a token from the service given the ff. instance and node id's
        InstanceID instanceId = new InstanceID(instanceCounter++);
       
        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();
           
View Full Code Here

    protected void tearDown() throws Exception {
        super.tearDown();
    }
   
    public void testSetInstanceID() {
      InstanceID id = new InstanceID(1);
      tokenImpl.setInstanceID(id);
      assertEquals(id,tokenImpl.getInstanceID());
    }
View Full Code Here

      assertEquals(child,connectionImpl.getChildNode());
    }
   
    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);
           
View Full Code Here

    private QueueServiceImpl qs;
    private Engine engine;
    private NotificationService notificationService;

    public void testSetTaskStatus() {
        InstanceID id = engine.startNewInstance( 1, new HashMap() );
       
        try {
            Thread.sleep( 1000 );
        } catch (InterruptedException e) {
            e.printStackTrace();
            fail( e.getMessage() );
        }

        List taskList = taskService.getTasksForUser( new UserID( 1 ), Task.TASK_ALL );

        assertNotNull( "There are no tasks to process", taskList );

        for( Iterator iterator = taskList.iterator(); iterator.hasNext(); ) {
            Task task = (Task)iterator.next();
            taskService.setTaskStatus( task.getTaskID(), Task.TASK_COMPLETE );
        }
       
        List taskListAfterUpdate = taskService.getTasksForUser( new UserID( 1 ), Task.TASK_COMPLETE );

        assertEquals( "Updating of task status should not create another task", taskList.size(), taskListAfterUpdate.size() );
       
        for( int i = 0; i < taskList.size(); i++ ) {
            TaskID taskID1 = ((Task)taskList.get( i )).getTaskID();
            TaskID taskID2 = ((Task)taskListAfterUpdate.get( i )).getTaskID();
           
            assertEquals( "Task ID should not change after update.", taskID1, taskID2 );
        }

        // lets find the tasks for a workflow instance
        InstanceID instanceID = new InstanceID(1);
        taskList = taskService.getTasksForInstance(instanceID, Task.TASK_ALL);
        assertNotNull("Should have found a list");

        taskList = taskService.getTasksForInstance(instanceID, Task.TASK_COMPLETE);
        assertNotNull("Should have found a list");
View Full Code Here

        params.put("foo", "foo value");
        params.put("bar", "bar value");
        params.put("baz", "baz value");

        // create a new instance using the service
        InstanceID instanceId = instanceService.newInstance(bpId, params);

        Instance instance = instanceService.getInstanceByID(instanceId);

        assertEquals("Instance id's are not equal", instanceId, instance.getInstanceID());
        assertNotNull("Application parameter map is null", instance.getInstanceVariables());
View Full Code Here

        params.put("foo", "foo value");
        params.put("bar", "bar value");
        params.put("baz", "baz value");

        // create a new instance using the service
        InstanceID instanceId = instanceService.newInstance(bpId, params);

        // start the newly created instance
        instanceService.start(instanceId);

        // wait until the message has been consumed in the queue
View Full Code Here

        params.put("foo", "foo value");
        params.put("bar", "bar value");
        params.put("baz", "baz value");

        // create a new instance using the service
        InstanceID instanceId = instanceService.newInstance(bpId, params);

        Instance instance = instanceService.getInstanceByID(instanceId);

        assertEquals("Instance id's are not equal", instanceId, instance.getInstanceID());
        assertNotNull("Application parameter map is null", instance.getInstanceVariables());
View Full Code Here

    private NotificationServiceImpl notifyService;
    private UserServiceImpl userService;
    private LogService logger;

    public void testCreateInstance() {
        InstanceID instanceID = createInstance();

        // Check that the required parameters are saved
        Instance instance = instanceService.getInstanceByID( instanceID );
        assertNotNull( instance );
View Full Code Here

TOP

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

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.