Examples of ITaskManagementService


Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

    private String nextRandom() {
        return String.valueOf(((Integer) SECURE_RANDOM.nextInt(100000000)));
    }

    public void testAttachments() throws Exception {
        ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();

        String task1ID = nextRandom();
        PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
        task1.getUserOwners().add("test.system-test");
        task1.getUserOwners().add("intalio\\admin");
        Attachment attachment1 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a1"));
        task1.addAttachment(attachment1);
        Attachment attachment2 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a2"));
        task1.addAttachment(attachment2);
        tms.create(task1);

        PATask task2 = (PATask) tms.getTask(task1.getID());
        Assert.assertEquals(2, task2.getAttachments().size());

        tms.removeAttachment(task1.getID(), attachment1.getPayloadURL());

        PATask task3 = (PATask) tms.getTask(task1.getID());
        Assert.assertEquals(1, task3.getAttachments().size());
        Assert.assertEquals(attachment2.getPayloadURL(), task3.getAttachments().iterator().next().getPayloadURL());

        Attachment[] attachments = tms.getAttachments(task1.getID());
        Assert.assertEquals(1, attachments.length);
        Assert.assertEquals(attachment2.getPayloadURL(), attachments[0].getPayloadURL());

        tms.removeAttachment(task1.getID(), attachment2.getPayloadURL());
        tms.addAttachment(task1.getID(), attachment1);

        PATask task4 = (PATask) tms.getTask(task1.getID());
        Assert.assertEquals(1, task4.getAttachments().size());
        Assert.assertEquals(attachment1.getPayloadURL(), task4.getAttachments().iterator().next().getPayloadURL());
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

        task1.setInitOperationSOAPAction("initProcess" + rand.nextInt());

        String[] unnormalizedRoles = { "jkl/jkl", "mno\\mno", "pqr.pqr" };
        task1.setRoleOwners(unnormalizedRoles);

        ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();
        tms.storePipa(task1);
        PIPATask task2 = tms.getPipa(task1.getProcessEndpoint().toString());
        TaskEquality.areTasksEquals(task1, task2);
        _logger.debug(task2.getRoleOwners().toString());
        tms.deletePipa(task1.getProcessEndpoint().toString());
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

        _logger.debug(task2.getRoleOwners().toString());
        tms.deletePipa(task1.getProcessEndpoint().toString());
    }
   
    public void testUpdate2() throws Exception {
      ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();
      Task[] tasks = tms.getAvailableTasks(TaskType.ACTIVITY.name(), "");
      Random rand = new Random();
      ((PATask)tasks[0]).setPriority(rand.nextInt(10));
      tms.update(tasks[0]);
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

      ((PATask)tasks[0]).setPriority(rand.nextInt(10));
      tms.update(tasks[0]);
    }
   
    public void testMultipleReassign() throws Exception {
      ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();
     
     
      Task[] tasks = tms.getAvailableTasks(TaskType.ACTIVITY.name(), "");
      TaskState newState = TaskState.READY;
      if(((PATask)tasks[0]).getState().equals(TaskState.READY))
        newState = TaskState.CLAIMED;
     
      String[] ids = new String[tasks.length];
      for(int i = 0 ; i <tasks.length ; i++ids[i] = tasks[i].getID();
      AuthIdentifierSet users = new AuthIdentifierSet();
      users.add("intalio\\admin");
      AuthIdentifierSet roles = new  AuthIdentifierSet();
      tms.reassign(ids, users, roles, newState);
     
      tasks = tms.getAvailableTasks(TaskType.ACTIVITY.name(), "");
      Assert.assertEquals(newState, ((PATask)tasks[0]).getState());
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

        junit.textui.TestRunner.run(RemoteTMSClientTest.class);
    }


    public void testInput() throws Exception {
        ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();
        Document input1 = Utils.createXMLDocument("/absr.xml");
        String task1ID = nextRandom();
        PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", input1);
        task1.getUserOwners().add("intalio\\admin");
        tms.create(task1);
        testRoundTrip(task1, input1);

        PATask task2 = (PATask) tms.getTask(task1ID);
        TaskEquality.areTasksEquals(task1, task2);
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

        PATask task2 = (PATask) tms.getTask(task1ID);
        TaskEquality.areTasksEquals(task1, task2);
    }

    public void testUpdate() throws Exception {
        ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();
        Document input1 = Utils.createXMLDocument("/absr.xml");
        String id = "583c10bfdbd326ba:69a8b3cd:124dd681279:-7ef6127.0.1.1163844" + System.currentTimeMillis();
        PATask task1 = new PATask(id, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", input1);
        String description = "new two:" + System.currentTimeMillis();
        task1.getUserOwners().add("intalio\\admin");
        tms.create(task1);

        task1.setDescription(description);
        tms.update(task1);

        Task updated = tms.getTask(id);
        Assert.assertEquals(description, updated.getDescription());

        task1.setDescription("new one");
        tms.update(task1);
        Task updated2 = tms.getTask(id);
        Assert.assertNotSame(description, updated2.getDescription());

        tms.delete(new String[] { id });
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

    }

    public void testPIPAInit() throws Exception {
        String pipaId = "d1f20ad2-bba4-45aa-b449-d2f147c84561";
        Document outputForInit = Utils.createXMLDocument("/japaneseOutputForPipa.xml");
        ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();
        Task[] tasks = tms.getTaskList();
        for (Task t : tasks) {
            if (t instanceof PIPATask) {
                pipaId = t.getID();
                break;
            }
        }
        tms.init(pipaId, outputForInit);
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

        }
        tms.init(pipaId, outputForInit);
    }

    public void testBasicPATaskLifecycle() throws Exception {
        ITaskManagementService tms = new RemoteTMSFactory(TMS_REMOTE_URL, TOKEN).getService();
        Task[] tasks = tms.getTaskList();
        Assert.assertNotNull(tasks);

        String task1ID = nextRandom();
        PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
        task1.getUserOwners().add("intalio\\admin");
        tms.create(task1);

        PATask task2 = (PATask) tms.getTask(task1ID);
        TaskEquality.areTasksEquals(task1, task2);

        String task3ID = nextRandom();
        PATask task3 = new PATask(task3ID, new URI("http://localhost/3"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
        task3.getUserOwners().add("intalio.admin");
        task3.getUserOwners().add("intalio\\admin");
        tms.create(task3);

        Document output1 = Utils.createXMLDocument();
        output1.getDocumentElement().appendChild(output1.createTextNode("Hi world"));
        tms.setOutput(task3ID, output1);

        PATask task4 = (PATask) tms.getTask(task3ID);
        Assert.assertTrue(TaskEquality.areDocumentsEqual(output1, task4.getOutput()));
        Assert.assertEquals(TaskState.READY, task4.getState());

        Document output2 = Utils.createXMLDocument();
        tms.setOutputAndComplete(task3ID, output2);

        PATask task5 = (PATask) tms.getTask(task4.getID());
        Assert.assertTrue(TaskEquality.areDocumentsEqual(output2, task5.getOutput()));
        Assert.assertEquals(TaskState.COMPLETED, task5.getState());

        String task6ID = nextRandom();
        PATask task6 = new PATask(task6ID, new URI("http://localhost/6"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
        task6.getUserOwners().add("intalio\\admin");
        tms.create(task6);
        tms.complete(task6ID);

        PATask task7 = (PATask) tms.getTask(task6ID);
        Assert.assertEquals(TaskState.COMPLETED, task7.getState());

        tms.fail(task7.getID(), "code", "reason");

        PATask task8 = (PATask) tms.getTask(task7.getID());
        Assert.assertEquals(task8.getProcessID(), task7.getProcessID());
        Assert.assertEquals(TaskState.FAILED, task8.getState());
        Assert.assertEquals("code", task8.getFailureCode());
        Assert.assertEquals("reason", task8.getFailureReason());

        String task8ID = task8.getID();

        // TODO: add system user for testing that can delete tasks
        tms.delete(new String[] { task3ID, task8ID });
        Task[] tasks2 = tms.getTaskList();
        for (Task task : tasks2) {
            if (task.getID().equals(task3ID) || task.getID().equals(task8ID)) {
                Assert.fail();
            }
        }
View Full Code Here

Examples of org.intalio.tempo.workflow.tms.ITaskManagementService

        initSecurityProvider();
        initRBACProvider();
    }

    public void testReassginTaskLifecycle() throws Exception {
        ITaskManagementService tms = new RemoteTMSFactory(
                "http://localhost:8080/axis2/services/TaskManagementServices", TOKEN_CURRENT).getService();

        /*
         * Get available users
         */
        _logger.debug("Get the users from role: " + ROLE_TARGET2);
        RBACQuery query = rbacProvider.getQuery();
        String[] users = query.assignedUsers(ROLE_TARGET2);
        _logger.debug("Get the users: " + Arrays.asList(users));

        /*
         * Create a new task for current user
         */
        PATask task1 = new PATask(String.valueOf(new Random().nextInt(10000)), new URI("http://localhost/1"),
                "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
        task1.getUserOwners().add(USER_CURRENT);
        tms.create(task1);

        /*
         * Get task list of current user
         */
        _logger.debug("Get the task list from token: " + TOKEN_CURRENT);
        Task[] tasks = tms.getTaskList();

        /*
         * Select one task to re-assign
         */
        PATask selectTask = null;
        for (Task task : tasks) {
            _logger.debug(task.getClass().getName());
            if (task instanceof PATask) {
                selectTask = (PATask) task;
                break;
            }
        }
        if (selectTask == null) {
            throw new Exception("There is no PATask in the current user[examples\\msmith] task list");
        }
        String selectTaskId = selectTask.getID();
        _logger.debug("Select one task: " + selectTaskId);

        /*
         * Select a user to be re-assigned.
         */
        AuthIdentifierSet targetUserSet = new AuthIdentifierSet();
        String targetUserId = users[0];
        _logger.debug("Select one target user = " + targetUserId);
        targetUserSet.add(targetUserId);

        /*
         * Re-assign task
         */
        Collection<String> uOwners = selectTask.getUserOwners();
        uOwners.clear();
        selectTask.getRoleOwners().clear();
        selectTask.getUserOwners().addAll(targetUserSet);

        tms.reassign(new String[] {selectTask.getID()}, (AuthIdentifierSet)selectTask.getUserOwners(), (AuthIdentifierSet) selectTask.getRoleOwners(), selectTask.getState());
        _logger.debug("Reassign task[" + selectTaskId + "] to " + targetUserId);

        /*
         * check that the task is not in the inbox of current user
         */
        boolean task_nowuser_inbox = false;
        Task[] tasks2 = tms.getTaskList();
        for (int i = 0; i < tasks2.length; i++) {
            if (selectTaskId.equalsIgnoreCase(tasks2[i].getID())) {
                task_nowuser_inbox = true;
            }
        }
        if (!task_nowuser_inbox) {
            _logger.debug("The task " + selectTaskId + " is not in the current user[" + USER_CURRENT + "]");
        }
        Assert.assertEquals(false, task_nowuser_inbox);

        /*
         * check that the task is not in the inbox of target user
         */
        ITaskManagementService tms_target = new RemoteTMSFactory(
                "http://localhost:8080/axis2/services/TaskManagementServices", TOKEN_TARGET2).getService();
        boolean task_targetuser_inbox = false;
        Task[] tasks3 = tms_target.getTaskList();
        for (int i = 0; i < tasks3.length; i++) {
            if (selectTaskId.equalsIgnoreCase(tasks3[i].getID())) {
                task_targetuser_inbox = true;
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.