Package org.intalio.tempo.workflow.task

Examples of org.intalio.tempo.workflow.task.PATask


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


    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

        // as
        // null
    }

    private void checkTaskDates(Object[] date1) throws Exception {
        PATask task = (PATask) new TaskUnmarshaller().unmarshalFullTask(TestUtils.loadElementFromResource((String) date1[0]));
        checkYear(task.getCreationDate(), (Integer) date1[1]);
        checkYear(task.getDeadline(), (Integer) date1[2]);
    }
View Full Code Here

    /**
     * Test round trip marhsalling of PA task
     */
    public void testFullPAMarshallingRoundtrip() throws Exception {
        PATask task1 = new PATask("taskID", new URI("http://localhost/URL"), "processID", "urn:completeSOAPAction",
                TestUtils.createXMLDocument());
        task1.setPriority(new Integer(3));
        task1.authorizeActionForRole("save", "intalio\\engineer");
        task1.authorizeActionForUser("save", "david");
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MONTH, 1);
        task1.setDeadline(c.getTime());
        task1.setCreationDate(new Date());
        task1.setPreviousTaskID("123");
        task1.setChainedBefore(true);
        task1.setCompleteSOAPAction("http://");
        task1.setState(TaskState.FAILED);
        task1.setFailureCode("123");
        task1.setFailureReason("Who knows");
        task1.setOutput(TestUtils.createXMLDocument());
    }
View Full Code Here

    /**
     * Test PA round trip marshalling with input field set
     */
    public void testPAWithInput() throws Exception {
        Document doc = new XmlTooling().getXmlDocument("/inputWithNamespace.xml");
        PATask task = new PATask("taskID", new URI("http://localhost/URL"), "processID", "urn:completeSOAPAction", doc);
        task.setOutput(doc);
        PATask task2 = (PATask) testRoundTrip(task);
        TaskEquality.areDocumentsEqual(doc, task2.getInput());
        TaskEquality.areTasksEquals(task, task2);
    }
View Full Code Here

        this.testTaskMarshalling(task);
    }

    public void testPATaskMarshalling() throws Exception {
        PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
        task.getUserOwners().add("test/user1");
        task.getRoleOwners().add("test.role1");
        task.getRoleOwners().add("test\\role2");
        task.setOutput(TestUtils.createXMLDocument());
     
        task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
        AttachmentMetadata metadata = new AttachmentMetadata();
        metadata.setMimeType("image/jpeg");
        task.addAttachment(new Attachment(metadata, new URL("http://localhost/url2")));

        this.testTaskMarshalling(task);
    }
View Full Code Here

        task.getRoleOwners().add("test\\role2");
        this.testTaskMetadataMarshalling(task, null);
    }

    public void testPATaskMetaMarshalling() throws Exception {
        PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
        task.getUserOwners().add("test/user1");
        task.getRoleOwners().add("test.role1");
        task.getRoleOwners().add("test\\role2");
        task.setOutput(TestUtils.createXMLDocument());

        task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
        AttachmentMetadata metadata = new AttachmentMetadata();
        metadata.setMimeType("image/jpeg");
        task.addAttachment(new Attachment(metadata, new URL("http://localhost/url2")));

        this.testTaskMetadataMarshalling(task, null);
    }
View Full Code Here

        this.testTaskMetadataMarshalling(task, null);
    }

    public void testPATaskChainedBefore() throws Exception {
        PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
        task.getUserOwners().add("test/user1");
        task.getRoleOwners().add("test.role1");

        task.setDescription("Testing task");
        task.setState(TaskState.READY);
        task.setPreviousTaskID("p1");
        task.setChainedBefore(true);

        this.testTaskMarshalling(task);
    }
View Full Code Here

        this.testTaskMarshalling(task);
    }

    public void testPATaskMarshallingWithOtherProperty() throws Exception {
        PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
        task.getUserOwners().add("test/user1");
        task.getRoleOwners().add("test.role1");
        task.getRoleOwners().add("test\\role2");
        task.setOutput(TestUtils.createXMLDocument());

        task.setState(TaskState.FAILED);
        task.setFailureCode("FATAL");
        task.setFailureReason("Don't really know");
        task.setDeadline(new Date());
        task.setPriority(1);
        task.setProcessID("processID1");
        task.authorizeActionForUser("claim", "test/user1");
        task.authorizeActionForRole("revoke", "test/role1");

        task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
        AttachmentMetadata metadata = new AttachmentMetadata();
        metadata.setMimeType("image/jpeg");
        task.addAttachment(new Attachment(metadata, new URL("http://localhost/url2")));

        this.testTaskMarshalling(task);
   
View Full Code Here

    public void update(ITaskDAOConnection dao,TaskMetadata task, String participantToken) throws AuthException, TMSException, AxisFault {
        try {
            String id = task.getTaskId();
            Task previous = dao.fetchTaskIfExists(id);
            if (previous != null && (previous instanceof PATask)) {
                PATask paPrevious = (PATask) previous;

                // security ?
                UserRoles credentials = _authProvider.authenticate(participantToken);
                // checkIsAvailable(id, previous, credentials);

                try {
                    paPrevious.setPriority(task.getPriority());
                } catch (Exception e) {
                    _logger.debug("Ignoring invalid priority value:" + task.xgetPriority().toString());
                }
                String desc = task.getDescription();
                if (!StringUtils.isEmpty(desc))
                    paPrevious.setDescription(desc);

                dao.updateTask(previous);
                dao.commit();
                if (_logger.isDebugEnabled())
                    _logger.debug("Workflow Task " + task + " was updated");
View Full Code Here

TOP

Related Classes of org.intalio.tempo.workflow.task.PATask

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.