Author: virag
Date: Fri Apr 26 22:53:08 2013
New Revision: 1476434
URL: http://svn.apache.org/r1476434
Log:
OOZIE-1346 Modularize hbase credentials to separate the populating of jobconf
and obtaining token for job (virag)
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.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=1476434&r1=1476433&r2=1476434&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
Fri Apr 26 22:53:08 2013
@@ -17,6 +17,7 @@
*/
package org.apache.oozie.action.hadoop;
+import java.io.IOException;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
@@ -45,17 +46,8 @@ public class HbaseCredentials extends Cr
@Override
public void addtoJobConf(JobConf jobConf, CredentialsProperties props,
Context context) throws Exception {
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);
- String user = context.getWorkflow().getUser();
- UserGroupInformation ugi =
UserGroupInformation.createProxyUser(user, UserGroupInformation.getLoginUser());
- User u = User.create(ugi);
- u.obtainAuthTokenForJob(jobConf);
+ copyHbaseConfToJobConf(jobConf, props);
+ obtainToken(jobConf, context);
}
catch (Exception e) {
XLog.getLog(getClass()).warn("Exception in receiving hbase
credentials", e);
@@ -63,6 +55,23 @@ public class HbaseCredentials extends Cr
}
}
+ void copyHbaseConfToJobConf(JobConf jobConf, CredentialsProperties props) {
+ // 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);
+ }
+
+ private void obtainToken(JobConf jobConf, Context context) throws
IOException, InterruptedException {
+ String user = context.getWorkflow().getUser();
+ UserGroupInformation ugi = UserGroupInformation.createProxyUser(user,
UserGroupInformation.getLoginUser());
+ User u = User.create(ugi);
+ u.obtainAuthTokenForJob(jobConf);
+ }
+
private void addPropsConf(CredentialsProperties props, Configuration
destConf) {
for (Map.Entry<String, String> entry :
props.getProperties().entrySet()) {
destConf.set(entry.getKey(), entry.getValue());
Modified:
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=1476434&r1=1476433&r2=1476434&view=diff
==============================================================================
---
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.java
(original)
+++
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestCredentials.java
Fri Apr 26 22:53:08 2013
@@ -18,9 +18,6 @@
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;
/**
@@ -32,20 +29,9 @@ public class TestCredentials extends Act
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");
+ HbaseCredentials hb = new HbaseCredentials();
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());
- }
- }
+ hb.copyHbaseConfToJobConf(jc,prop);
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=1476434&r1=1476433&r2=1476434&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Fri Apr 26 22:53:08 2013
@@ -1,5 +1,6 @@
-- Oozie 4.1.0 release (trunk - unreleased)
+OOZIE-1346 Modularize hbase credentials to separate the populating of jobconf
and obtaining token for job (virag)
OOZIE-1341 Have Action Main classes in Oozie webapp (virag)
OOZIE-1337 HadoopAccessorService has two static methods so you can't override
them with another implementation (rkanter)
OOZIE-1333 Some testcases related to EventHandlerService are failing in a
transient way (virag)