Package org.apache.oozie.client

Examples of org.apache.oozie.client.CoordinatorAction


            }
        });

        List<CoordinatorAction> actions = ce.getCoordJob(jobId).getActions();
        assertTrue(actions.size() > 0);
        CoordinatorAction action = actions.get(0);
        System.out.println("status=" + action.getStatus());
        String missingDeps = action.getMissingDependencies();
        System.out.println("..Missing deps=" + missingDeps);
        if (!(missingDeps == null || missingDeps.equals(""))) {
            fail();
        }
    }
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    public void testParseCoordinatorAction() {
        JSONObject json = createJsonCoordinatorAction();
        CoordinatorAction action = JsonToBean.createCoordinatorAction(json);

        assertEquals("a", action.getId());
        assertEquals("b", action.getJobId());
        assertEquals(1, action.getActionNumber());
        assertEquals("c", action.getCreatedConf());
        assertEquals(JsonUtils.parseDateRfc822(CREATED_TIME), action.getCreatedTime());
        assertEquals(JsonUtils.parseDateRfc822(NOMINAL_TIME), action.getNominalTime());
        assertEquals("d", action.getExternalId());
        assertEquals(CoordinatorAction.Status.DISCARDED, action.getStatus());
        assertEquals("e", action.getRunConf());
        assertEquals(JsonUtils.parseDateRfc822(LAST_MODIFIED), action.getLastModifiedTime());
        assertEquals("f", action.getMissingDependencies());
        assertEquals("g", action.getExternalStatus());
        assertEquals("h", action.getTrackerUri());
        assertEquals("i", action.getConsoleUrl());
        assertEquals("j", action.getErrorCode());
        assertEquals("k", action.getErrorMessage());
    }
View Full Code Here

    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 {
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void testParseCoordinatorAction() {
        JSONObject json = createJsonCoordinatorAction();
        CoordinatorAction action = JsonToBean.createCoordinatorAction(json);

        assertEquals("a", action.getId());
        assertEquals("b", action.getJobId());
        assertEquals(1, action.getActionNumber());
        assertEquals("c", action.getCreatedConf());
        assertEquals(JsonUtils.parseDateRfc822(CREATED_TIME), action.getCreatedTime());
        assertEquals(JsonUtils.parseDateRfc822(NOMINAL_TIME), action.getNominalTime());
        assertEquals("d", action.getExternalId());
        assertEquals(CoordinatorAction.Status.IGNORED, action.getStatus());
        assertEquals("e", action.getRunConf());
        assertEquals(JsonUtils.parseDateRfc822(LAST_MODIFIED), action.getLastModifiedTime());
        assertEquals("f", action.getMissingDependencies());
        assertEquals("ff", action.getPushMissingDependencies());
        assertEquals("g", action.getExternalStatus());
        assertEquals("h", action.getTrackerUri());
        assertEquals("i", action.getConsoleUrl());
        assertEquals("j", action.getErrorCode());
        assertEquals("k", action.getErrorMessage());
    }
View Full Code Here

    public void testParseBulkResponse() {
        JSONObject json = createJsonBulkResponse();

        BundleJob bulkBundle = JsonToBean.createBundleJob((JSONObject) json.get(JsonTags.BULK_RESPONSE_BUNDLE));
        CoordinatorJob bulkCoord = JsonToBean.createCoordinatorJob((JSONObject) json.get(JsonTags.BULK_RESPONSE_COORDINATOR));
        CoordinatorAction bulkAction = JsonToBean.createCoordinatorAction((JSONObject) json.get(JsonTags.BULK_RESPONSE_ACTION));

        assertNotNull(bulkBundle);
        assertNotNull(bulkCoord);
        assertNotNull(bulkAction);
        assertEquals("bundle-app", bulkBundle.getAppName());
        assertEquals("bundle-id", bulkBundle.getId());
        assertEquals(BundleJob.Status.RUNNING, bulkBundle.getStatus());
        assertEquals("coord-app", bulkCoord.getAppName());
        assertEquals(CoordinatorJob.Status.SUSPENDED, bulkCoord.getStatus());
        assertEquals("action-id", bulkAction.getId());
        assertEquals("coord-id", bulkAction.getJobId());
        assertEquals(1, bulkAction.getActionNumber());
        assertEquals("action-externalId", bulkAction.getExternalId());
        assertEquals(CoordinatorAction.Status.FAILED, bulkAction.getStatus());
        assertEquals("action-externalStatus", bulkAction.getExternalStatus());
        assertEquals("action-errorCode", bulkAction.getErrorCode());
        assertEquals("action-errorMessage", bulkAction.getErrorMessage());
        assertEquals(JsonUtils.parseDateRfc822(CREATED_TIME), bulkAction.getCreatedTime());
        assertEquals(JsonUtils.parseDateRfc822(NOMINAL_TIME), bulkAction.getNominalTime());
        assertEquals("action-missingDeps", bulkAction.getMissingDependencies());
    }
View Full Code Here

                this.appName = "testCoordinatorJobApp";
                this.appPath = "testCoordinatorJobAppPath";
            }
        };

        CoordinatorAction coordinatorAction = createCoordinatorAction(dtObject);
        assertPrintCoordActionOutput(readCoordAction(coordinatorAction), dtObject);
    }
