You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by tu...@apache.org on 2012/06/14 01:36:33 UTC
svn commit: r1350056 - in /incubator/oozie/trunk:
core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
release-log.txt
Author: tucu
Date: Wed Jun 13 23:36:33 2012
New Revision: 1350056
URL: http://svn.apache.org/viewvc?rev=1350056&view=rev
Log:
OOZIE-871 actions from subworkflows that use oozie.libpath have duplicate classpath (tucu)
Modified:
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
incubator/oozie/trunk/release-log.txt
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java?rev=1350056&r1=1350055&r2=1350056&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java Wed Jun 13 23:36:33 2012
@@ -38,8 +38,11 @@ import java.io.StringWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* Service that provides application workflow definition reading from the path and creation of the proto configuration.
@@ -169,7 +172,7 @@ public abstract class WorkflowAppService
XLog.getLog(getClass()).debug("jobConf.libPath = " + jobConf.get(OozieClient.LIBPATH));
XLog.getLog(getClass()).debug("jobConf.appPath = " + appPath);
- List<String> filePaths;
+ Collection<String> filePaths;
if (isWorkflowJob) {
// app path could be a directory
Path path = new Path(uri.getPath());
@@ -180,7 +183,7 @@ public abstract class WorkflowAppService
}
}
else {
- filePaths = new ArrayList<String>();
+ filePaths = new LinkedHashSet<String>();
}
String[] libPaths = jobConf.getStrings(OozieClient.LIBPATH);
@@ -188,7 +191,7 @@ public abstract class WorkflowAppService
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);
+ Collection<String> libFilePaths = getLibFiles(fs, libPath);
filePaths.addAll(libFilePaths);
}
}
@@ -201,12 +204,7 @@ public abstract class WorkflowAppService
if (entry.getKey().startsWith("oozie.")) {
String name = entry.getKey();
String value = entry.getValue();
- // Append application lib jars of both parent and child in
- // subworkflow to APP_LIB_PATH_LIST
- if ((conf.get(name) != null) && name.equals(APP_LIB_PATH_LIST)) {
- value = value + "," + conf.get(name);
- }
- conf.set(name, value);
+ conf.set(name, value); //TODO ARGGHHHHH!!!!
}
}
XConfiguration retConf = new XConfiguration();
@@ -254,8 +252,8 @@ public abstract class WorkflowAppService
* @return list of paths.
* @throws IOException thrown if the lib paths could not be obtained.
*/
- private List<String> getLibFiles(FileSystem fs, Path libPath) throws IOException {
- List<String> libPaths = new ArrayList<String>();
+ private Collection<String> getLibFiles(FileSystem fs, Path libPath) throws IOException {
+ Set<String> libPaths = new LinkedHashSet<String>();
if (fs.exists(libPath)) {
FileStatus[] files = fs.listStatus(libPath, new NoPathFilter());
Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java?rev=1350056&r1=1350055&r2=1350056&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java Wed Jun 13 23:36:33 2012
@@ -449,57 +449,6 @@ public class TestLiteWorkflowAppService
}
}
- public void testCreateprotoConfWithSubWorkflow_Case1_ParentWorkflowContainingLibs() throws Exception {
- // When parent workflow has an non-empty lib directory,
- // APP_LIB_PATH_LIST should contain libraries from both parent and
- // subworkflow (child)
- 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/childdependency1.jar");
- writer.write("bla bla");
- writer.close();
- writer = new FileWriter(getTestCaseDir() + "/lib/childdependency2.so");
- writer.write("bla bla");
- writer.close();
- WorkflowAppService wps = Services.get().get(WorkflowAppService.class);
- Configuration jobConf = new XConfiguration();
- jobConf.set(OozieClient.APP_PATH, "file://" + getTestCaseDir() + File.separator + "workflow.xml");
- jobConf.set(OozieClient.USER_NAME, getTestUser());
- jobConf.set(WorkflowAppService.APP_LIB_PATH_LIST, "parentdependency1.jar");
-
- Configuration protoConf = wps.createProtoActionConf(jobConf, "authToken", true);
- assertEquals(getTestUser(), protoConf.get(OozieClient.USER_NAME));
-
- assertEquals(3, protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST).length);
- String f1 = protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[0];
- String f2 = protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[1];
- String f3 = protoConf.getStrings(WorkflowAppService.APP_LIB_PATH_LIST)[2];
- String ref1 = "parentdependency1.jar";
- String ref2 = getTestCaseDir() + "/lib/childdependency1.jar";
- String ref3 = getTestCaseDir() + "/lib/childdependency2.so";
- List<String> expected = new ArrayList<String>();
- expected.add(ref1);
- expected.add(ref2);
- expected.add(ref3);
- List<String> found = new ArrayList<String>();
- found.add(f1);
- found.add(f2);
- found.add(f3);
- Collections.sort(found);
- Collections.sort(expected);
- assertEquals(expected, found);
- }
- finally {
- services.destroy();
- }
- }
-
public void testCreateprotoConfWithSubWorkflow_Case2_ParentWorkflowWithoutLibs() throws Exception {
// When parent workflow has an empty (or missing) lib directory,
// APP_LIB_PATH_LIST should contain libraries from only the subworkflow
Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1350056&r1=1350055&r2=1350056&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Wed Jun 13 23:36:33 2012
@@ -1,5 +1,6 @@
-- Oozie 3.3.0 release (trunk - unreleased)
+OOZIE-871 actions from subworkflows that use oozie.libpath have duplicate classpath (tucu)
OOZIE-764 remove log warnings when credentials are null (rkanter via tucu)
OOZIE-637 parametrization of 'name' attribute in workflow/coordinator/bundle (tucu)
OOZIE-603 Invalid regex expression for IDENTIFIER type in xsd files (navis via tucu)