// Claim and 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 was not delegated
responseHandler = new BlockingTaskOperationResponseHandler();
client.delegate( taskId, users.get( "bobba" ).getId(), users.get( "tony" ).getId(), responseHandler );
PermissionDeniedException denied = null;
try{
responseHandler.waitTillDone(DEFAULT_WAIT_TIME);
} catch(PermissionDeniedException e) {
denied = e;
}
assertNotNull("Should get permissed denied exception", denied);
getTaskResponseHandler = new BlockingGetTaskResponseHandler();
client.getTask( taskId, getTaskResponseHandler );
Task task2 = getTaskResponseHandler.getTask();
assertTrue( task2.getPeopleAssignments().getPotentialOwners().contains( users.get( "darth" ) ) );
assertFalse( task2.getPeopleAssignments().getPotentialOwners().contains( users.get( "tony" ) ) );
assertEquals( users.get( "darth" ), task2.getTaskData().getActualOwner() );
assertEquals( Status.Reserved, task2.getTaskData().getStatus() );
}