Package org.drools.task.service.responsehandlers

Examples of org.drools.task.service.responsehandlers.BlockingTaskOperationResponseHandler


    assertEquals(10, task.getPriority());
    assertEquals("Comment", task.getDescription());
    assertEquals(Status.Ready, task.getStatus());
   
    System.out.println("Claiming task " + task.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.claim(task.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Claimed task " + task.getId());
   
    System.out.println("Starting task " + task.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(task.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started task " + task.getId());
   
    System.out.println("Completing task " + task.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.complete(task.getId(), "Darth Vader", null, operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Completed task " + task.getId());
   
    assertTrue(manager.isCompleted());
  }
View Full Code Here


    assertEquals(10, taskSummary.getPriority());
    assertEquals("Comment", taskSummary.getDescription());
    assertEquals(Status.Ready, taskSummary.getStatus());

    System.out.println("Claiming task " + taskSummary.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.claim(taskSummary.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Claimed task " + taskSummary.getId());

        //Check if the parent task is InProgress
        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( taskSummary.getId(), getTaskResponseHandler );
View Full Code Here

    assertEquals("Comment", task.getDescription());
    assertEquals(Status.Reserved, task.getStatus());
    assertEquals("Darth Vader", task.getActualOwner().getId());
   
    System.out.println("Starting task " + task.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(task.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started task " + task.getId());
   
    System.out.println("Failing task " + task.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.fail(task.getId(), "Darth Vader", null, operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Failed task " + task.getId());
   
    assertTrue(manager.isAborted());
  }
View Full Code Here

    assertEquals("Comment", task.getDescription());
    assertEquals(Status.Reserved, task.getStatus());
    assertEquals("Darth Vader", task.getActualOwner().getId());
   
    System.out.println("Skipping task " + task.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.skip(task.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Skipped task " + task.getId());
   
    assertTrue(manager.isAborted());
  }
View Full Code Here

    Object data = in.readObject();
    in.close();
    assertEquals("This is the content", data);
   
    System.out.println("Starting task " + task.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(task.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started task " + task.getId());
   
    System.out.println("Completing task " + task.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    ContentData result = new ContentData();
    result.setAccessType(AccessType.Inline);
    result.setType("java.lang.String");
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bos);
    out.writeObject("This is the result");
    out.close();
    result.setContent(bos.toByteArray());
    client.complete(task.getId(), "Darth Vader", result, operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Completed task " + task.getId());
   
    assertTrue(manager.isCompleted());
    Map<String, Object> results = manager.getResults();
    assertNotNull(results);
View Full Code Here

        Thread.sleep(500);

        //Start the parent task
        System.out.println("Starting task " + task.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(task.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started task " + task.getId());

        //Check if the parent task is InProgress
        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( task.getId(), getTaskResponseHandler );
        Task parentTask = getTaskResponseHandler.getTask();
        assertEqualsStatus.InProgress, parentTask.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), parentTask.getTaskData().getActualOwner() );

        //Get all the subtask created for the parent task based on the potential owner
        responseHandler = new BlockingTaskSummaryResponseHandler();
        client.getSubTasksAssignedAsPotentialOwner(parentTask.getId(),"Darth Vader", "en-UK", responseHandler);
        List<TaskSummary> subTasks = responseHandler.getResults();
        assertEquals(2, subTasks.size());
        TaskSummary subTaskSummary1 = subTasks.get(0);
        TaskSummary subTaskSummary2 = subTasks.get(1);
        assertNotNull(subTaskSummary1);
        assertNotNull(subTaskSummary2);

        //Starting the sub task 1
        System.out.println("Starting sub task " + subTaskSummary1.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(subTaskSummary1.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started sub task " + subTaskSummary1.getId());

        //Starting the sub task 2
        System.out.println("Starting sub task " + subTaskSummary2.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(subTaskSummary2.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started sub task " + subTaskSummary2.getId());



        //Check if the child task 1 is InProgress
        getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( subTaskSummary1.getId(), getTaskResponseHandler );
        Task subTask1 = getTaskResponseHandler.getTask();
        assertEqualsStatus.InProgress, subTask1.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), subTask1.getTaskData().getActualOwner() );


         //Check if the child task 2 is InProgress
        getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( subTaskSummary2.getId(), getTaskResponseHandler );
        Task subTask2 = getTaskResponseHandler.getTask();
        assertEqualsStatus.InProgress, subTask2.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), subTask2.getTaskData().getActualOwner() );

        // Complete the child task 1
        System.out.println("Completing sub task " + subTask1.getId());
        operationResponseHandler = new BlockingTaskOperationResponseHandler();
        client.complete( subTask1.getId(),"Darth Vader" , null, operationResponseHandler );
        operationResponseHandler.waitTillDone( 5000 );
        System.out.println("Completed sub task " + subTask1.getId());

         // Complete the child task 2
        System.out.println("Completing sub task " + subTask2.getId());
        operationResponseHandler = new BlockingTaskOperationResponseHandler();
        client.complete( subTask2.getId(),"Darth Vader" , null, operationResponseHandler );
        operationResponseHandler.waitTillDone( 5000 );
        System.out.println("Completed sub task " + subTask2.getId());



         //Check if the child task 1 is Completed
View Full Code Here

        Thread.sleep(500);

        //Start the parent task
        System.out.println("Starting task " + task.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(task.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started task " + task.getId());

        //Check if the parent task is InProgress
        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( task.getId(), getTaskResponseHandler );
        Task parentTask = getTaskResponseHandler.getTask();
        assertEqualsStatus.InProgress, parentTask.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), parentTask.getTaskData().getActualOwner() );

        //Get all the subtask created for the parent task based on the potential owner
        responseHandler = new BlockingTaskSummaryResponseHandler();
        client.getSubTasksAssignedAsPotentialOwner(parentTask.getId(),"Darth Vader", "en-UK", responseHandler);
        List<TaskSummary> subTasks = responseHandler.getResults();
        assertEquals(2, subTasks.size());
        TaskSummary subTaskSummary1 = subTasks.get(0);
        TaskSummary subTaskSummary2 = subTasks.get(1);
        assertNotNull(subTaskSummary1);
        assertNotNull(subTaskSummary2);

        //Starting the sub task 1
        System.out.println("Starting sub task " + subTaskSummary1.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(subTaskSummary1.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started sub task " + subTaskSummary1.getId());

        //Starting the sub task 2
        System.out.println("Starting sub task " + subTaskSummary2.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    client.start(subTaskSummary2.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(5000);
    System.out.println("Started sub task " + subTaskSummary2.getId());



        //Check if the child task 1 is InProgress
        getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( subTaskSummary1.getId(), getTaskResponseHandler );
        Task subTask1 = getTaskResponseHandler.getTask();
        assertEqualsStatus.InProgress, subTask1.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), subTask1.getTaskData().getActualOwner() );


         //Check if the child task 2 is InProgress
        getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( subTaskSummary2.getId(), getTaskResponseHandler );
        Task subTask2 = getTaskResponseHandler.getTask();
        assertEqualsStatus.InProgress, subTask2.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), subTask2.getTaskData().getActualOwner() );

        // Complete the parent task
        System.out.println("Completing parent task " + parentTask.getId());
        operationResponseHandler = new BlockingTaskOperationResponseHandler();
        client.skip( parentTask.getId(), "Darth Vader", operationResponseHandler );
        operationResponseHandler.waitTillDone( 5000 );
        System.out.println("Completed parent task " + parentTask.getId());



View Full Code Here

        Task task1 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Ready, task1.getTaskData().getStatus() );
        assertNull( task1.getTaskData().getActualOwner() )
       
        // Check is Suspended
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.suspend( taskId, users.get( "darth" ).getId(), responseHandler );
        responseHandler.waitTillDone( 3000 );
       
        getTaskResponseHandler = new BlockingGetTaskResponseHandler()
        client.getTask( taskId, getTaskResponseHandler );
        Task task2 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Suspended, task2.getTaskData().getStatus() );
        assertEquals( Status.Ready, task2.getTaskData().getPreviousStatus() );
        assertNull( task1.getTaskData().getActualOwner() );   
       
        // Check is Resumed
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.resume( taskId, users.get( "darth" ).getId(), responseHandler );  
        responseHandler.waitTillDone( 3000 );
       
        getTaskResponseHandler = new BlockingGetTaskResponseHandler()
        client.getTask( taskId, getTaskResponseHandler );
        Task task3 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Ready, task3.getTaskData().getStatus() );
View Full Code Here

        client.addTask( task, null, addTaskResponseHandler );
       
        long taskId = addTaskResponseHandler.getTaskId();            
       
        // Check is Reserved
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.claim( taskId, users.get( "darth" ).getId(), responseHandler );
        responseHandler.waitTillDone( 3000 );
       
        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler()
        client.getTask( taskId, getTaskResponseHandler );
        Task task1 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Reserved, task1.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), task1.getTaskData().getActualOwner() )
       
        // Check is suspended
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.suspend( taskId, users.get( "darth" ).getId(), responseHandler );       
        responseHandler.waitTillDone( 3000 );
       
        getTaskResponseHandler = new BlockingGetTaskResponseHandler()
        client.getTask( taskId, getTaskResponseHandler );
        Task task2 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Reserved, task2.getTaskData().getPreviousStatus() );
        assertEqualsStatus.Suspended, task2.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), task2.getTaskData().getActualOwner() );
       
        // Check is Resumed
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.resume( taskId, users.get( "darth" ).getId(), responseHandler );
        responseHandler.waitTillDone( 3000 );
       
        getTaskResponseHandler = new BlockingGetTaskResponseHandler()
        client.getTask( taskId, getTaskResponseHandler );
        Task task3 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Reserved, task3.getTaskData().getStatus() );
View Full Code Here

        client.addTask( task, null, addTaskResponseHandler );
       
        long taskId = addTaskResponseHandler.getTaskId();            
       
        // Check is Reserved
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.claim( taskId, users.get( "darth" ).getId(), responseHandler );
        responseHandler.waitTillDone( 3000 );
       
        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler()
        client.getTask( taskId, getTaskResponseHandler );
        Task task1 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Reserved, task1.getTaskData().getStatus() );
        assertEquals( users.get( "darth" ), task1.getTaskData().getActualOwner() )
       
        // Check not changed
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.suspend( taskId, users.get( "bobba" ).getId(), responseHandler );
        responseHandler.waitTillDone( 3000 );
       
        getTaskResponseHandler = new BlockingGetTaskResponseHandler()
        client.getTask( taskId, getTaskResponseHandler );
        Task task2 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Reserved, task1.getTaskData().getStatus() );
View Full Code Here

TOP

Related Classes of org.drools.task.service.responsehandlers.BlockingTaskOperationResponseHandler

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.