public ExecutionDetail getExecution(String execId) throws CentralDispatcherException {
fail("unexpected call to getExecution");
return null;
}
}
final Framework framework = getFrameworkInstance();
{
final QueueTool tool = new QueueTool(framework);
final boolean[] actionCalled = new boolean[]{false};
framework.setCentralDispatcherMgr(new FailDispatcher(){
public Collection<QueuedItem> listDispatcherQueue(final String project) throws CentralDispatcherException {
//
actionCalled[0] = true;
return new ArrayList<QueuedItem>();
}
});
//test list action without required -p
try{
tool.run(new String[]{"list"});
fail("should have thrown argument exception.");
} catch (CLIToolOptionsException e) {
assertNotNull(e);
} catch (QueueToolException e) {
fail("unexpected exception: " + e.getMessage());
}
assertFalse("list action was not called", actionCalled[0]);
//exec the dispatch
tool.run(new String[]{"list","-p","test"});
assertTrue("list action was not called", actionCalled[0]);
}
{
final QueueTool tool = new QueueTool(framework);
final boolean[] actionCalled = new boolean[]{false};
final String[] idCalled = new String[]{"wrong"};
framework.setCentralDispatcherMgr(new FailDispatcher() {
public DispatcherResult killDispatcherExecution(final String id) throws CentralDispatcherException {
actionCalled[0] = true;
idCalled[0] = id;
return new DispatcherResult() {
public String getMessage() {