Search in sources :

Example 96 with CommandException

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);
    }
}
Also used : XConfiguration(org.apache.oozie.util.XConfiguration) Configuration(org.apache.hadoop.conf.Configuration) CommandException(org.apache.oozie.command.CommandException) Test(org.junit.Test)

Example 97 with CommandException

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));
}
Also used : CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) CoordMaterializeTransitionXCommand(org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand) CoordActionInputCheckXCommand(org.apache.oozie.command.coord.CoordActionInputCheckXCommand) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) JDOMException(org.jdom.JDOMException) IOException(java.io.IOException) CommandException(org.apache.oozie.command.CommandException)

Example 98 with CommandException

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");
    }
}
Also used : XConfiguration(org.apache.oozie.util.XConfiguration) XConfiguration(org.apache.oozie.util.XConfiguration) Configuration(org.apache.hadoop.conf.Configuration) CommandException(org.apache.oozie.command.CommandException)

Example 99 with CommandException

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");
    }
}
Also used : XConfiguration(org.apache.oozie.util.XConfiguration) XConfiguration(org.apache.oozie.util.XConfiguration) Configuration(org.apache.hadoop.conf.Configuration) CommandException(org.apache.oozie.command.CommandException)

Example 100 with CommandException

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) {
    }
}
Also used : XConfiguration(org.apache.oozie.util.XConfiguration) XConfiguration(org.apache.oozie.util.XConfiguration) Configuration(org.apache.hadoop.conf.Configuration) CommandException(org.apache.oozie.command.CommandException)

Aggregations

CommandException (org.apache.oozie.command.CommandException)225 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)85 XConfiguration (org.apache.oozie.util.XConfiguration)62 Date (java.util.Date)59 IOException (java.io.IOException)57 Configuration (org.apache.hadoop.conf.Configuration)56 JPAService (org.apache.oozie.service.JPAService)56 XException (org.apache.oozie.XException)42 PreconditionException (org.apache.oozie.command.PreconditionException)35 ArrayList (java.util.ArrayList)26 StringReader (java.io.StringReader)25 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)24 List (java.util.List)23 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)23 Element (org.jdom.Element)23 JDOMException (org.jdom.JDOMException)20 File (java.io.File)16 HadoopAccessorException (org.apache.oozie.service.HadoopAccessorException)16 WorkflowException (org.apache.oozie.workflow.WorkflowException)16 URISyntaxException (java.net.URISyntaxException)14