}
};
//
Shell shell = new BaseShell(factory);
CommandQueue commands = new CommandQueue();
AsyncShell asyncShell = new AsyncShell(commands, shell);
//
BaseProcessContext ctx = BaseProcessContext.create(asyncShell, "foo").execute();
assertEquals(Status.QUEUED, ((AsyncProcess)ctx.getProcess()).getStatus());
assertEquals(1, commands.getSize());
//
ctx.getProcess().cancel();
assertEquals(Status.CANCELED, ((AsyncProcess)ctx.getProcess()).getStatus());
// Execute the command
Future<?> future = commands.executeAsync();
future.get();
// Test we get terminated status and the callback was done
assertEquals(Status.TERMINATED, ((AsyncProcess)ctx.getProcess()).getStatus());
assertEquals(ShellResponse.Cancelled.class, ctx.getResponse().getClass());