workflow.setConf(wfConf.toXmlString());
workflow.setAppPath(wfConf.get(OozieClient.APP_PATH));
workflow.setProtoActionConf(protoConf.toXmlString());
workflow.setId(Services.get().get(UUIDService.class).generateId(ApplicationType.WORKFLOW));
final WorkflowActionBean action = new WorkflowActionBean();
action.setId("actionId");
action.setConf("<ssh xmlns='" + getActionXMLSchema() + "'>" +
"<host>localhost</host>" +
"<command>echo</command>" +
"<capture-output/>" +
"<args>\"prop1=something\"</args>" +
"</ssh>");
action.setName("ssh");
final SshActionExecutor ssh = new SshActionExecutor();
final Context context = new Context(workflow, action);
ssh.start(context, action);
Thread.sleep(200);
final WorkflowActionBean action1 = new WorkflowActionBean();
action1.setId("actionId");
action1.setConf("<ssh xmlns='" + getActionXMLSchema() + "'>" +
"<host>localhost</host>" +
"<command>echo</command>" +
"<capture-output/>" +
"<args>\"prop1=nothing\"</args>" +
"</ssh>");
action1.setName("ssh");
final SshActionExecutor ssh1 = new SshActionExecutor();
final Context context1 = new Context(workflow, action1);
Thread.sleep(500);
ssh1.start(context1, action1);
assertEquals(action1.getExternalId(), action.getExternalId());
waitFor(30 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
ssh.check(context1, action1);
return Status.DONE == action1.getStatus();
}
});
ssh1.end(context1, action1);
assertEquals(Status.OK, action1.getStatus());
assertEquals("something", PropertiesUtils.stringToProperties(action1.getData()).getProperty("prop1"));
}