use of org.apache.oozie.action.ActionExecutor in project oozie by apache.
the class TestJavaActionExecutor method testExit0SubmitOK.
public void testExit0SubmitOK() throws Exception {
String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>exit0</arg>" + "</java>";
Context context = createContext(actionXml, null);
final String runningJob = submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(runningJob);
ActionExecutor ae = new JavaActionExecutor();
ae.check(context, context.getAction());
assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
assertNull(context.getAction().getData());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}
use of org.apache.oozie.action.ActionExecutor in project oozie by apache.
the class TestJavaActionExecutor method testKill.
public void testKill() throws Exception {
String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "</java>";
final Context context = createContext(actionXml, null);
final String runningJob = submitAction(context);
ActionExecutor ae = new JavaActionExecutor();
ae.kill(context, context.getAction());
assertEquals(WorkflowAction.Status.DONE, context.getAction().getStatus());
assertEquals("KILLED", context.getAction().getExternalStatus());
assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
waitUntilYarnAppKilledAndAssertSuccess(runningJob);
}
use of org.apache.oozie.action.ActionExecutor in project oozie by apache.
the class TestJavaActionExecutor method testSubmitOKWithLauncherEnvVars.
public void testSubmitOKWithLauncherEnvVars() throws Exception {
String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<configuration>" + " <property><name>oozie.launcher.env</name><value>A=foo1" + File.pathSeparator + "B=foo2</value></property>" + "</configuration>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "</java>";
Context context = createContext(actionXml, null);
submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(context.getAction().getExternalId());
ActionExecutor ae = new JavaActionExecutor();
ae.check(context, context.getAction());
assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
assertNull(context.getAction().getData());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
}
use of org.apache.oozie.action.ActionExecutor in project oozie by apache.
the class TestJavaActionExecutor method testIdSwapSubmitOK.
public void testIdSwapSubmitOK() throws Exception {
String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>id</arg>" + "<capture-output/>" + "</java>";
Context context = createContext(actionXml, null);
final String runningJob = submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(runningJob);
ActionExecutor ae = new JavaActionExecutor();
try {
ae.check(context, context.getAction());
} catch (ActionExecutorException ex) {
if (!ex.getMessage().contains("IDSWAP")) {
fail();
}
}
}
use of org.apache.oozie.action.ActionExecutor in project oozie by apache.
the class TestJavaActionExecutor method testExceptionSubmitThrowable.
public void testExceptionSubmitThrowable() throws Exception {
String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" + "<arg>throwable</arg>" + "</java>";
Context context = createContext(actionXml, null);
final String runningJob = submitAction(context);
waitUntilYarnAppDoneAndAssertSuccess(runningJob);
// FIXME assertFalse(LauncherHelper.isMainSuccessful(runningJob));
ActionExecutor ae = new JavaActionExecutor();
ae.check(context, context.getAction());
assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
assertEquals("FAILED/KILLED", context.getAction().getExternalStatus());
assertNull(context.getAction().getData());
ae.end(context, context.getAction());
assertEquals(WorkflowAction.Status.ERROR, context.getAction().getStatus());
}
Aggregations