task1.chain(task2);
task2.chain(task3);
task3.chain(task4);
task4.chain(task5);
ClaimCheck claim = TaskQueueManager.execute(QUEUE_NAME,task1);
ClaimCheck indClaim = TaskQueueManager.execute(QUEUE_NAME,independentTask);
stopWatch.block(300);
assertEquals("Task 1 is SUCCESS",TaskStatus.SUCCESS,task1.getStatus());
assertEquals("Task 2 is WORKING",TaskStatus.WORKING,task2.getStatus());
assertEquals("Task 3 is DEQUEUED",TaskStatus.DEQUEUED,task3.getStatus());
assertEquals("Task 4 is DEQUEUED",TaskStatus.DEQUEUED,task4.getStatus());
assertEquals("Task 5 is DEQUEUED",TaskStatus.DEQUEUED,task5.getStatus());
stopWatch.block(250);
assertEquals("Task 1 is SUCCESS",TaskStatus.SUCCESS,task1.getStatus());
assertEquals("Task 2 is SUCCESS",TaskStatus.SUCCESS,task2.getStatus());
assertEquals("Task 3 is WORKING",TaskStatus.WORKING,task3.getStatus());
assertEquals("Task 4 is DEQUEUED",TaskStatus.DEQUEUED,task4.getStatus());
assertEquals("Task 5 is DEQUEUED",TaskStatus.DEQUEUED,task5.getStatus());
boolean indSuccess = TaskQueueManager.block(QUEUE_NAME,UUID.fromString(indClaim.toString()));
assertFalse("Independent Block was unsuccessful",indSuccess);
boolean success = TaskQueueManager.block(QUEUE_NAME,UUID.fromString(claim.toString()));
assertTrue("Block was successful",success);
assertEquals("Task 1 is SUCCESS",TaskStatus.SUCCESS,task1.getStatus());