Search in sources :

Example 16 with Services

use of org.apache.oozie.service.Services in project oozie by apache.

the class TestActionStartXCommand method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    services = new Services();
    services.init();
}
Also used : Services(org.apache.oozie.service.Services)

Example 17 with Services

use of org.apache.oozie.service.Services in project oozie by apache.

the class TestActionUserRetry method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    setSystemProperty(SchemaService.WF_CONF_EXT_SCHEMAS, "wf-ext-schema.xsd");
    setSystemProperty(LiteWorkflowStoreService.CONF_USER_RETRY_ERROR_CODE_EXT, ForTestingActionExecutor.TEST_ERROR);
    setSystemProperty(Services.CONF_SERVICE_EXT_CLASSES, ExtendedCallableQueueService.class.getName());
    services = new Services();
    services.init();
    services.get(ActionService.class).registerAndInitExecutor(ForTestingActionExecutor.class);
    ConfigurationService.setBoolean(SignalXCommand.FORK_PARALLEL_JOBSUBMISSION, true);
}
Also used : Services(org.apache.oozie.service.Services) ExtendedCallableQueueService(org.apache.oozie.service.ExtendedCallableQueueService) ActionService(org.apache.oozie.service.ActionService)

Example 18 with Services

use of org.apache.oozie.service.Services in project oozie by apache.

the class TestCoordRerunXCommand method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    services = new Services();
    services.init();
    LocalOozie.start();
}
Also used : Services(org.apache.oozie.service.Services)

Example 19 with Services

use of org.apache.oozie.service.Services in project oozie by apache.

the class TestCoordRerunXCommand method testCoordRerunInDoneWithError.

/**
 * Test : Rerun DONEWITHERROR coordinator job
 *
 * @throws Exception
 */
public void testCoordRerunInDoneWithError() throws Exception {
    Services.get().destroy();
    setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
    services = new Services();
    services.init();
    CoordinatorJobBean job = this.addRecordToCoordJobTable(Job.Status.DONEWITHERROR, false, false);
    addRecordToCoordActionTable(job.getId(), 1, CoordinatorAction.Status.FAILED, "coord-rerun-action1.xml", 0);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    job = getCoordinatorJob(job.getId());
    assertEquals(Job.Status.DONEWITHERROR, job.getStatus());
    new CoordRerunXCommand(job.getId(), RestConstants.JOB_COORD_SCOPE_DATE, "2009-12-15T01:00Z", false, true, false, null).call();
    job = getCoordinatorJob(job.getId());
    assertEquals(Job.Status.RUNNINGWITHERROR, job.getStatus());
}
Also used : Services(org.apache.oozie.service.Services) CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAService(org.apache.oozie.service.JPAService)

Example 20 with Services

use of org.apache.oozie.service.Services in project oozie by apache.

the class TestCoordRerunXCommand method testCoordRerunForBackwardSupport3.

/**
 * Tests functionality of the coord rerun for backward support is true. </p> Insert a coordinator job with SUCCEEDED
 * and coordinator actions with pending false. However, job's doneMaterialization is false to imitate update from
 * 2.x to 3.0.1.
 * Set oozie.service.StatusTransitService.backward.support.for.coord.status=true
 * and use uri:oozie:coordinator:0.1 namespace, then, rerun the coord job for action 1 and action 2.
 *
 * @throws Exception
 */
public void testCoordRerunForBackwardSupport3() throws Exception {
    Services.get().destroy();
    setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
    services = new Services();
    services.init();
    Date start = DateUtils.parseDateOozieTZ("2009-02-01T01:00Z");
    Date end = DateUtils.parseDateOozieTZ("2009-02-02T23:59Z");
    CoordinatorJobBean coordJob = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, start, end, false, false, 3);
    final JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    coordJob.setAppNamespace(SchemaService.COORDINATOR_NAMESPACE_URI_1);
    CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_APPNAMESPACE, coordJob);
    CoordinatorActionBean action1 = addRecordToCoordActionTable(coordJob.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-rerun-action1.xml", 0);
    CoordinatorActionBean action2 = addRecordToCoordActionTable(coordJob.getId(), 2, CoordinatorAction.Status.SUCCEEDED, "coord-rerun-action1.xml", 0);
    CoordinatorActionBean action3 = addRecordToCoordActionTable(coordJob.getId(), 3, CoordinatorAction.Status.SUCCEEDED, "coord-rerun-action1.xml", 0);
    String rerunScope = Integer.toString(1) + "-" + Integer.toString(2);
    final OozieClient coordClient = LocalOozie.getCoordClient();
    coordClient.reRunCoord(coordJob.getId(), RestConstants.JOB_COORD_SCOPE_ACTION, rerunScope, false, true);
    coordJob = getCoordinatorJob(coordJob.getId());
    assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob.getStatus());
    action1 = getCoordinatorAction(action1.getId());
    assertNotSame(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
    action2 = getCoordinatorAction(action2.getId());
    assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
}
Also used : Services(org.apache.oozie.service.Services) CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) JPAService(org.apache.oozie.service.JPAService) Date(java.util.Date)

Aggregations

Services (org.apache.oozie.service.Services)247 JPAService (org.apache.oozie.service.JPAService)32 Configuration (org.apache.hadoop.conf.Configuration)21 Date (java.util.Date)17 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)16 File (java.io.File)14 Before (org.junit.Before)14 XConfiguration (org.apache.oozie.util.XConfiguration)11 Path (org.apache.hadoop.fs.Path)10 ActionExecutorException (org.apache.oozie.action.ActionExecutorException)10 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)8 EmbeddedServletContainer (org.apache.oozie.test.EmbeddedServletContainer)8 FileOutputStream (java.io.FileOutputStream)7 InputStream (java.io.InputStream)7 HashMap (java.util.HashMap)7 IOException (java.io.IOException)6 Properties (java.util.Properties)6 ActionService (org.apache.oozie.service.ActionService)6 StringWriter (java.io.StringWriter)5 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)5