// Check is Reserved
BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
client.claim( taskId, users.get( "darth" ).getId(), responseHandler );
responseHandler.waitTillDone(DEFAULT_WAIT_TIME);
BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
client.getTask( taskId, getTaskResponseHandler );
Task task1 = getTaskResponseHandler.getTask();
assertEquals( Status.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(DEFAULT_WAIT_TIME);
getTaskResponseHandler = new BlockingGetTaskResponseHandler();
client.getTask( taskId, getTaskResponseHandler );
Task task2 = getTaskResponseHandler.getTask();
assertEquals( Status.Reserved, task2.getTaskData().getPreviousStatus() );
assertEquals( Status.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(DEFAULT_WAIT_TIME);
getTaskResponseHandler = new BlockingGetTaskResponseHandler();
client.getTask( taskId, getTaskResponseHandler );
Task task3 = getTaskResponseHandler.getTask();
assertEquals( Status.Reserved, task3.getTaskData().getStatus() );
assertEquals( Status.Suspended, task3.getTaskData().getPreviousStatus() );
assertEquals( users.get( "darth" ), task3.getTaskData().getActualOwner() );
}