Package org.apache.oozie.client

Examples of org.apache.oozie.client.WorkflowAction


                this.appName = "testWorkflowActionAppName";
                this.appPath = "unused";
            }
        };

        WorkflowAction workflowAction = createWorkflowAction(dtObject);
        assertPrintWorkflowActionOutput(readWorkflowActionOutput(workflowAction, true), dtObject);
        assertPrintWorkflowActionOutput(readWorkflowActionOutput(workflowAction, false), dtObject);
    }
View Full Code Here


        WorkflowJob workflowJobMock = mock(WorkflowJob.class);
        when(workflowJobMock.getId()).thenReturn(dtObject.deamonName);
        when(workflowJobMock.getAppName()).thenReturn(dtObject.appName);
        when(workflowJobMock.getAppPath()).thenReturn(dtObject.appPath);
        when(workflowJobMock.getStatus()).thenReturn(WorkflowJob.Status.RUNNING);
        WorkflowAction ac = createWorkflowAction(dtObject);
        WorkflowAction ac0 = createWorkflowAction(dtObject);
        when(workflowJobMock.getActions()).thenReturn(Arrays.asList(ac, ac0));
        return workflowJobMock;
    }
View Full Code Here

        when(crdActionMock.getStatus()).thenReturn(CoordinatorAction.Status.SUBMITTED);
        return crdActionMock;
    }

    private static WorkflowAction createWorkflowAction(DataObject dtObject) {
        WorkflowAction workflowActionMock = mock(WorkflowAction.class);
        when(workflowActionMock.getId()).thenReturn(dtObject.deamonName);
        when(workflowActionMock.getName()).thenReturn(dtObject.appName);
        return workflowActionMock;
    }
View Full Code Here

        return array;
    }

    public void testParseWorkflowAction() {
        JSONObject json = createJsonWorkflowAction();
        WorkflowAction action = JsonToBean.createWorkflowAction(json);

        assertEquals("a", action.getId());
        assertEquals("b", action.getName());
        assertEquals("c", action.getType());
        assertEquals("d", action.getConf());
        assertEquals(WorkflowAction.Status.RUNNING, action.getStatus());
        assertEquals(1, action.getRetries());
        assertEquals(JsonUtils.parseDateRfc822(START_TIME), action.getStartTime());
        assertEquals(JsonUtils.parseDateRfc822(END_TIME), action.getEndTime());
        assertEquals("e", action.getTransition());
        assertEquals("ee", action.getData());
        assertEquals("f", action.getExternalId());
        assertEquals("g", action.getExternalStatus());
        assertEquals("h", action.getTrackerUri());
        assertEquals("i", action.getConsoleUrl());
        assertEquals("j", action.getErrorCode());
        assertEquals("k", action.getErrorMessage());
    }
View Full Code Here


    private RunningJob submitAction(Context context) throws Exception {
        SqoopActionExecutor ae = new SqoopActionExecutor();

        WorkflowAction action = context.getAction();

        ae.prepareActionDir(getFileSystem(), context);
        ae.submitLauncher(getFileSystem(), context, action);

        String jobId = action.getExternalId();
        String jobTracker = action.getTrackerUri();
        String consoleUrl = action.getConsoleUrl();
        assertNotNull(jobId);
        assertNotNull(jobTracker);
        assertNotNull(consoleUrl);
        Element e = XmlUtils.parseXml(action.getConf());
        Namespace ns = Namespace.getNamespace("uri:oozie:sqoop-action:0.1");
        XConfiguration conf = new XConfiguration(
                new StringReader(XmlUtils.prettyPrint(e.getChild("configuration", ns)).toString()));
        conf.set("mapred.job.tracker", e.getChildTextTrim("job-tracker", ns));
        conf.set("fs.default.name", e.getChildTextTrim("name-node", ns));
View Full Code Here

    }

    private RunningJob submitAction(Context context) throws Exception {
        PigActionExecutor ae = new PigActionExecutor();

        WorkflowAction action = context.getAction();

        ae.prepareActionDir(getFileSystem(), context);
        ae.submitLauncher(getFileSystem(), context, action);

        String jobId = action.getExternalId();
        String jobTracker = action.getTrackerUri();
        String consoleUrl = action.getConsoleUrl();
        assertNotNull(jobId);
        assertNotNull(jobTracker);
        assertNotNull(consoleUrl);

        Element e = XmlUtils.parseXml(action.getConf());
        XConfiguration conf =
                new XConfiguration(new StringReader(XmlUtils.prettyPrint(e.getChild("configuration")).toString()));
        conf.set("mapred.job.tracker", e.getChildTextTrim("job-tracker"));
        conf.set("fs.default.name", e.getChildTextTrim("name-node"));
        conf.set("mapreduce.framework.name", "yarn");
View Full Code Here

        evaluateLauncherJob(launcherJob);
        assertTrue(launcherJob.isSuccessful());
        assertTrue(LauncherMapperHelper.hasStatsData(launcherJob));

        PigActionExecutor ae = new PigActionExecutor();
        WorkflowAction wfAction = context.getAction();
        ae.check(context, wfAction);
        ae.end(context, wfAction);

        assertEquals("SUCCEEDED", wfAction.getExternalStatus());
        String stats = wfAction.getStats();
        assertNotNull(stats);
        // check for some of the expected key values in the stats
        Map m = (Map)JSONValue.parse(stats);
        // check for expected 1st level JSON keys
        assertTrue(m.containsKey("PIG_VERSION"));

        String expectedChildIDs = wfAction.getExternalChildIDs();
        String[] childIDs = expectedChildIDs.split(",");
        assertTrue(m.containsKey(childIDs[0]));

        Map q = (Map)m.get(childIDs[0]);
        // check for expected 2nd level JSON keys
View Full Code Here

        final RunningJob launcherJob = submitAction(context);
        evaluateLauncherJob(launcherJob);
        assertTrue(launcherJob.isSuccessful());

        PigActionExecutor ae = new PigActionExecutor();
        WorkflowAction wfAction = context.getAction();
        ae.check(context, wfAction);
        ae.end(context, wfAction);

        assertEquals("SUCCEEDED", wfAction.getExternalStatus());
        String externalIds = wfAction.getExternalChildIDs();
        assertNotNull(externalIds);
        assertNotSame("", externalIds);
        // check for the expected prefix of hadoop jobIDs
        assertTrue(externalIds.contains("job_"));
View Full Code Here

        final RunningJob launcherJob = submitAction(context);
        evaluateLauncherJob(launcherJob);
        assertTrue(launcherJob.isSuccessful());

        PigActionExecutor ae = new PigActionExecutor();
        WorkflowAction wfAction = context.getAction();
        ae.check(context, wfAction);
        ae.end(context, wfAction);

        // action should fail as the size of pig stats will always be greater
        // than 1 byte
        assertEquals("FAILED/KILLED", wfAction.getExternalStatus());
        assertNull(wfAction.getStats());
    }
View Full Code Here

        evaluateLauncherJob(launcherJob);
        assertTrue(launcherJob.isSuccessful());
        assertFalse(LauncherMapperHelper.hasStatsData(launcherJob));

        PigActionExecutor ae = new PigActionExecutor();
        WorkflowAction wfAction = context.getAction();
        ae.check(context, wfAction);
        ae.end(context, wfAction);

        assertEquals("SUCCEEDED", wfAction.getExternalStatus());
        assertNotNull(wfAction.getExternalChildIDs());
    }
View Full Code Here

TOP

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

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.