Search in sources :

Example 1 with CoordActionGetForStartJPAExecutor

use of org.apache.oozie.executor.jpa.CoordActionGetForStartJPAExecutor in project oozie by apache.

the class TestCoordActionStartXCommand method testActionStartWithErrorReported.

/**
 * Coord action XML contains non-supported parameterized action name and
 * test that CoordActionStartXCommand stores error code and error message in
 * action's table during error handling
 *
 * @throws IOException
 * @throws JPAExecutorException
 * @throws CommandException
 */
public void testActionStartWithErrorReported() throws IOException, JPAExecutorException, CommandException {
    String actionId = new Date().getTime() + "-COORD-ActionStartCommand-C@1";
    String wfApp = "<start to='${someParam}' />";
    addRecordToActionTable(actionId, 1, wfApp);
    new CoordActionStartXCommand(actionId, "me", "myapp", "myjob").call();
    final JPAService jpaService = Services.get().get(JPAService.class);
    CoordinatorActionBean action = jpaService.execute(new CoordActionGetForStartJPAExecutor(actionId));
    if (action.getStatus() == CoordinatorAction.Status.SUBMITTED) {
        fail("Expected status was FAILED due to incorrect XML element");
    }
    assertEquals(action.getErrorCode(), ErrorCode.E0701.toString());
    assertTrue(action.getErrorMessage().contains("XML schema error, cvc-pattern-valid: Value '${someParam}' " + "is not facet-valid with respect to pattern"));
}
Also used : CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) JPAService(org.apache.oozie.service.JPAService) CoordActionGetForStartJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetForStartJPAExecutor) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)1 CoordActionGetForStartJPAExecutor (org.apache.oozie.executor.jpa.CoordActionGetForStartJPAExecutor)1 JPAService (org.apache.oozie.service.JPAService)1