use of org.apache.oozie.command.CommandException in project oozie by apache.
the class TestCoordinatorInputLogic method testValidateRange.
@Test(expected = CommandException.class)
public void testValidateRange() throws Exception {
Configuration conf = getConf();
// @formatter:off
String inputLogic = "<combine name=\"test\">" + "<data-in dataset=\"A\" />" + "<data-in dataset=\"b\" />" + "</combine>";
String inputEvent = "<data-in name=\"A\" dataset=\"a\">" + "<start-instance>${coord:current(-5)}</start-instance>" + "<end-instance>${coord:current(0)}</end-instance>" + "</data-in>" + "<data-in name=\"B\" dataset=\"b\">" + "<start-instance>${coord:current(-4)}</start-instance>" + "<end-instance>${coord:current(0)}</end-instance>" + "</data-in>";
// @formatter:on
conf.set("partitionName", "test");
try {
_testCoordSubmit("coord-inputlogic.xml", conf, inputLogic, inputEvent, true);
fail();
} catch (CommandException e) {
assertEquals(e.getErrorCode(), ErrorCode.E0803);
}
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class TestCoordinatorInputLogic method startCoordActionForWaiting.
private void startCoordActionForWaiting(final String jobId) throws CommandException, JPAExecutorException, JDOMException {
new CoordMaterializeTransitionXCommand(jobId, 3600).call();
new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
waitFor(5 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
return !actionBean.getStatus().equals(CoordinatorAction.Status.WAITING);
}
});
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
assertTrue("should be waiting", actionBean.getStatus().equals(CoordinatorAction.Status.WAITING));
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class TestSubmitXCommand method testAppPathIsDir.
public void testAppPathIsDir() throws Exception {
Configuration conf = new XConfiguration();
String workflowUri = getTestCaseFileUri("workflow.xml");
String appXml = "<workflow-app xmlns='uri:oozie:workflow:0.1' name='map-reduce-wf'> " + "<start to='end' /> " + "<end name='end' /> " + "</workflow-app>";
writeToFile(appXml, workflowUri);
conf.set(OozieClient.APP_PATH, workflowUri);
conf.set(OozieClient.USER_NAME, getTestUser());
SubmitXCommand sc = new SubmitXCommand(conf);
try {
sc.call();
} catch (CommandException ce) {
fail("Should succeed");
}
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class TestSubmitXCommand method testAppPathIsFile2.
public void testAppPathIsFile2() throws Exception {
Configuration conf = new XConfiguration();
String workflowUri = getTestCaseFileUri("workflow.xml");
String appXml = "<workflow-app xmlns='uri:oozie:workflow:0.1' name='map-reduce-wf'> " + "<start to='end' /> " + "<end name='end' /> " + "</workflow-app>";
writeToFile(appXml, workflowUri);
conf.set(OozieClient.APP_PATH, workflowUri);
conf.set(OozieClient.USER_NAME, getTestUser());
SubmitXCommand sc = new SubmitXCommand(conf);
try {
sc.call();
} catch (CommandException ce) {
fail("Should succeed");
}
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class TestSubmitXCommand method testAppPathIsFileNegative.
public void testAppPathIsFileNegative() throws Exception {
Configuration conf = new XConfiguration();
String workflowUri = getTestCaseFileUri("test.xml");
String appXml = "<workflow-app xmlns='uri:oozie:workflow:0.1' name='map-reduce-wf'> " + "<start to='end' /> " + "<end name='end' /> " + "</workflow-app>";
writeToFile(appXml, workflowUri);
conf.set(OozieClient.APP_PATH, getTestCaseFileUri("does_not_exist.xml"));
conf.set(OozieClient.USER_NAME, getTestUser());
SubmitXCommand sc = new SubmitXCommand(conf);
try {
sc.call();
fail("should fail");
} catch (CommandException ce) {
}
}
Aggregations