You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by sn...@apache.org on 2015/03/04 21:17:22 UTC
incubator-ranger git commit: RANGER-234: modification to HADOOP-11455
causes unit test fail. Fixed by adding a additional param (-f) to be
non-interactive
Repository: incubator-ranger
Updated Branches:
refs/heads/master cfc9ce3e9 -> f1ae106af
RANGER-234: modification to HADOOP-11455 causes unit test fail. Fixed by adding a additional param (-f) to be non-interactive
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/f1ae106a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/f1ae106a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/f1ae106a
Branch: refs/heads/master
Commit: f1ae106af4c8ea1af48c98fc38071490d5cc4fab
Parents: cfc9ce3
Author: sneethiraj <sn...@apache.org>
Authored: Wed Mar 4 15:17:11 2015 -0500
Committer: sneethiraj <sn...@apache.org>
Committed: Wed Mar 4 15:17:11 2015 -0500
----------------------------------------------------------------------
.../utils/RangerCredentialProviderTest.java | 51 ++++++++++++++++----
pom.xml | 2 +-
2 files changed, 43 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/f1ae106a/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
----------------------------------------------------------------------
diff --git a/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java b/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
index 7923154..8e16ad1 100644
--- a/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
+++ b/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
@@ -18,20 +18,19 @@
package org.apache.ranger.authorization.hadoop.utils;
-import java.io.File;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.After;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.List;
+
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.alias.CredentialShell;
import org.apache.hadoop.security.alias.CredentialProvider;
-import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.apache.hadoop.security.alias.CredentialShell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
public class RangerCredentialProviderTest {
@@ -43,6 +42,15 @@ public class RangerCredentialProviderTest {
RangerCredentialProvider cp = null;
List<CredentialProvider> providers = null;
+
+ public RangerCredentialProviderTest() {
+ if ( isCredentialShellInteractiveEnabled() ) {
+ argsCreate = new String[] {"create", "TestCredential001", "-f", "-value", "PassworD123", "-provider", "jceks://file@/" + keystoreFile};
+ argsDelete = new String[] {"delete", "TestCredential001", "-f" , "-provider", "jceks://file@/" + keystoreFile};
+ }
+ }
+
+
@Before
public void setup() throws Exception {
int ret;
@@ -134,6 +142,31 @@ public class RangerCredentialProviderTest {
}
}
}
+
+ private static boolean isCredentialShellInteractiveEnabled() {
+ boolean ret = false ;
+
+ String fieldName = "interactive" ;
+
+ CredentialShell cs = new CredentialShell() ;
+
+ try {
+ Field interactiveField = cs.getClass().getField(fieldName) ;
+
+ if (interactiveField != null) {
+ interactiveField.setAccessible(true);
+ ret = interactiveField.getBoolean(cs) ;
+
+ }
+ } catch (Throwable e) {
+ System.out.println("Unable to find the value of [" + fieldName + "] field in the Class [" + cs.getClass().getName() + "]. Skiping -f option") ;
+ ret = false;
+ }
+
+ return ret ;
+
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/f1ae106a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 93cba79..7cf894b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -93,7 +93,6 @@
<module>ugsync</module>
<module>unixauthclient</module>
<module>unixauthservice</module>
- <module>ranger-util</module>
</modules>
<properties>
<javac.source.version>1.7</javac.source.version>
@@ -181,6 +180,7 @@
</activation>
<modules>
<module>unixauthnative</module>
+ <module>ranger-util</module>
</modules>
</profile>
</profiles>