You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by el...@apache.org on 2016/09/01 02:35:14 UTC

[6/7] phoenix git commit: PHOENIX-3189 Ensure that there is no invalid cached state in KerberosName

PHOENIX-3189 Ensure that there is no invalid cached state in KerberosName


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8342377e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8342377e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8342377e

Branch: refs/heads/4.8-HBase-1.0
Commit: 8342377e9e64909695c473c24b91213658e00d38
Parents: 21659cb
Author: Josh Elser <el...@apache.org>
Authored: Wed Aug 31 22:28:45 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed Aug 31 22:34:44 2016 -0400

----------------------------------------------------------------------
 .../apache/phoenix/jdbc/SecureUserConnectionsTest.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8342377e/phoenix-core/src/test/java/org/apache/phoenix/jdbc/SecureUserConnectionsTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/SecureUserConnectionsTest.java b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/SecureUserConnectionsTest.java
index 6a33142..a14e47b 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/SecureUserConnectionsTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/SecureUserConnectionsTest.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Field;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -35,6 +36,8 @@ import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.minikdc.MiniKdc;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authentication.util.KerberosName;
+import org.apache.hadoop.security.authentication.util.KerberosUtil;
 import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
 import org.apache.phoenix.query.ConfigurationFactory;
 import org.apache.phoenix.util.InstanceResolver;
@@ -94,6 +97,16 @@ public class SecureUserConnectionsTest {
                 return copy;
             }
         });
+        updateDefaultRealm();
+    }
+
+    private static void updateDefaultRealm() throws Exception {
+        // (at least) one other phoenix test triggers the caching of this field before the KDC is up
+        // which causes principal parsing to fail.
+        Field f = KerberosName.class.getDeclaredField("defaultRealm");
+        f.setAccessible(true);
+        // Default realm for MiniKDC
+        f.set(null, "EXAMPLE.COM");
     }
 
     @AfterClass