use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestBulkCoordXCommand method testBulkCoordResumeNegative.
public void testBulkCoordResumeNegative() throws Exception {
String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
Date start = DateUtils.parseDateOozieTZ(currentDatePlusMonth);
Date end = DateUtils.parseDateOozieTZ(currentDatePlusMonth);
CoordinatorJobBean job1 = addRecordToCoordJobTable(CoordinatorJob.Status.SUSPENDED, start, end, false, false, 0);
CoordinatorActionBean action1 = addRecordToCoordActionTable(job1.getId(), 1, CoordinatorAction.Status.SUSPENDED, "coord-action-get.xml", 0);
Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> names = new ArrayList<String>();
names.add("COORD");
map.put("name", names);
new BulkCoordXCommand(map, 1, 50, OperationType.Resume).call();
List<String> jobIds = new ArrayList<String>();
jobIds.add(job1.getId());
List<String> actionIds = new ArrayList<String>();
actionIds.add(action1.getId());
verifyJobsStatus(jobIds, CoordinatorJob.Status.SUSPENDED);
verifyActionsStatus(actionIds, CoordinatorAction.Status.SUSPENDED);
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestBulkCoordXCommand method verifyActionsStatus.
private void verifyActionsStatus(List<String> actionIds, CoordinatorAction.Status status) throws Exception {
for (String id : actionIds) {
CoordinatorActionBean action = CoordActionQueryExecutor.getInstance().get(CoordActionQueryExecutor.CoordActionQuery.GET_COORD_ACTION, id);
assertEquals(status, action.getStatus());
}
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestCoordActionInputCheckXCommand method testExceptionOnInvalidElFunction.
public void testExceptionOnInvalidElFunction() {
try {
CoordinatorJobBean job = addRecordToCoordJobTableForWaiting("coord-hdfsinput-invalid-elfunction.xml", CoordinatorJob.Status.RUNNING, false, true);
CoordinatorActionBean action = addRecordToCoordActionTableForWaiting(job.getId(), 1, CoordinatorAction.Status.WAITING, "coord-hdfsinput-invalid-elfunction.xml");
createTestCaseSubDir("2009/01/29/_SUCCESS".split("/"));
createTestCaseSubDir("2009/01/22/_SUCCESS".split("/"));
createTestCaseSubDir("2009/01/15/_SUCCESS".split("/"));
createTestCaseSubDir("2009/01/08/_SUCCESS".split("/"));
sleep(3000);
final String actionId = action.getId();
try {
new CoordActionInputCheckXCommand(action.getId(), job.getId()).call();
waitFor(6000, new Predicate() {
@Override
public boolean evaluate() throws Exception {
CoordinatorActionBean action = CoordActionQueryExecutor.getInstance().get(CoordActionQueryExecutor.CoordActionQuery.GET_COORD_ACTION, actionId);
return action.getStatus() == CoordinatorAction.Status.FAILED;
}
});
fail("Should throw an exception");
} catch (Exception e) {
assertTrue(e.getMessage().contains("Coord Action Input Check Error"));
}
} catch (Exception e) {
e.printStackTrace(System.out);
fail("Unexpected exception");
}
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestCoordActionInputCheckXCommand method testActionInputCheck.
public void testActionInputCheck() throws Exception {
String jobId = "0000000-" + new Date().getTime() + "-TestCoordActionInputCheckXCommand-C";
Date startTime = DateUtils.parseDateOozieTZ("2009-02-01T23:59" + TZ);
Date endTime = DateUtils.parseDateOozieTZ("2009-02-02T23:59" + TZ);
CoordinatorJobBean job = addRecordToCoordJobTable(jobId, startTime, endTime);
new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
createTestCaseSubDir("2009/02/05/_SUCCESS".split("/"));
createTestCaseSubDir("2009/01/15/_SUCCESS".split("/"));
new CoordActionInputCheckXCommand(job.getId() + "@1", job.getId()).call();
JPAService jpaService = Services.get().get(JPAService.class);
CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(job.getId() + "@1"));
System.out.println("missingDeps " + action.getMissingDependencies() + " Xml " + action.getActionXml());
if (action.getMissingDependencies().indexOf("/2009/02/05/") >= 0) {
fail("directory should be resolved :" + action.getMissingDependencies());
}
if (action.getMissingDependencies().indexOf("/2009/01/15/") < 0) {
fail("directory should NOT be resolved :" + action.getMissingDependencies());
}
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestCoordActionInputCheckXCommand method testHarFileInputCheck.
public void testHarFileInputCheck() throws Exception {
CoordinatorJobBean job = addRecordToCoordJobTableForWaiting("coord-job-for-action-input-check.xml", CoordinatorJob.Status.RUNNING, false, true);
String pathName = createTestCaseSubDir("2009/01/29".split("/"));
CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQueryExecutor.CoordJobQuery.UPDATE_COORD_JOB, job);
String missingDeps = "file://" + pathName + CoordELFunctions.INSTANCE_SEPARATOR + "har:///dirx/archive.har/data";
String actionId1 = addInitRecords(missingDeps, null, TZ, job, 1);
new CoordActionInputCheckXCommand(actionId1, job.getId()).call();
CoordinatorActionBean coordAction = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, actionId1);
// the directory (2009/01/29) exists and successfully removed from
// missing dependency of the coord action
assertEquals(coordAction.getMissingDependencies(), "har:///dirx/archive.har/data");
}
Aggregations