// deploying while in canceling state is illegal (should immediately go to canceled)
try {
ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
setVertexState(vertex, ExecutionState.CANCELING);
TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
Instance instance = getInstance(taskManager);
AllocatedSlot slot = instance.allocateSlot(new JobID());
vertex.deployToSlot(slot);
fail("Method should throw an exception");
}
catch (IllegalStateException e) {}
// fail while canceling
{
ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
Instance instance = getInstance(taskManager);
AllocatedSlot slot = instance.allocateSlot(new JobID());
setVertexResource(vertex, slot);
setVertexState(vertex, ExecutionState.CANCELING);