Search in sources :

Example 6 with PigActionExecutor

use of org.apache.oozie.action.hadoop.PigActionExecutor in project oozie by apache.

the class TestShareLibService method testLoadfromDFS.

@Test
public void testLoadfromDFS() throws Exception {
    services.init();
    FileSystem fs = getFileSystem();
    Date time = new Date(System.currentTimeMillis());
    Path basePath = new Path(getOozieConfig().get(WorkflowAppService.SYSTEM_LIB_PATH));
    Path libpath = new Path(basePath, ShareLibService.SHARE_LIB_PREFIX + ShareLibService.dateFormat.format(time));
    fs.mkdirs(libpath);
    Path pigPath = new Path(libpath.toString() + Path.SEPARATOR + "pig");
    Path ooziePath = new Path(libpath.toString() + Path.SEPARATOR + "oozie");
    Path pigPath1 = new Path(libpath.toString() + Path.SEPARATOR + "pig_9");
    Path pigPath2 = new Path(libpath.toString() + Path.SEPARATOR + "pig_10");
    fs.mkdirs(pigPath);
    fs.mkdirs(ooziePath);
    fs.mkdirs(pigPath1);
    fs.mkdirs(pigPath2);
    createFiles(libpath.toString() + Path.SEPARATOR + "pig_10" + Path.SEPARATOR + "pig-10.jar");
    createFiles(libpath.toString() + Path.SEPARATOR + "oozie" + Path.SEPARATOR + "oozie_luncher.jar");
    String actionXml = "<pig>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<property><name>oozie.action.sharelib.for.pig</name><value>pig_10</value></property>" + "</pig>";
    Element eActionXml = XmlUtils.parseXml(actionXml);
    XConfiguration protoConf = new XConfiguration();
    protoConf.set(WorkflowAppService.HADOOP_USER, getTestUser());
    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);
    verifyFilesInDistributedCache(DistributedCache.getCacheFiles(jobConf), "pig-10.jar", "oozie_luncher.jar");
}
Also used : Path(org.apache.hadoop.fs.Path) Context(org.apache.oozie.action.hadoop.ActionExecutorTestCase.Context) XConfiguration(org.apache.oozie.util.XConfiguration) XConfiguration(org.apache.oozie.util.XConfiguration) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) LocalFileSystem(org.apache.hadoop.fs.LocalFileSystem) Element(org.jdom.Element) TestJavaActionExecutor(org.apache.oozie.action.hadoop.TestJavaActionExecutor) WorkflowJobBean(org.apache.oozie.WorkflowJobBean) Date(java.util.Date) WorkflowActionBean(org.apache.oozie.WorkflowActionBean) PigActionExecutor(org.apache.oozie.action.hadoop.PigActionExecutor) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)6 Path (org.apache.hadoop.fs.Path)6 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)6 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)6 Context (org.apache.oozie.action.hadoop.ActionExecutorTestCase.Context)6 PigActionExecutor (org.apache.oozie.action.hadoop.PigActionExecutor)6 TestJavaActionExecutor (org.apache.oozie.action.hadoop.TestJavaActionExecutor)6 XConfiguration (org.apache.oozie.util.XConfiguration)6 Element (org.jdom.Element)6 Test (org.junit.Test)5 Date (java.util.Date)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 LocalFileSystem (org.apache.hadoop.fs.LocalFileSystem)2 URI (java.net.URI)1 Properties (java.util.Properties)1