Package org.intalio.tempo.workflow.task

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


  Task getRandomSampleTask() throws Exception {
    String id = "id_" + (ID_COUNTER++);
    URI uri = new URI("http://hellonico.net");
    switch (type) {
    case NOTIFICATION:
      return new Notification(id, uri, xml.parseXML("<hello/>"));
    case PIPA:
      return new PIPATask(id, uri, uri, uri, "initOperationSOAPAction");
    case PA:
      return new PATask(id, new URI("http://hellonico.net"), "processId",
          "soap", xml.parseXML("<hello/>"));
    default:
      int rand = random.nextInt(3);
      switch (rand) {
      case 0:
        return new PATask(id, new URI("http://hellonico.net"),
            "processId", "soap", xml.parseXML("<hello/>"));
      case 1:
        return new PIPATask(id, uri, uri, uri,
            "initOperationSOAPAction");
      default:
        return new Notification(id, uri, xml.parseXML("<hello/>"));
      }
    }
  }
View Full Code Here


        return pa;
    }
   
    public void testCannotUpdateNotification() throws Exception {
        ITMSServer server = Utils.createTMSServerJPA();
        Notification notification = new Notification("taskID", new URI("http://localhost/1"), Utils.createXMLDocument());
        notification.getUserOwners().add("test/user1");
        notification.getRoleOwners().add("test/role3");
        ITaskDAOConnectionFactory daoFactory=new SimpleTaskDAOConnectionFactory();
        ITaskDAOConnection dao=daoFactory.openConnection();
        server.create(dao,notification, "token1");
        try {
            TaskMetadata metadata = TaskMetadata.Factory.newInstance()
View Full Code Here

        //Assert.assertEquals(date, pa2.getDeadline());
    }

    public void testNotificationLifecycle() throws Exception {
        ITMSServer server = Utils.createTMSServer();
        Notification notification = new Notification("taskID", new URI("http://localhost/1"), Utils.createXMLDocument());
        notification.getUserOwners().add("test/user1");
        notification.getRoleOwners().add("test/role3");
        ITaskDAOConnectionFactory daoFactory=new SimpleTaskDAOConnectionFactory();
        ITaskDAOConnection dao=daoFactory.openConnection();
        server.create(dao,notification, "token1");

        TaskEquality.areTasksEquals(notification, server.getTask(dao,"taskID", "token1"));
        TaskEquality.areTasksEquals(notification, server.getTask(dao,"taskID", "token2"));
        TaskEquality.areTasksEquals(notification, server.getTaskList(dao,"token1")[0]);
        TaskEquality.areTasksEquals(notification, server.getTaskList(dao,"token2")[0]);
        try {
            server.getTask(dao,"taskID", "token3");
            Assert.fail("AccessDeniedException expected");
        } catch (AccessDeniedException e) {

        }
        Assert.assertEquals(0, server.getTaskList(dao,"token3").length);

        server.complete(dao,"taskID", "token2");
        Notification completedTask = (Notification) server.getTask(dao,"taskID", "token1");
        Assert.assertEquals(TaskState.COMPLETED, completedTask.getState());

        String failureCode = "failure-code";
        String failureReason = "failure reason";
        server.fail(dao,"taskID", failureCode, failureReason, "token1");
        Notification failedTask = (Notification) server.getTask(dao,"taskID", "token2");
        Assert.assertEquals(TaskState.FAILED, failedTask.getState());
        Assert.assertEquals(failureCode, failedTask.getFailureCode());
        Assert.assertEquals(failureReason, failedTask.getFailureReason());

        try {
            server.delete(dao,new String[] { "taskID" }, "token1");
            Assert.fail("AuthException expected");
        } catch (UnavailableTaskException e) {
View Full Code Here

        _log.info("sleep again to wait for the notification");
        Thread.sleep(SLEEP_TIME);
        Task[] ts2 = tempoClient.getAvailableTasks("Notification", "ORDER BY T._creationDate DESC");
        String notificationId = ts2[0].getID();
        _log.info("We want to retrieve some more data on the notification with id:" + notificationId);
        Notification notification = (Notification) tempoClient.getTask(notificationId);

        _log.info("The notification has the following:" + "\nInput:" + xmlTooling.serializeXML(notification.getInput()) + "\nCreation Date:"
                        + notification.getCreationDate() + "\nAttached Form:" + notification.getFormURLAsString() + "\nDescription:"
                        + notification.getDescription());

        _log.info("Dismiss this notification");
        tempoClient.complete(notificationId);
    }
View Full Code Here

    /**
     * Test round trip marshaling of notification task
     */
    public void testNotificationMarshallingRoundtrip() throws Exception {
        Notification task1 = new Notification("taskID", new URI("http://localhost/URL"), TestUtils.createXMLDocument());
        testRoundTrip(task1);
    }
View Full Code Here

        this.testTaskMarshalling(task);
    }

    public void testNotificationMarshalling() throws Exception {
        Notification task = new Notification("id", new URI("http://localhost/form"), TestUtils.createXMLDocument());
        task.setPriority(2);
        task.authorizeActionForUser("dismiss", "test/user1");
        this.testTaskMarshalling(task);
    }
View Full Code Here

        this.testTaskMetadataMarshalling(task, null);
    }

    public void testNotificationMetaMarshalling() throws Exception {
        Notification task = new Notification("id", new URI("http://localhost/form"));

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

TOP

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

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.