Package org.drools.task.service.responsehandlers

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


    Thread.sleep(500);

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

    //Check if the parent task is InProgress
    BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
    getClient().getTask(task.getId(), getTaskResponseHandler);
    Task parentTask = getTaskResponseHandler.getTask();
    assertEquals(Status.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();
    getClient().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();
    getClient().start(subTaskSummary1.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Started sub task " + subTaskSummary1.getId());

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

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

    //Check if the child task 2 is InProgress
    getTaskResponseHandler = new BlockingGetTaskResponseHandler();
    getClient().getTask(subTaskSummary2.getId(), getTaskResponseHandler);
    Task subTask2 = getTaskResponseHandler.getTask();
    assertEquals(Status.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();
    getClient().complete(subTask1.getId(), "Darth Vader", null, operationResponseHandler);
    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Completed sub task " + subTask1.getId());

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

    //Check if the child task 1 is Completed

    getTaskResponseHandler = new BlockingGetTaskResponseHandler();
View Full Code Here


    Thread.sleep(500);

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

    //Check if the parent task is InProgress
    BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
    getClient().getTask(task.getId(), getTaskResponseHandler);
    Task parentTask = getTaskResponseHandler.getTask();
    assertEquals(Status.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();
    getClient().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();
    getClient().start(subTaskSummary1.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Started sub task " + subTaskSummary1.getId());

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

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

    //Check if the child task 2 is InProgress
    getTaskResponseHandler = new BlockingGetTaskResponseHandler();
    getClient().getTask(subTaskSummary2.getId(), getTaskResponseHandler);
    Task subTask2 = getTaskResponseHandler.getTask();
    assertEquals(Status.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();
    getClient().skip(parentTask.getId(), "Darth Vader", operationResponseHandler);
    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Completed parent task " + parentTask.getId());

    //Check if the child task 1 is Completed
    getTaskResponseHandler = new BlockingGetTaskResponseHandler();
    getClient().getTask(subTaskSummary1.getId(), getTaskResponseHandler);
View Full Code Here

        client.getTasksAssignedAsPotentialOwner(users.get( "bobba" ).getId(), "en-UK", taskSummaryResponseHandler);
        List<TaskSummary> tasks = taskSummaryResponseHandler.getResults();
        assertEquals(1, tasks.size());
        assertEquals(Status.Reserved, tasks.get(0).getStatus());
       
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.start( taskId, users.get( "bobba" ).getId(), responseHandler )

        taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
        client.getTasksAssignedAsPotentialOwner(users.get( "bobba" ).getId(), "en-UK", taskSummaryResponseHandler);
        tasks = taskSummaryResponseHandler.getResults();
        assertEquals(1, tasks.size());
        assertEquals(Status.InProgress, tasks.get(0).getStatus());
       
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.complete( taskId, users.get( "bobba" ).getId(), null, responseHandler );
       
        taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
        client.getTasksAssignedAsPotentialOwner(users.get( "bobba" ).getId(), "en-UK", taskSummaryResponseHandler);
        tasks = taskSummaryResponseHandler.getResults();
View Full Code Here

        client.getTasksAssignedAsPotentialOwner(users.get( "bobba" ).getId(), "en-UK", taskSummaryResponseHandler);
        List<TaskSummary> tasks = taskSummaryResponseHandler.getResults();
        assertEquals(1, tasks.size());
        assertEquals(Status.Reserved, tasks.get(0).getStatus());
       
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.start( taskId, users.get( "bobba" ).getId(), responseHandler )

        taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
        client.getTasksAssignedAsPotentialOwner(users.get( "bobba" ).getId(), "en-UK", taskSummaryResponseHandler);
        tasks = taskSummaryResponseHandler.getResults();
        assertEquals(1, tasks.size());
        assertEquals(Status.InProgress, tasks.get(0).getStatus());
       
        BlockingAddTaskResponseHandler addTaskResponseHandler2 = new BlockingAddTaskResponseHandler();
        Task task2 = ( Task eval( new StringReader( str ), vars );
        client.addTask( task2, null, addTaskResponseHandler2 );
        long taskId2 = addTaskResponseHandler.getTaskId();
       
        EventKey key2 = new TaskEventKey(TaskCompletedEvent.class, taskId2 );          
        BlockingEventResponseHandler handler2 = new BlockingEventResponseHandler();
        client.registerForEvent( key2, true, handler2 );
       
        taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
        client.getTasksAssignedAsPotentialOwner(users.get( "bobba" ).getId(), "en-UK", taskSummaryResponseHandler);
        tasks = taskSummaryResponseHandler.getResults();
        assertEquals(2, tasks.size());
       
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.complete( taskId, users.get( "bobba" ).getId(), null, responseHandler );
       
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.start( taskId2, users.get( "bobba" ).getId(), responseHandler )

        taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
        client.getTasksAssignedAsPotentialOwner(users.get( "bobba" ).getId(), "en-UK", taskSummaryResponseHandler);
        tasks = taskSummaryResponseHandler.getResults();
        assertEquals(1, tasks.size());
       
        Payload payload = handler.getPayload();
        TaskCompletedEvent event = ( TaskCompletedEvent ) payload.get();
        assertNotNull( event );
       
        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( taskId, getTaskResponseHandler );
        task = getTaskResponseHandler.getTask();
        assertEquals( Status.Completed , task.getTaskData().getStatus() );
       
        responseHandler = new BlockingTaskOperationResponseHandler();
        client.complete( taskId2, users.get( "bobba" ).getId(), null, responseHandler );
       
        payload = handler.getPayload();
        event = ( TaskCompletedEvent ) payload.get();
        assertNotNull( event );
View Full Code Here

        client.addTask( task, null,
                        addTaskResponseHandler );

        long taskId = addTaskResponseHandler.getTaskId();
       
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.claim( taskId,
                      users.get( "steve" ).getId(),
                      responseHandler );
        responseHandler.waitTillDone( 5000 );

        assertEquals( 2,
                      getWiser().getMessages().size() );
       
        assertEquals( "steve@domain.com", getWiser().getMessages().get( 0 ).getEnvelopeReceiver() );
View Full Code Here

        client.addTask( task, null,
                        addTaskResponseHandler );

        long taskId = addTaskResponseHandler.getTaskId();

        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.claim( taskId,
                      users.get( "steve" ).getId(),
                      responseHandler );
        responseHandler.waitTillDone( 5000 );

        assertEquals( 1,
                      getWiser().getMessages().size() );

        assertEquals( "steve@domain.com", getWiser().getMessages().get( 0 ).getEnvelopeReceiver() );
View Full Code Here

        client.addTask( task, null,
                        addTaskResponseHandler );

        long taskId = addTaskResponseHandler.getTaskId();

        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.claim( taskId,
                      users.get( "steve" ).getId(),
                      responseHandler );

        responseHandler.waitTillDone( 5000 );

        assertEquals( 1,
                      getWiser().getMessages().size() );
       
        assertEquals( "steve@domain.com", getWiser().getMessages().get( 0 ).getEnvelopeReceiver() );
View Full Code Here

        client.addTask( task, null,
                        addTaskResponseHandler );

        long taskId = addTaskResponseHandler.getTaskId();

        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.claim( taskId,
                      users.get( "steve" ).getId(),
                      responseHandler );

        responseHandler.waitTillDone( 5000 );

        assertEquals( 0,
                      getWiser().getMessages().size() );       
    }      
View Full Code Here

        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( taskId, getTaskResponseHandler );
        Task task1 = getTaskResponseHandler.getTask();
        assertEquals( Status.Ready , task1.getTaskData().getStatus() );    
       
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        client.claim( taskId, users.get( "darth" ).getId(), responseHandler );       
        responseHandler.waitTillDone(DEFAULT_WAIT_TIME);
       
        getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( taskId, getTaskResponseHandler );
        Task task2 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Reserved, task2.getTaskData().getStatus() );
View Full Code Here

        BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( taskId, getTaskResponseHandler );
        Task task1 = getTaskResponseHandler.getTask();
        assertEquals( Status.Ready , task1.getTaskData().getStatus() );    
       
        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
        List<String> groupIds = new ArrayList<String>();
        groupIds.add("Dummy Group");
        groupIds.add("Knights Templer");
        client.claim( taskId, users.get( "darth" ).getId(), groupIds, responseHandler );       
        responseHandler.waitTillDone(DEFAULT_WAIT_TIME);
       
        getTaskResponseHandler = new BlockingGetTaskResponseHandler();
        client.getTask( taskId, getTaskResponseHandler );
        Task task2 = getTaskResponseHandler.getTask();
        assertEqualsStatus.Reserved, task2.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.