Author: rkanter
Date: Wed Aug 7 21:41:51 2013
New Revision: 1511509
URL: http://svn.apache.org/r1511509
Log:
OOZIE-1458 If a Credentials type is not defined, Oozie should say something
(rkanter)
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=1511509&r1=1511508&r2=1511509&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
Wed Aug 7 21:41:51 2013
@@ -871,6 +871,9 @@ public class JavaActionExecutor extends
}
else {
log.debug("Credentials object is null for name= " +
credName + ", type=" + credProps.getType());
+ throw new
ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "JA020",
+ "Could not load credentials of type [{0}] with
name [{1}]]; perhaps it was not defined"
+ + " in oozie-site.xml?", credProps.getType(),
credName);
}
}
}
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=1511509&r1=1511508&r2=1511509&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
Wed Aug 7 21:41:51 2013
@@ -951,15 +951,29 @@ public class TestJavaActionExecutor exte
assertEquals("value2", prop.getProperties().get("property2"));
assertEquals("val3", prop.getProperties().get("prop3"));
+ // Try to load the token without it being defined in oozie-site;
should get an exception
+ JobConf credentialsConf = new JobConf();
+ Configuration launcherConf = ae.createBaseHadoopConf(context,
actionXmlconf);
+ XConfiguration.copy(launcherConf, credentialsConf);
+ try {
+ ae.setCredentialTokens(credentialsConf, context, action,
credProperties);
+ fail("Should have gotten an exception but did not");
+ }
+ catch (ActionExecutorException aee) {
+ assertEquals("JA020", aee.getErrorCode());
+ assertTrue(aee.getMessage().contains("type [abc]"));
+ assertTrue(aee.getMessage().contains("name [abcname]"));
+ }
+
+ // Define 'abc' token type in oozie-site
Configuration conf = Services.get().getConf();
conf.set("oozie.credentials.credentialclasses",
"abc=org.apache.oozie.action.hadoop.InsertTestToken");
- // Adding if action need to set more credential tokens
- JobConf credentialsConf = new JobConf();
- Configuration launcherConf = ae.createBaseHadoopConf(context,
actionXmlconf);
+ // Try to load the token after being defined in oozie-site; should
work correctly
+ credentialsConf = new JobConf();
+ launcherConf = ae.createBaseHadoopConf(context, actionXmlconf);
XConfiguration.copy(launcherConf, credentialsConf);
ae.setCredentialTokens(credentialsConf, context, action,
credProperties);
-
Token<? extends TokenIdentifier> tk =
credentialsConf.getCredentials().getToken(new Text("ABC Token"));
assertNotNull(tk);
}
Modified: oozie/trunk/release-log.txt
URL:
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1511509&r1=1511508&r2=1511509&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Wed Aug 7 21:41:51 2013
@@ -1,5 +1,6 @@
-- Oozie 4.1.0 release (trunk - unreleased)
+OOZIE-1458 If a Credentials type is not defined, Oozie should say something
(rkanter)
OOZIE-1425 param checker should validate cron syntax (bowenzhangusa via
rkanter)
OOZIE-1453 Change "frequency" to string in SyncCoordAction.java (bowenzhangusa
via rkanter)
OOZIE-1447 Sqoop actions that don't launch a map reduce job fail with an
IllegalArgumentException (jarcec via rkanter)