}
}
public void testQueueOption() throws Exception {
//test action calls
final Framework framework = getFrameworkInstance();
{
ExecTool main = newExecTool();
main.setFramework(framework);
final testCentralDispatcher test = new testCentralDispatcher();
framework.setCentralDispatcherMgr(test);
//exec the dispatch
main.run(new String[]{"-p", "testProject", "-Q", "--", "shell", "command", "string"});
test.assertQueueScriptOnlyCalled();
assertNotNull("args should not be null", test.passedinScript.getArgs());
assertEquals("wrong args size",3, test.passedinScript.getArgs().length);
assertEquals("wrong args entry","shell", test.passedinScript.getArgs()[0]);
assertEquals("wrong args entry","command", test.passedinScript.getArgs()[1]);
assertEquals("wrong args entry","string", test.passedinScript.getArgs()[2]);
assertNull(test.passedinScript.getScript());
assertNull(test.passedinScript.getServerScriptFilePath());
assertNull(test.passedinScript.getScriptAsStream());
assertEquals("testProject", test.passedinScript.getFrameworkProject());
}
{
ExecTool main = newExecTool();
main.setFramework(framework);
final testCentralDispatcher test = new testCentralDispatcher();
framework.setCentralDispatcherMgr(test);
//exec the dispatch
main.run(new String[]{"-p", "testProject", "-Q", "--", "shell", "space string"});
test.assertQueueScriptOnlyCalled();
assertNotNull("args should not be null", test.passedinScript.getArgs());
assertEquals("wrong args size", 2, test.passedinScript.getArgs().length);
assertEquals("wrong args entry", "shell", test.passedinScript.getArgs()[0]);
assertEquals("wrong args entry", "space string", test.passedinScript.getArgs()[1]);
assertNull(test.passedinScript.getScript());
assertNull(test.passedinScript.getServerScriptFilePath());
assertNull(test.passedinScript.getScriptAsStream());
assertEquals("testProject", test.passedinScript.getFrameworkProject());
}
{
//test script path input available as InputStream when queueing dispatch
ExecTool main = newExecTool();
main.setFramework(framework);
final testCentralDispatcher test = new testCentralDispatcher();
framework.setCentralDispatcherMgr(test);
//exec the dispatch
main.run(new String[]{"-p", "testProject", "-Q", "-s",
"src/test/resources/com/dtolabs/rundeck/core/cli/test-dispatch-script.txt"});
test.assertQueueScriptOnlyCalled();
assertNull("unexpected value: ", test.passedinScript.getArgs());
assertNull("unexpected value: "+ test.passedinScript.getScript(), test.passedinScript.getScript());
assertEquals("unexpected value: " + test.passedinScript.getServerScriptFilePath(),
new File("src/test/resources/com/dtolabs/rundeck/core/cli/test-dispatch-script.txt").getAbsolutePath(), test.passedinScript.getServerScriptFilePath());
assertNull(test.passedinScript.getScriptAsStream());
assertEquals("testProject", test.passedinScript.getFrameworkProject());
}
{
//test the node filter arguments
ExecTool main = newExecTool();
main.setFramework(framework);
final testCentralDispatcher test = new testCentralDispatcher();
framework.setCentralDispatcherMgr(test);
//exec the dispatch
main.run(
new String[]{"-p", "testProject", "-K", "-C", "2", "-I", "hostname1", "-X", "tags=baloney", "-Q", "--",