Search in sources :

Example 1 with BulkResponse

use of org.apache.oozie.client.BulkResponse in project oozie by apache.

the class TestJsonToBean method testParseBulkResponseList.

public void testParseBulkResponseList() {
    JSONArray array = createJsonBulkResponseList();
    List<BulkResponse> list = JsonToBean.createBulkResponseList(array);
    assertEquals(2, list.size());
    assertEquals("cj1", list.get(0).getCoordinator().getId());
    assertEquals("cj2", list.get(1).getCoordinator().getId());
}
Also used : JSONArray(org.json.simple.JSONArray) BulkResponse(org.apache.oozie.client.BulkResponse)

Example 2 with BulkResponse

use of org.apache.oozie.client.BulkResponse in project oozie by apache.

the class OozieCLI method printBulkJobs.

@VisibleForTesting
void printBulkJobs(List<BulkResponse> jobs, String timeZoneId, boolean verbose) throws IOException {
    if (jobs != null && jobs.size() > 0) {
        for (BulkResponse response : jobs) {
            BundleJob bundle = response.getBundle();
            CoordinatorJob coord = response.getCoordinator();
            CoordinatorAction action = response.getAction();
            if (verbose) {
                System.out.println();
                System.out.println("Bundle Name : " + maskIfNull(bundle.getAppName()));
                System.out.println(RULER);
                System.out.println("Bundle ID        : " + maskIfNull(bundle.getId()));
                System.out.println("Coordinator Name : " + maskIfNull(coord.getAppName()));
                System.out.println("Coord Action ID  : " + maskIfNull(action.getId()));
                System.out.println("Action Status    : " + action.getStatus());
                System.out.println("External ID      : " + maskIfNull(action.getExternalId()));
                System.out.println("Created Time     : " + maskDate(action.getCreatedTime(), timeZoneId, false));
                System.out.println("User             : " + maskIfNull(bundle.getUser()));
                System.out.println("Error Message    : " + maskIfNull(action.getErrorMessage()));
                System.out.println(RULER);
            } else {
                System.out.println(String.format(BULK_RESPONSE_FORMATTER, "Bundle Name", "Bundle ID", "Coord Name", "Coord Action ID", "Status", "External ID", "Created Time", "Error Message"));
                System.out.println(RULER);
                System.out.println(String.format(BULK_RESPONSE_FORMATTER, maskIfNull(bundle.getAppName()), maskIfNull(bundle.getId()), maskIfNull(coord.getAppName()), maskIfNull(action.getId()), action.getStatus(), maskIfNull(action.getExternalId()), maskDate(action.getCreatedTime(), timeZoneId, false), maskIfNull(action.getErrorMessage())));
                System.out.println(RULER);
            }
        }
    } else {
        System.out.println("Bulk request criteria did not match any coordinator actions");
    }
}
Also used : CoordinatorJob(org.apache.oozie.client.CoordinatorJob) CoordinatorAction(org.apache.oozie.client.CoordinatorAction) BulkResponse(org.apache.oozie.client.BulkResponse) BundleJob(org.apache.oozie.client.BundleJob) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 3 with BulkResponse

use of org.apache.oozie.client.BulkResponse in project oozie by apache.

the class TestOozieCLIMethods method createBulkResponse.

private static BulkResponse createBulkResponse(DataObject dtObject) {
    BulkResponse bulkResponse = mock(BulkResponse.class);
    BundleJob bundleJob = createBundleJob(dtObject);
    when(bulkResponse.getBundle()).thenReturn(bundleJob);
    CoordinatorAction coordinatorAction = createCoordinatorAction(dtObject);
    when(bulkResponse.getAction()).thenReturn(coordinatorAction);
    CoordinatorJob coordinatorJob = createCoordinatorJob(dtObject);
    when(bulkResponse.getCoordinator()).thenReturn(coordinatorJob);
    return bulkResponse;
}
Also used : CoordinatorJob(org.apache.oozie.client.CoordinatorJob) CoordinatorAction(org.apache.oozie.client.CoordinatorAction) BulkResponse(org.apache.oozie.client.BulkResponse) BundleJob(org.apache.oozie.client.BundleJob)

Aggregations

BulkResponse (org.apache.oozie.client.BulkResponse)3 BundleJob (org.apache.oozie.client.BundleJob)2 CoordinatorAction (org.apache.oozie.client.CoordinatorAction)2 CoordinatorJob (org.apache.oozie.client.CoordinatorJob)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 JSONArray (org.json.simple.JSONArray)1