// Go straight from Ready to Inprogress
BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
client.start( 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.InProgress, task1.getTaskData().getStatus() );
assertEquals( users.get( "darth" ), task1.getTaskData().getActualOwner() );
// Should not stop
responseHandler = new BlockingTaskOperationResponseHandler();
client.stop( taskId, users.get( "bobba" ).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();
assertEquals( Status.InProgress, task2.getTaskData().getStatus() );
assertEquals( users.get( "darth" ), task2.getTaskData().getActualOwner() );
}