Author: virag
Date: Wed Jan  2 20:01:06 2013
New Revision: 1427985

URL: http://svn.apache.org/viewvc?rev=1427985&view=rev
Log:
OOZIE-1151 HbaseCredentials doesn't use properties from the credentials module 
(virag)

Added:
    
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.java
Modified:
    
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
    oozie/trunk/release-log.txt

Modified: 
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java?rev=1427985&r1=1427984&r2=1427985&view=diff
==============================================================================
--- 
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
 (original)
+++ 
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
 Wed Jan  2 20:01:06 2013
@@ -47,6 +47,8 @@ public class HbaseCredentials extends Cr
         try {
             // Create configuration using hbase-site.xml/hbase-default.xml
             Configuration hbaseConf = HBaseConfiguration.create();
+            // copy cred props to hbaseconf and override if values already 
exists
+            addPropsConf(props, hbaseConf);
             // copy conf from hbaseConf to jobConf without overriding the
             // already existing values of jobConf
             injectConf(hbaseConf, jobConf);
@@ -61,6 +63,12 @@ public class HbaseCredentials extends Cr
         }
     }
 
+    private void addPropsConf(CredentialsProperties props, Configuration 
destConf) {
+        for (Map.Entry<String, String> entry : 
props.getProperties().entrySet()) {
+            destConf.set(entry.getKey(), entry.getValue());
+        }
+    }
+
     private void injectConf(Configuration srcConf, Configuration destConf) {
         for (Map.Entry<String, String> entry : srcConf) {
             String name = entry.getKey();

Added: 
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.java?rev=1427985&view=auto
==============================================================================
--- 
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.java
 (added)
+++ 
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.java
 Wed Jan  2 20:01:06 2013
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oozie.action.hadoop;
+
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.oozie.WorkflowActionBean;
+import org.apache.oozie.WorkflowJobBean;
+import org.apache.oozie.action.hadoop.Credentials;
+import org.apache.oozie.action.hadoop.CredentialsProperties;
+
+/**
+ * Test Credentials
+ *
+ */
+public class TestCredentials extends ActionExecutorTestCase {
+
+    public void testHbaseCredentials() {
+        CredentialsProperties prop = new CredentialsProperties("dummyName", 
"dummyType");
+        prop.getProperties().put("hbase.zookeeper.quorum", "dummyHost");
+        Credentials hb = new HbaseCredentials();
+        WorkflowJobBean wfBean = new WorkflowJobBean();
+        wfBean.setUser("dummyUser");
+        JobConf jc = new JobConf(false);
+        try {
+            hb.addtoJobConf(jc, prop, new Context(wfBean, new 
WorkflowActionBean()));
+        }
+        catch (Exception e) {
+            // Change this when security related classes are available from
+            // hbase maven repo
+            if (!(e.getCause() instanceof ClassNotFoundException)) {
+                fail("unexpected exception " + e.getMessage());
+            }
+        }
+        assertEquals("dummyHost", jc.get("hbase.zookeeper.quorum"));
+    }
+
+}

Modified: oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1427985&r1=1427984&r2=1427985&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Wed Jan  2 20:01:06 2013
@@ -69,6 +69,7 @@ OOZIE-944 Implement Workflow Generator U
 
 -- Oozie 3.3.1 (unreleased)
 
+OOZIE-1151 HbaseCredentials doesn't use properties from the credentials module 
(virag)
 OOZIE-1148 Set the renewer correctly for JT/RM delegation tokens (rohini via 
virag)
 OOZIE-1147 HCatCredentialHelper uses the wrong API for getDelegationToken 
(rohini via virag)
 OOZIE-1149 Update 3.3 branch POM's to 3.3.1-SNAPSHOT (virag)


Reply via email to