Package org.apache.oozie.action.hadoop.ActionExecutorTestCase

Examples of org.apache.oozie.action.hadoop.ActionExecutorTestCase.Context


                "<job-xml>job.xml</job-xml>" + "<job-xml>job2.xml</job-xml>" + "<configuration>" +
                "<property><name>oozie.launcher.oozie.libpath</name><value>" + actionLibPath + "</value></property>" +
                "</configuration>" + "<main-class>MAIN-CLASS</main-class>" +
                "</java>";
        Element eActionXml = XmlUtils.parseXml(actionXml);
        Context context = createContext(actionXml, null);
       
        JavaActionExecutor ae = new JavaActionExecutor();

        Configuration jobConf = ae.createBaseHadoopConf(context, eActionXml);
        ae.setupLauncherConf(jobConf, eActionXml, getAppPath(), context);
View Full Code Here


        };
        String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>"
                + getNameNodeUri() + "</name-node>" + "<main-class>" + LauncherMainTester.class.getName()
                + "</main-class>" + "</java>";
        Element eActionXml = XmlUtils.parseXml(actionXml);
        Context context = createContext(actionXml, null);

        // Set sharelib to a relative path (i.e. no scheme nor authority)
        Services.get().destroy();
        setSystemProperty(WorkflowAppService.SYSTEM_LIB_PATH, "/user/" + getOozieUser() + "/share/");
        new Services().init();
View Full Code Here

            XConfiguration protoConf = new XConfiguration();
            protoConf.set(WorkflowAppService.HADOOP_USER, getTestUser());
            WorkflowJobBean wfj = new WorkflowJobBean();
            wfj.setProtoActionConf(XmlUtils.prettyPrint(protoConf).toString());
            wfj.setConf(XmlUtils.prettyPrint(new XConfiguration()).toString());
            Context context = new TestJavaActionExecutor().new Context(wfj, new WorkflowActionBean());
            PigActionExecutor ae = new PigActionExecutor();
            Configuration jobConf = ae.createBaseHadoopConf(context, eActionXml);
            ae.setLibFilesArchives(context, eActionXml, new Path("hdfs://dummyAppPath"), jobConf);

            URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf);
View Full Code Here

            XConfiguration protoConf = new XConfiguration();
            protoConf.set(WorkflowAppService.HADOOP_USER, getTestUser());
            WorkflowJobBean wfj = new WorkflowJobBean();
            wfj.setProtoActionConf(XmlUtils.prettyPrint(protoConf).toString());
            wfj.setConf(XmlUtils.prettyPrint(new XConfiguration()).toString());
            Context context = new TestJavaActionExecutor().new Context(wfj, new WorkflowActionBean());
            PigActionExecutor ae = new PigActionExecutor();
            Configuration jobConf = ae.createBaseHadoopConf(context, eActionXml);
            ae.setLibFilesArchives(context, eActionXml, new Path("hdfs://dummyAppPath"), jobConf);

            URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf);
View Full Code Here

            WorkflowJobBean wfj = new WorkflowJobBean();
            protoConf.setBoolean(OozieClient.USE_SYSTEM_LIBPATH, true);
            wfj.setProtoActionConf(XmlUtils.prettyPrint(protoConf).toString());
            wfj.setConf(XmlUtils.prettyPrint(protoConf).toString());

            Context context = new TestJavaActionExecutor().new Context(wfj, new WorkflowActionBean());
            PigActionExecutor ae = new PigActionExecutor();
            Configuration jobConf = ae.createBaseHadoopConf(context, eActionXml);
            jobConf.set("oozie.action.sharelib.for.pig", "pig_10");
            ae.setLibFilesArchives(context, eActionXml, new Path("hdfs://dummyAppPath"), jobConf);
View Full Code Here

            WorkflowJobBean wfj = new WorkflowJobBean();
            protoConf.setBoolean(OozieClient.USE_SYSTEM_LIBPATH, true);
            wfj.setProtoActionConf(XmlUtils.prettyPrint(protoConf).toString());
            wfj.setConf(XmlUtils.prettyPrint(protoConf).toString());

            Context context = new TestJavaActionExecutor().new Context(wfj, new WorkflowActionBean());
            PigActionExecutor ae = new PigActionExecutor();
            Configuration jobConf = ae.createBaseHadoopConf(context, eActionXml);
            jobConf.set("oozie.action.sharelib.for.pig", "pig_10");
            ae.setLibFilesArchives(context, eActionXml, new Path("hdfs://dummyAppPath"), jobConf);
            URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf);
View Full Code Here

        WorkflowJobBean wf = createBaseWorkflow(protoConf, "pig-action");
        WorkflowActionBean action = (WorkflowActionBean) wf.getActions().get(0);
        action.setType(ae.getType());

        Context context = new Context(wf, action);

        Configuration conf = ae.createBaseHadoopConf(context, actionXml);
        ae.setupActionConf(conf, context, actionXml, getFsTestCaseDir());
        assertEquals("SCRIPT", conf.get("oozie.pig.script"));
        assertEquals("2", conf.get("oozie.pig.params.size"));
View Full Code Here

        WorkflowJobBean wf = createBaseWorkflow(protoConf, "pig-action");
        WorkflowActionBean action = (WorkflowActionBean) wf.getActions().get(0);
        action.setType(ae.getType());
        action.setConf(actionXml);

        return new Context(wf, action);
    }
View Full Code Here

        return runningJob;
    }

    private void _testSubmit(String actionXml, boolean checkForSuccess) throws Exception {

        Context context = createContext(actionXml);
        final RunningJob launcherJob = submitAction(context);
        String launcherId = context.getAction().getExternalId();
        evaluateLauncherJob(launcherJob);
        assertTrue(launcherJob.isSuccessful());

        sleep(2000);
        assertFalse(LauncherMapperHelper.hasIdSwap(launcherJob));
        if (checkForSuccess) {
            assertTrue(LauncherMapperHelper.hasStatsData(launcherJob));
        }

        PigActionExecutor ae = new PigActionExecutor();
        ae.check(context, context.getAction());
        ae.end(context, context.getAction());
        assertTrue(launcherId.equals(context.getAction().getExternalId()));
        if (checkForSuccess) {
            assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
            assertNull(context.getAction().getData());

        }
        else {
            assertEquals("FAILED/KILLED", context.getAction().getExternalStatus());
            assertNotNull(context.getAction().getErrorMessage());
        }
        if (checkForSuccess) {
            assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
        }
        else {
            assertEquals(WorkflowAction.Status.ERROR, context.getAction().getStatus());
        }
    }
View Full Code Here

     * Test the stats retrieved from a Pig job
     */
    public void testExecutionStats() throws Exception {
        // Set the action xml with the option for retrieving stats to true
        String actionXml = setPigActionXml(PIG_SCRIPT, true);
        Context context = createContext(actionXml);
        final RunningJob launcherJob = submitAction(context);
        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();
View Full Code Here

TOP

Related Classes of org.apache.oozie.action.hadoop.ActionExecutorTestCase.Context

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.