use of org.apache.oozie.BundleActionBean in project oozie by apache.
the class TestRecoveryService method testCoordCreateNotifyParentFailed.
public void testCoordCreateNotifyParentFailed() throws Exception {
final BundleActionBean bundleAction;
final BundleJobBean bundle;
bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
bundleAction = addRecordToBundleActionTable(bundle.getId(), "coord1", 1, Job.Status.PREP);
CoordinatorJobBean coordJob = addRecordToCoordJobTable(CoordinatorJob.Status.PREP, new Date(), new Date(), false, false, 1);
coordJob.setBundleId(bundle.getId());
coordJob.setAppName("coord1");
CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob);
assertNull(bundleAction.getCoordId());
sleep(3000);
Runnable recoveryRunnable = new RecoveryRunnable(0, 1, 1);
recoveryRunnable.run();
waitFor(10000, new Predicate() {
public boolean evaluate() throws Exception {
BundleActionBean mybundleAction = BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_ACTION, bundle.getId() + "_coord1");
return mybundleAction.getCoordId() != null;
}
});
BundleActionBean mybundleAction = BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_ACTION, bundle.getId() + "_coord1");
assertNotNull(mybundleAction.getCoordId());
}
use of org.apache.oozie.BundleActionBean in project oozie by apache.
the class TestRecoveryService method testBundleRecoveryCoordExists.
/**
* If the bundle action is in PREP state and coord is already created, recovery should not submit new coord
* @throws Exception
*/
public void testBundleRecoveryCoordExists() throws Exception {
final BundleJobBean bundle;
final CoordinatorJob coord;
bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
coord = addRecordToCoordJobTable(Job.Status.PREP, false, false);
addRecordToBundleActionTable(bundle.getId(), coord.getId(), "coord1", 1, Job.Status.PREP);
final JPAService jpaService = Services.get().get(JPAService.class);
sleep(3000);
Runnable recoveryRunnable = new RecoveryRunnable(0, 1, 1);
recoveryRunnable.run();
waitFor(3000, new Predicate() {
public boolean evaluate() throws Exception {
BundleActionBean mybundleAction = jpaService.execute(new BundleActionGetJPAExecutor(bundle.getId(), "coord1"));
return !mybundleAction.getCoordId().equals(coord.getId());
}
});
BundleActionBean mybundleAction = jpaService.execute(new BundleActionGetJPAExecutor(bundle.getId(), "coord1"));
assertEquals(coord.getId(), mybundleAction.getCoordId());
}
use of org.apache.oozie.BundleActionBean in project oozie by apache.
the class TestJMSTopicService method testTopicAsFixedString.
@Test
public void testTopicAsFixedString() throws Exception {
services = setupServicesForTopic();
services.getConf().set(JMSTopicService.TOPIC_NAME, JMSTopicService.JobType.WORKFLOW.getValue() + " =workflow," + JMSTopicService.JobType.COORDINATOR.getValue() + "=coord," + JMSTopicService.JobType.BUNDLE.getValue() + "=bundle");
services.init();
JMSTopicService jmsTopicService = Services.get().get(JMSTopicService.class);
WorkflowJobBean wfj = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
assertEquals("workflow", jmsTopicService.getTopic(wfj.getId()));
assertEquals("workflow", jmsTopicService.getTopic(AppType.WORKFLOW_JOB, wfj.getUser(), wfj.getId(), null));
WorkflowActionBean wab = addRecordToWfActionTable(wfj.getId(), "1", WorkflowAction.Status.RUNNING);
assertEquals("workflow", jmsTopicService.getTopic(wab.getId()));
assertEquals("workflow", jmsTopicService.getTopic(AppType.WORKFLOW_ACTION, wfj.getUser(), wab.getId(), wab.getWfId()));
CoordinatorJobBean cjb = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, true, true);
assertEquals("coord", jmsTopicService.getTopic(cjb.getId()));
assertEquals("coord", jmsTopicService.getTopic(AppType.COORDINATOR_JOB, cjb.getUser(), cjb.getId(), null));
CoordinatorActionBean cab = addRecordToCoordActionTable(cjb.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-for-action-input-check.xml", 0);
assertEquals("coord", jmsTopicService.getTopic(cab.getId()));
assertEquals("coord", jmsTopicService.getTopic(AppType.COORDINATOR_ACTION, cjb.getUser(), cab.getId(), cab.getJobId()));
BundleJobBean bjb = addRecordToBundleJobTable(Job.Status.RUNNING, true);
assertEquals("bundle", jmsTopicService.getTopic(bjb.getId()));
assertEquals("bundle", jmsTopicService.getTopic(AppType.BUNDLE_JOB, bjb.getUser(), bjb.getId(), null));
BundleActionBean bab = addRecordToBundleActionTable(bjb.getId(), "1", 1, Job.Status.RUNNING);
assertEquals("bundle", jmsTopicService.getTopic(bab.getBundleActionId()));
assertEquals("bundle", jmsTopicService.getTopic(AppType.BUNDLE_ACTION, bjb.getUser(), bab.getBundleActionId(), bab.getBundleId()));
}
use of org.apache.oozie.BundleActionBean in project oozie by apache.
the class TestJMSTopicService method testTopicAsJobId.
@Test
public void testTopicAsJobId() throws Exception {
final String TOPIC_PREFIX = "oozie.";
services = setupServicesForTopic();
services.getConf().set(JMSTopicService.TOPIC_NAME, "default=" + JMSTopicService.TopicType.JOBID.getValue());
services.getConf().set(JMSTopicService.TOPIC_PREFIX, TOPIC_PREFIX);
services.init();
JMSTopicService jmsTopicService = Services.get().get(JMSTopicService.class);
WorkflowJobBean wfj = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
assertEquals(TOPIC_PREFIX, jmsTopicService.getTopicPrefix());
assertEquals(TOPIC_PREFIX + wfj.getId(), jmsTopicService.getTopic(wfj.getId()));
assertEquals(TOPIC_PREFIX + wfj.getId(), jmsTopicService.getTopic(AppType.WORKFLOW_JOB, wfj.getUser(), wfj.getId(), null));
WorkflowActionBean wab = addRecordToWfActionTable(wfj.getId(), "1", WorkflowAction.Status.RUNNING);
assertEquals(TOPIC_PREFIX + wfj.getId(), jmsTopicService.getTopic(wab.getId()));
assertEquals(TOPIC_PREFIX + wfj.getId(), jmsTopicService.getTopic(AppType.WORKFLOW_ACTION, wfj.getUser(), wab.getId(), wab.getWfId()));
CoordinatorJobBean cjb = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, true, true);
assertEquals(TOPIC_PREFIX + cjb.getId(), jmsTopicService.getTopic(cjb.getId()));
assertEquals(TOPIC_PREFIX + cjb.getId(), jmsTopicService.getTopic(AppType.COORDINATOR_JOB, cjb.getUser(), cjb.getId(), null));
CoordinatorActionBean cab = addRecordToCoordActionTable(cjb.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-for-action-input-check.xml", 0);
assertEquals(TOPIC_PREFIX + cjb.getId(), jmsTopicService.getTopic(cab.getId()));
assertEquals(TOPIC_PREFIX + cjb.getId(), jmsTopicService.getTopic(AppType.COORDINATOR_ACTION, cjb.getUser(), cab.getId(), cab.getJobId()));
BundleJobBean bjb = addRecordToBundleJobTable(Job.Status.RUNNING, true);
assertEquals(TOPIC_PREFIX + bjb.getId(), jmsTopicService.getTopic(bjb.getId()));
assertEquals(TOPIC_PREFIX + bjb.getId(), jmsTopicService.getTopic(AppType.BUNDLE_JOB, bjb.getUser(), bjb.getId(), null));
BundleActionBean bab = addRecordToBundleActionTable(bjb.getId(), "1", 1, Job.Status.RUNNING);
assertEquals(TOPIC_PREFIX + bjb.getId(), jmsTopicService.getTopic(bab.getBundleActionId()));
assertEquals(TOPIC_PREFIX + bjb.getId(), jmsTopicService.getTopic(AppType.BUNDLE_ACTION, bjb.getUser(), bab.getBundleActionId(), bab.getBundleId()));
}
use of org.apache.oozie.BundleActionBean in project oozie by apache.
the class TestJMSTopicService method testTopicAsUser.
@Test
public void testTopicAsUser() throws Exception {
services = setupServicesForTopic();
services.init();
JMSTopicService jmsTopicService = Services.get().get(JMSTopicService.class);
WorkflowJobBean wfj = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
assertEquals(wfj.getUser(), jmsTopicService.getTopic(wfj.getId()));
assertEquals(wfj.getUser(), jmsTopicService.getTopic(AppType.WORKFLOW_JOB, wfj.getUser(), wfj.getId(), null));
WorkflowActionBean wab = addRecordToWfActionTable(wfj.getId(), "1", WorkflowAction.Status.RUNNING);
assertEquals(wfj.getUser(), jmsTopicService.getTopic(wab.getId()));
assertEquals(wfj.getUser(), jmsTopicService.getTopic(AppType.WORKFLOW_ACTION, wfj.getUser(), wab.getId(), wab.getWfId()));
CoordinatorJobBean cjb = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, true, true);
assertEquals(cjb.getUser(), jmsTopicService.getTopic(cjb.getId()));
assertEquals(cjb.getUser(), jmsTopicService.getTopic(AppType.COORDINATOR_JOB, cjb.getUser(), cjb.getId(), null));
CoordinatorActionBean cab = addRecordToCoordActionTable(cjb.getId(), 1, CoordinatorAction.Status.SUCCEEDED, "coord-action-for-action-input-check.xml", 0);
assertEquals(cjb.getUser(), jmsTopicService.getTopic(cab.getId()));
assertEquals(cjb.getUser(), jmsTopicService.getTopic(AppType.COORDINATOR_ACTION, cjb.getUser(), cab.getId(), cab.getJobId()));
BundleJobBean bjb = addRecordToBundleJobTable(Job.Status.RUNNING, true);
assertEquals(bjb.getUser(), jmsTopicService.getTopic(bjb.getId()));
assertEquals(bjb.getUser(), jmsTopicService.getTopic(AppType.BUNDLE_JOB, bjb.getUser(), bjb.getId(), null));
BundleActionBean bab = addRecordToBundleActionTable(bjb.getId(), "1", 1, Job.Status.RUNNING);
assertEquals(bjb.getUser(), jmsTopicService.getTopic(bab.getBundleActionId()));
assertEquals(bjb.getUser(), jmsTopicService.getTopic(AppType.BUNDLE_ACTION, bjb.getUser(), bab.getBundleActionId(), bab.getBundleId()));
}
Aggregations