Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Closes OOZIE-135 support multiple shared lib path in oozie

  • Loading branch information...
commit 575d71c7d7f9467479a89fe6bdf53bb08046c084 1 parent c16779a
Chao Wang authored Mohammad Kamrul Islam committed
View
17 core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
@@ -175,15 +175,20 @@ public XConfiguration createProtoActionConf(Configuration jobConf, String authTo
filePaths = new ArrayList<String>();
}
- if (jobConf.get(OozieClient.LIBPATH) != null) {
- Path libPath = new Path(jobConf.get(OozieClient.LIBPATH));
- List<String> libPaths = getLibFiles(fs, libPath);
- filePaths.addAll(libPaths);
+ String[] libPaths = jobConf.getStrings(OozieClient.LIBPATH);
+ if (libPaths != null && libPaths.length > 0) {
+ for (int i = 0; i < libPaths.length; i++) {
+ if (libPaths[i].trim().length() > 0) {
+ Path libPath = new Path(libPaths[i].trim());
+ List<String> libFilePaths = getLibFiles(fs, libPath);
+ filePaths.addAll(libFilePaths);
+ }
+ }
}
if (systemLibPath != null && jobConf.getBoolean(OozieClient.USE_SYSTEM_LIBPATH, false)) {
- List<String> libPaths = getLibFiles(fs, systemLibPath);
- filePaths.addAll(libPaths);
+ List<String> libFilePaths = getLibFiles(fs, systemLibPath);
+ filePaths.addAll(libFilePaths);
}
conf.setStrings(APP_LIB_PATH_LIST, filePaths.toArray(new String[filePaths.size()]));
View
67 core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
@@ -351,6 +351,73 @@ public void testCreateprotoConfWithLibPath() throws Exception {
services.destroy();
}
}
+
+ public void testCreateprotoConfWithMulipleLibPath() throws Exception {
+ Services services = new Services();
+ try {
+ services.init();
+ Reader reader = IOUtils.getResourceAsReader("wf-schema-valid.xml", -1);
+ Writer writer = new FileWriter(getTestCaseDir() + "/workflow.xml");
+ IOUtils.copyCharStream(reader, writer);
+
+ createTestCaseSubDir("lib");
+ writer = new FileWriter(getTestCaseDir() + "/lib/maputil.jar");
+ writer.write("bla bla");
+ writer.close();
+ writer = new FileWriter(getTestCaseDir() + "/lib/reduceutil.so");
+ writer.write("bla bla");
+ writer.close();
+ createTestCaseSubDir("libx");
+ writer = new FileWriter(getTestCaseDir() + "/libx/maputil_x.jar");
+ writer.write("bla bla");
+ writer.close();
+ createTestCaseSubDir("liby");
+ writer = new FileWriter(getTestCaseDir() + "/liby/maputil_y1.jar");
+ writer.write("bla bla");
+ writer.close();
+ writer = new FileWriter(getTestCaseDir() + "/liby/maputil_y2.jar");
+ writer.write("bla bla");
+ writer.close();
+ createTestCaseSubDir("libz");
+ writer = new FileWriter(getTestCaseDir() + "/libz/maputil_z.jar");
+ writer.write("bla bla");
+ writer.close();
+
+ WorkflowAppService wps = Services.get().get(WorkflowAppService.class);
+ Configuration jobConf = new XConfiguration();
+ jobConf.set(OozieClient.APP_PATH, "file://" + getTestCaseDir() + "/workflow.xml");
+ jobConf.setStrings(OozieClient.LIBPATH, "file://" + getTestCaseDir() + "/libx",
+ "file://" + getTestCaseDir() + "/liby", "file://" + getTestCaseDir() + "/libz");
+ jobConf.set(OozieClient.USER_NAME, getTestUser());
+ jobConf.set(OozieClient.GROUP_NAME, getTestGroup());
+ injectKerberosInfo(jobConf);
+ Configuration protoConf = wps.createProtoActionConf(jobConf, "authToken", true);
+ assertEquals(getTestUser(), protoConf.get(OozieClient.USER_NAME));
+ assertEquals(getTestGroup(), protoConf.get(OozieClient.GROUP_NAME));
+
+ assertEquals(6, protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST).length);
+ List<String> found = new ArrayList<String>();
+ found.add(protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[0]);
+ found.add(protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[1]);
+ found.add(protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[2]);
+ found.add(protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[3]);
+ found.add(protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[4]);
+ found.add(protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[5]);
+ List<String> expected = new ArrayList<String>();
+ expected.add(getTestCaseDir() + "/lib/reduceutil.so");
+ expected.add(getTestCaseDir() + "/lib/maputil.jar");
+ expected.add(getTestCaseDir() + "/libx/maputil_x.jar");
+ expected.add(getTestCaseDir() + "/liby/maputil_y1.jar");
+ expected.add(getTestCaseDir() + "/liby/maputil_y2.jar");
+ expected.add(getTestCaseDir() + "/libz/maputil_z.jar");
+ Collections.sort(found);
+ Collections.sort(expected);
+ assertEquals(expected, found);
+ }
+ finally {
+ services.destroy();
+ }
+ }
public void testCreateprotoConfWithSystemLibPath() throws Exception {
String systemLibPath = createTestCaseSubDir("syslib");
View
1  release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 3.1.0 release
+OOZIE-135 support multiple shared lib path in oozie
OOZIE-18 Option to view Workflow job details from Coordinator job detail popup
OOZIE-17 Group column for coordinator jobs in Oozie Web Console
OOZIE-11 Adding Distcp Action.
Please sign in to comment.
Something went wrong with that request. Please try again.