use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestOozieCLIMethods method testValidatePrintWorkflowActionOutput.
/**
* Create {@code WorkflowAction} mock
* call {@code new OozieCLI().printWorkflowAction() }
* and validate {@code System.out} on match with expected pattern
* <p>
* Method do pass only if output matched with predefined pattern
* </p>
*/
@Test
public void testValidatePrintWorkflowActionOutput() throws IOException {
final DataObject dtObject = new DataObject() {
{
this.deamonName = "testWorkflowAction111";
this.appName = "testWorkflowActionAppName";
this.appPath = "unused";
}
};
WorkflowAction workflowAction = createWorkflowAction(dtObject);
assertPrintWorkflowActionOutput(readWorkflowActionOutput(workflowAction, true), dtObject);
assertPrintWorkflowActionOutput(readWorkflowActionOutput(workflowAction, false), dtObject);
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestJsonToBean method testParseWorkflowActions.
@SuppressWarnings("unchecked")
public void testParseWorkflowActions() {
JSONArray array = createJsonWorkflowActionList();
List<WorkflowAction> list = JsonToBean.createWorkflowActionList(array);
assertEquals(2, list.size());
assertEquals("a1", list.get(0).getId());
assertEquals("a2", list.get(1).getId());
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class FsActionExecutor method end.
@Override
public void end(Context context, WorkflowAction action) throws ActionExecutorException {
String externalStatus = action.getExternalStatus();
WorkflowAction.Status status = externalStatus.equals("OK") ? WorkflowAction.Status.OK : WorkflowAction.Status.ERROR;
context.setEndData(status, getActionSignal(status));
if (!context.getProtoActionConf().getBoolean(WorkflowXCommand.KEEP_WF_ACTION_DIR, false)) {
try {
FileSystem fs = context.getAppFileSystem();
fs.delete(context.getActionDir(), true);
} catch (Exception ex) {
throw convertException(ex);
}
}
LOG.info("Action ended with external status [{0}]", action.getExternalStatus());
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestJsonWorkflowAction method testProperties.
public void testProperties() {
WorkflowAction action = createNode();
Assert.assertEquals("a", action.getId());
Assert.assertEquals("b", action.getName());
Assert.assertEquals("c", action.getType());
Assert.assertEquals("d", action.getConf());
Assert.assertEquals(WorkflowAction.Status.RUNNING, action.getStatus());
Assert.assertEquals(1, action.getRetries());
Assert.assertEquals(JsonUtils.parseDateRfc822(START_TIME), action.getStartTime());
Assert.assertEquals(JsonUtils.parseDateRfc822(END_TIME), action.getEndTime());
Assert.assertEquals("e", action.getTransition());
Assert.assertEquals("ee", action.getData());
Assert.assertEquals("stats", action.getStats());
Assert.assertEquals("extChIDs", action.getExternalChildIDs());
Assert.assertEquals("f", action.getExternalId());
Assert.assertEquals("g", action.getExternalStatus());
Assert.assertEquals("h", action.getTrackerUri());
Assert.assertEquals("i", action.getConsoleUrl());
Assert.assertEquals("j", action.getErrorCode());
Assert.assertEquals("k", action.getErrorMessage());
}
use of org.apache.oozie.client.WorkflowAction in project oozie by apache.
the class TestSignalXCommand method checkSuspendActions.
private void checkSuspendActions(WorkflowJob wf, final OozieClient oc, final String jobId, final WorkflowJob.Status status, String[] prepActions, String[] okActions) throws Exception {
// Wait for the WF to transition to status
waitFor(30 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
WorkflowJob wf = oc.getJobInfo(jobId);
return wf.getStatus() == status;
}
});
wf = oc.getJobInfo(jobId);
assertEquals(status, wf.getStatus());
// Check the actions' statuses
int numPrep = 0;
int numOK = 0;
for (WorkflowAction action : wf.getActions()) {
boolean checked = false;
for (String name : prepActions) {
if (!checked && name.equals(action.getName())) {
assertEquals("action [" + action.getName() + "] had incorrect status", WorkflowAction.Status.PREP, action.getStatus());
numPrep++;
checked = true;
}
}
if (!checked) {
for (String name : okActions) {
if (!checked && name.equals(action.getName())) {
assertEquals("action [" + action.getName() + "] had incorrect status", WorkflowAction.Status.OK, action.getStatus());
numOK++;
checked = true;
}
}
}
if (!checked) {
fail("Unexpected action [" + action.getName() + "] with status [" + action.getStatus() + "]");
}
}
assertEquals(prepActions.length, numPrep);
assertEquals(okActions.length, numOK);
}
Aggregations