use of org.apache.oozie.BulkResponseInfo in project oozie by apache.
the class ZKUUIDServiceWithException method testBulkJobForZKUUIDService.
public void testBulkJobForZKUUIDService() throws Exception {
Services service = Services.get();
ZKUUIDService uuid = new ZKUUIDService();
try {
setSystemProperty(UUIDService.CONF_GENERATOR, "counter");
uuid.init(service);
String bundleId = uuid.generateId(ApplicationType.BUNDLE);
BundleJobBean bundle = createBundleJob(bundleId, Job.Status.SUCCEEDED, false);
JPAService jpaService = Services.get().get(JPAService.class);
BundleJobInsertJPAExecutor bundleInsertjpa = new BundleJobInsertJPAExecutor(bundle);
jpaService.execute(bundleInsertjpa);
addCoordForBulkMonitor(bundleId);
String request = "bundle=" + bundleId;
BulkJPAExecutor bulkjpa = new BulkJPAExecutor(BundleEngine.parseBulkFilter(request), 1, 1);
try {
BulkResponseInfo response = jpaService.execute(bulkjpa);
assertEquals(response.getResponses().get(0).getBundle().getId(), bundleId);
} catch (JPAExecutorException jex) {
// should not throw exception as this case is now supported
fail();
}
} finally {
uuid.destroy();
}
}
use of org.apache.oozie.BulkResponseInfo in project oozie by apache.
the class TestBulkMonitorJPAExecutor method _execQuery.
private BulkResponseInfo _execQuery(String request) throws JPAExecutorException, BundleEngineException {
BulkJPAExecutor bulkjpa = new BulkJPAExecutor(BundleEngine.parseBulkFilter(request), 1, 10);
BulkResponseInfo response = jpaService.execute(bulkjpa);
assertNotNull(response);
return response;
}
use of org.apache.oozie.BulkResponseInfo in project oozie by apache.
the class TestBulkMonitorJPAExecutor method testBundleId.
public void testBundleId() throws Exception {
String request = "bundle=" + bundleId + ";actionstatus=FAILED;" + "startcreatedtime=2012-07-21T00:00Z;endcreatedtime=2012-07-22T02:00Z";
BulkResponseInfo response = _execQuery(request);
List<BulkResponseImpl> brList = response.getResponses();
// only 1 action satisfies the
assertEquals(1, brList.size());
// conditions
assertEquals(1, response.getTotal());
BulkResponseImpl br = brList.get(0);
assertEquals(bundleId, br.getBundle().getId());
assertEquals("Coord1", br.getCoordinator().getAppName());
assertEquals(CoordinatorAction.Status.FAILED, br.getAction().getStatus());
assertEquals(DateUtils.parseDateUTC(CREATE_TIME).toString(), br.getAction().getCreatedTime().toString());
}
use of org.apache.oozie.BulkResponseInfo in project oozie by apache.
the class TestBulkMonitorJPAExecutor method testSingleRecord.
public void testSingleRecord() throws Exception {
String request = "bundle=" + bundleName + ";actionstatus=FAILED;" + "startcreatedtime=2012-07-21T00:00Z;endcreatedtime=2012-07-22T02:00Z;" + "startscheduledtime=2012-07-20T23:00Z;endscheduledtime=2012-07-22T03:00Z";
BulkResponseInfo response = _execQuery(request);
List<BulkResponseImpl> brList = response.getResponses();
// only 1 action satisfies the
assertEquals(1, brList.size());
// conditions
assertEquals(1, response.getTotal());
BulkResponseImpl br = brList.get(0);
assertEquals(bundleName, br.getBundle().getAppName());
assertEquals("Coord1", br.getCoordinator().getAppName());
assertEquals(CoordinatorAction.Status.FAILED, br.getAction().getStatus());
assertEquals(DateUtils.parseDateUTC(CREATE_TIME).toString(), br.getAction().getCreatedTime().toString());
}
use of org.apache.oozie.BulkResponseInfo in project oozie by apache.
the class TestBulkMonitorJPAExecutor method testMultipleCoordinators.
public void testMultipleCoordinators() throws Exception {
// there are 3 coordinators but giving range as only two of them
String request = "bundle=" + bundleName + ";coordinators=Coord1,Coord2;actionstatus=KILLED";
BulkResponseInfo response = _execQuery(request);
List<BulkResponseImpl> brList = response.getResponses();
// 2 actions satisfy the conditions
assertEquals(2, brList.size());
assertEquals(2, response.getTotal());
assertEquals(brList.get(0).getAction().getId(), "Coord1@2");
assertEquals(brList.get(1).getAction().getId(), "Coord2@1");
}
Aggregations