use of org.apache.oozie.service.CallableQueueService in project oozie by apache.
the class TestCoordActionInputCheckXCommand method testCoordActionInputCheckXCommandUniqueness.
public void testCoordActionInputCheckXCommandUniqueness() throws Exception {
Date startTime = DateUtils.parseDateOozieTZ("2009-02-01T23:59" + TZ);
Date endTime = DateUtils.parseDateOozieTZ("2009-02-02T23:59" + TZ);
CoordinatorJobBean job = addRecordToCoordJobTableForWaiting("coord-job-for-action-input-check.xml", CoordinatorJob.Status.RUNNING, startTime, endTime, false, true, 3);
CoordinatorActionBean action1 = addRecordToCoordActionTableForWaiting(job.getId(), 1, CoordinatorAction.Status.WAITING, "coord-action-for-action-input-check.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("/"));
final MyCoordActionInputCheckXCommand callable1 = new MyCoordActionInputCheckXCommand(action1.getId(), 100, "1");
final MyCoordActionInputCheckXCommand callable2 = new MyCoordActionInputCheckXCommand(action1.getId(), 100, "2");
final MyCoordActionInputCheckXCommand callable3 = new MyCoordActionInputCheckXCommand(action1.getId(), 100, "3");
List<MyCoordActionInputCheckXCommand> callables = Arrays.asList(callable1, callable2, callable3);
CallableQueueService queueservice = services.get(CallableQueueService.class);
for (MyCoordActionInputCheckXCommand c : callables) {
queueservice.queue(c);
}
waitFor(200, new Predicate() {
public boolean evaluate() throws Exception {
return callable1.executed != 0 && callable2.executed == 0 && callable3.executed == 0;
}
});
assertTrue(callable1.executed != 0);
assertTrue(callable2.executed == 0);
assertTrue(callable3.executed == 0);
}
Aggregations