View Full Code Here

        when(workflowJobMock.getActions()).thenReturn(Arrays.asList(ac, ac0));
        return workflowJobMock;
    }

    private static CoordinatorAction createCoordinatorAction(DataObject dtObject) {
        CoordinatorAction crdActionMock = mock(CoordinatorAction.class);
        when(crdActionMock.getId()).thenReturn(dtObject.deamonName);
        when(crdActionMock.getJobId()).thenReturn(dtObject.appName);
        when(crdActionMock.getActionNumber()).thenReturn(11);
        when(crdActionMock.getStatus()).thenReturn(CoordinatorAction.Status.SUBMITTED);
        return crdActionMock;
    }
View Full Code Here

        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;
View Full Code Here

        final String actionId = jobId + "@" + actionNum;
        final OozieClient coordClient = LocalOozie.getCoordClient();
        waitFor(120 * 1000, new Predicate() {
            @Override
            public boolean evaluate() throws Exception {
                CoordinatorAction bean = coordClient.getCoordActionInfo(actionId);
                return (bean.getStatus() == CoordinatorAction.Status.WAITING || bean.getStatus() == CoordinatorAction.Status.SUBMITTED);
            }
        });
        CoordinatorAction bean = coordClient.getCoordActionInfo(actionId);
        assertEquals(bean.getMissingDependencies(), "!!${coord:latest(0)}#${coord:latest(-1)}");
        CoordinatorJobBean job = getCoordJobs(jobId);
        Reader reader = IOUtils.getResourceAsReader("coord-multiple-input-instance4.xml", -1);
        Writer writer = new FileWriter(appPathFile1);
        IOUtils.copyCharStream(reader, writer);
        conf.set(OozieClient.COORDINATOR_APP_PATH, appPathFile1.toURI().toString());
        new CoordUpdateXCommand(false, conf, jobId).call();
        job = getCoordJobs(jobId);
        Element processedJobXml = XmlUtils.parseXml(job.getJobXml());
        Namespace namespace = processedJobXml.getNamespace();
        String text = ((Element) processedJobXml.getChild("input-events", namespace).getChild("data-in", namespace)
                .getChildren("instance", namespace).get(0)).getText();
        assertEquals(text, "${coord:future(0, 1)}");
        new CoordActionsKillXCommand(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum)).call();
        coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum), true, true);
        bean = coordClient.getCoordActionInfo(actionId);
        sleep(1000);
        assertEquals(bean.getMissingDependencies(), "!!${coord:future(0, 1)}");
    }
View Full Code Here

            }
        });

        List<CoordinatorAction> actions = ce.getCoordJob(jobId).getActions();
        assertTrue(actions.size() > 0);
        CoordinatorAction action = actions.get(0);
        String missingDeps = action.getMissingDependencies();
        System.out.println("Missing deps=" + missingDeps);
        //done flag is not added to the missing dependency list
        assertEquals(getTestCaseFileUri("workflows/2009/01/_SUCCESS"), missingDeps);
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.client.CoordinatorAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.