oozie-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1381698 - in /incubator/oozie/branches/branch-3.3: ./ core/src/main/java/org/apache/oozie/service/ core/src/test/java/org/apache/oozie/action/oozie/ core/src/test/java/org/apache/oozie/service/
Date Thu, 06 Sep 2012 18:03:10 GMT
Author: virag
Date: Thu Sep  6 18:03:09 2012
New Revision: 1381698

URL: http://svn.apache.org/viewvc?rev=1381698&view=rev
Log:
OOZIE-981 Subworkflow lib not found in classpath when parent workflow lib overwrites it (mona
via virag)

Modified:
    incubator/oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
    incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/oozie/TestSubWorkflowActionExecutor.java
    incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
    incubator/oozie/branches/branch-3.3/release-log.txt

Modified: incubator/oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java?rev=1381698&r1=1381697&r2=1381698&view=diff
==============================================================================
--- incubator/oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
(original)
+++ incubator/oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/service/WorkflowAppService.java
Thu Sep  6 18:03:09 2012
@@ -202,7 +202,10 @@ public abstract class WorkflowAppService
                 if (entry.getKey().startsWith("oozie.")) {
                     String name = entry.getKey();
                     String value = entry.getValue();
-                    conf.set(name, value);  //TODO ARGGHHHHH!!!!
+                    // if property already exists, should not overwrite
+                    if(conf.get(name) == null) {
+                        conf.set(name, value);
+                    }
                 }
             }
             XConfiguration retConf = new XConfiguration();
@@ -261,7 +264,7 @@ public abstract class WorkflowAppService
             }
         }
         else {
-            XLog.getLog(getClass()).warn("libpath [{0}] does not exists", libPath);
+            XLog.getLog(getClass()).warn("libpath [{0}] does not exist", libPath);
         }
         return libPaths;
     }

Modified: incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/oozie/TestSubWorkflowActionExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/oozie/TestSubWorkflowActionExecutor.java?rev=1381698&r1=1381697&r2=1381698&view=diff
==============================================================================
--- incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/oozie/TestSubWorkflowActionExecutor.java
(original)
+++ incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/oozie/TestSubWorkflowActionExecutor.java
Thu Sep  6 18:03:09 2012
@@ -20,6 +20,8 @@ package org.apache.oozie.action.oozie;
 import org.apache.oozie.action.hadoop.ActionExecutorTestCase;
 import org.apache.oozie.WorkflowJobBean;
 import org.apache.oozie.WorkflowActionBean;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.service.WorkflowAppService;
 import org.apache.oozie.util.XConfiguration;
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.client.WorkflowAction;
@@ -27,8 +29,6 @@ import org.apache.oozie.client.WorkflowJ
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.FileSystem;
-import org.apache.oozie.workflow.lite.NodeHandler;
-
 import java.io.File;
 import java.io.StringReader;
 import java.io.Writer;
@@ -350,4 +350,52 @@ public class TestSubWorkflowActionExecut
         Configuration childConf = new XConfiguration(new StringReader(wf.getConf()));
         assertNull(childConf.get("abc"));
     }
+
+    public void testSubworkflowLib() throws Exception {
+        XConfiguration protoConf = getBaseProtoConf();
+        WorkflowJobBean workflow = createBaseWorkflow(protoConf, "W");
+        FileSystem fs = getFileSystem();
+        Path parentLibJar = new Path(getFsTestCaseDir(), "lib/parentLibrary.jar");
+        fs.create(parentLibJar);
+        assertTrue(fs.exists(parentLibJar));
+        String defaultConf = workflow.getConf();
+        XConfiguration newConf = new XConfiguration(new StringReader(defaultConf));
+        newConf.set(OozieClient.LIBPATH, parentLibJar.getParent().toString());
+        workflow.setConf(newConf.toXmlString());
+
+        Path subWorkflowAppPath = new Path(getFsTestCaseDir().toString(), "subwf");
+        Writer writer = new OutputStreamWriter(fs.create(new Path(subWorkflowAppPath, "workflow.xml")));
+        writer.write(APP1);
+        writer.close();
+        Path subwfLibJar = new Path(subWorkflowAppPath, "lib/subwfLibrary.jar");
+        fs.create(subwfLibJar);
+        assertTrue(fs.exists(subwfLibJar));
+
+        final WorkflowActionBean action = (WorkflowActionBean) workflow.getActions().get(0);
+        action.setConf("<sub-workflow xmlns='uri:oozie:workflow:0.1' name='subwf'>"
+
+                "      <app-path>" + subWorkflowAppPath + File.separator + "workflow.xml"
+ "</app-path>" +
+                "</sub-workflow>");
+        SubWorkflowActionExecutor subWorkflow = new SubWorkflowActionExecutor();
+        subWorkflow.start(new Context(workflow, action), action);
+
+        final OozieClient oozieClient = subWorkflow.getWorkflowClient(new Context(workflow,
action),
+                SubWorkflowActionExecutor.LOCAL);
+        waitFor(JOB_TIMEOUT, new Predicate() {
+            public boolean evaluate() throws Exception {
+                return oozieClient.getJobInfo(action.getExternalId()).getStatus() == WorkflowJob.Status.SUCCEEDED;
+            }
+        });
+
+        assertEquals(WorkflowJob.Status.SUCCEEDED, oozieClient.getJobInfo(action.getExternalId()).getStatus());
+        subWorkflow.check(new Context(workflow, action), action);
+        assertEquals(WorkflowAction.Status.DONE, action.getStatus());
+        subWorkflow.end(new Context(workflow, action), action);
+        assertEquals(WorkflowAction.Status.OK, action.getStatus());
+
+        WorkflowAppService wps = Services.get().get(WorkflowAppService.class);
+        WorkflowJob wf = oozieClient.getJobInfo(action.getExternalId());
+        Configuration childConf = new XConfiguration(new StringReader(wf.getConf()));
+        childConf = wps.createProtoActionConf(childConf, "authToken", true);
+        assertEquals(childConf.get(WorkflowAppService.APP_LIB_PATH_LIST), subwfLibJar.toString());
+    }
 }

Modified: incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java?rev=1381698&r1=1381697&r2=1381698&view=diff
==============================================================================
--- incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
(original)
+++ incubator/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
Thu Sep  6 18:03:09 2012
@@ -450,10 +450,9 @@ public class TestLiteWorkflowAppService 
         }
     }
 
-    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
-        // (child)
+    public void testCreateprotoConfWithSubWorkflow_CheckSubworkflowLibInClasspath() throws
Exception {
+        // When subworkflow has non-empty lib directory, APP_LIB_PATH_LIST for
+        // subworkflow should maintain its corresponding libraries in path
         Services services = new Services();
         try {
             services.init();
@@ -472,6 +471,7 @@ public class TestLiteWorkflowAppService 
             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));

Modified: incubator/oozie/branches/branch-3.3/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.3/release-log.txt?rev=1381698&r1=1381697&r2=1381698&view=diff
==============================================================================
--- incubator/oozie/branches/branch-3.3/release-log.txt (original)
+++ incubator/oozie/branches/branch-3.3/release-log.txt Thu Sep  6 18:03:09 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.3.0 release (unreleased)
 
+OOZIE-981 Subworkflow lib not found in classpath when parent workflow lib overwrites it (mona
via virag)
 OOZIE-978 Bundle status doesn't transit to KILLED after a coordinator job fails submission
(virag)
 OOZIE-971 TestRecoveryService failing very often in pre-commit builds (mona via virag)
 OOZIE-966 Fix formatting in CLI output when GMT-#### and GMT-##:## formatted timezones are
used (rkanter via tucu)



Mime
View raw message