Author: virag
Date: Tue Dec  4 03:31:45 2012
New Revision: 1416758

URL: http://svn.apache.org/viewvc?rev=1416758&view=rev
Log:
OOZIE-1094 credential cannot resolve variable (virag)

Modified:
    
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
    
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
    oozie/trunk/release-log.txt

Modified: 
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java?rev=1416758&r1=1416757&r2=1416758&view=diff
==============================================================================
--- 
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
 (original)
+++ 
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
 Tue Dec  4 03:31:45 2012
@@ -789,7 +789,7 @@ public class JavaActionExecutor extends 
             WorkflowAction action, Configuration actionConf) throws Exception {
         HashMap<String, CredentialsProperties> credPropertiesMap = null;
         if (context != null && action != null) {
-            credPropertiesMap = getActionCredentialsProperties(context, 
action, actionConf);
+            credPropertiesMap = getActionCredentialsProperties(context, 
action);
             if (credPropertiesMap != null) {
                 for (String key : credPropertiesMap.keySet()) {
                     CredentialsProperties prop = credPropertiesMap.get(key);
@@ -836,14 +836,14 @@ public class JavaActionExecutor extends 
     }
 
     protected HashMap<String, CredentialsProperties> 
getActionCredentialsProperties(Context context,
-            WorkflowAction action, Configuration conf) throws Exception {
+            WorkflowAction action) throws Exception {
         HashMap<String, CredentialsProperties> props = new HashMap<String, 
CredentialsProperties>();
         if (context != null && action != null) {
             String credsInAction = action.getCred();
             log.debug("Get credential '" + credsInAction + "' properties for 
action : " + action.getId());
             String[] credNames = credsInAction.split(",");
             for (String credName : credNames) {
-                CredentialsProperties credProps = getCredProperties(context, 
credName, conf);
+                CredentialsProperties credProps = getCredProperties(context, 
credName);
                 props.put(credName, credProps);
             }
         }
@@ -854,10 +854,11 @@ public class JavaActionExecutor extends 
     }
 
     @SuppressWarnings("unchecked")
-    protected CredentialsProperties getCredProperties(Context context, String 
credName, Configuration conf)
+    protected CredentialsProperties getCredProperties(Context context, String 
credName)
             throws Exception {
         CredentialsProperties credProp = null;
         String workflowXml = ((WorkflowJobBean) 
context.getWorkflow()).getWorkflowInstance().getApp().getDefinition();
+        XConfiguration wfjobConf = new XConfiguration(new 
StringReader(context.getWorkflow().getConf()));
         Element elementJob = XmlUtils.parseXml(workflowXml);
         Element credentials = elementJob.getChild("credentials", 
elementJob.getNamespace());
         if (credentials != null) {
@@ -872,7 +873,7 @@ public class JavaActionExecutor extends 
                         String propertyName = property.getChildText("name", 
property.getNamespace());
                         String propertyValue = property.getChildText("value", 
property.getNamespace());
                         ELEvaluator eval = new ELEvaluator();
-                        for (Map.Entry<String, String> entry : conf) {
+                        for (Map.Entry<String, String> entry : wfjobConf) {
                             eval.setVariable(entry.getKey(), 
entry.getValue().trim());
                         }
                         propertyName = eval.evaluate(propertyName, 
String.class);

Modified: 
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java?rev=1416758&r1=1416757&r2=1416758&view=diff
==============================================================================
--- 
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
 (original)
+++ 
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
 Tue Dec  4 03:31:45 2012
@@ -788,8 +788,6 @@ public class TestJavaActionExecutor exte
         Element actionXmlconf = XmlUtils.parseXml(action.getConf());
         // action job configuration
         Configuration actionConf = ae.createBaseHadoopConf(context, 
actionXmlconf);
-        actionConf.set("property3", "prop3");
-        actionConf.set("value3", "val3");
 
         // Setting the credential properties in launcher conf
         HashMap<String, CredentialsProperties> credProperties = 
ae.setCredentialPropertyToActionConf(context,
@@ -822,6 +820,8 @@ public class TestJavaActionExecutor exte
         conf.set(OozieClient.APP_PATH, getNameNodeUri() + "/testPath");
         conf.set(OozieClient.LOG_TOKEN, "testToken");
         conf.set(OozieClient.USER_NAME, getTestUser());
+        conf.set("property3", "prop3");
+        conf.set("value3", "val3");
 
         WorkflowJobBean wfBean = createWorkflow(app, conf, "auth");
         wfBean.setId(wfId);

Modified: oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1416758&r1=1416757&r2=1416758&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Tue Dec  4 03:31:45 2012
@@ -53,6 +53,7 @@ OOZIE-944 Implement Workflow Generator U
 
 -- Oozie 3.3.1 (unreleased)
 
+OOZIE-1094 credential cannot resolve variable (virag)
 OOZIE-1099 Pig launcher log does not show the pig job url for H23 (rohini via 
mona)
 OOZIE-1100 HFTP coordinator input check fails due to missing 
commons-httpclient.jar (ryota via virag)
 OOZIE-1065 bundle status does not transit after rerun (virag)


Reply via email to