zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject [1/2] zookeeper git commit: ZOOKEEPER-3148: Add Kerberos tests for modern JDKs
Date Tue, 25 Sep 2018 11:25:35 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.4 29cc5c1a7 -> 7b25a7078


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7b25a707/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosAuthTest.java
----------------------------------------------------------------------
diff --git a/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosAuthTest.java
b/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosAuthTest.java
index e3eddf7..7263925 100644
--- a/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosAuthTest.java
+++ b/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosAuthTest.java
@@ -28,11 +28,17 @@ import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.server.quorum.QuorumPeerTestBase.MainThread;
+import org.apache.zookeeper.server.quorum.auth.KerberosTestUtils;
+import org.apache.zookeeper.server.quorum.auth.QuorumAuth;
+import static org.apache.zookeeper.server.quorum.auth.QuorumAuthTestBase.cleanupJaasConfig;
+import static org.apache.zookeeper.server.quorum.auth.QuorumAuthTestBase.setupJaasConfig;
 import org.apache.zookeeper.test.ClientBase;
 import org.apache.zookeeper.test.ClientBase.CountdownWatcher;
 import org.junit.After;
 import org.junit.AfterClass;
+import static org.junit.Assume.assumeFalse;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class QuorumKerberosAuthTest extends KerberosSecurityTestcase {
@@ -46,9 +52,7 @@ public class QuorumKerberosAuthTest extends KerberosSecurityTestcase {
                 + "       keyTab=\"" + keytabFilePath + "\"\n"
                 + "       storeKey=true\n"
                 + "       useTicketCache=false\n"
-                + "       debug=true\n"
-                + "       doNotPrompt=true\n"
-                + "       refreshKrb5Config=true\n"
+                + "       debug=false\n"
                 + "       principal=\"" + KerberosTestUtils.getServerPrincipal() + "\";\n"
+ "};\n"
                 + "QuorumLearner {\n"
                 + "       com.sun.security.auth.module.Krb5LoginModule required\n"
@@ -56,13 +60,17 @@ public class QuorumKerberosAuthTest extends KerberosSecurityTestcase {
                 + "       keyTab=\"" + keytabFilePath + "\"\n"
                 + "       storeKey=true\n"
                 + "       useTicketCache=false\n"
-                + "       debug=true\n"
-                + "       doNotPrompt=true\n"
-                + "       refreshKrb5Config=true\n"
-                + "       isInitiator=true\n"
+                + "       debug=false\n"
                 + "       principal=\"" + KerberosTestUtils.getLearnerPrincipal() + "\";\n"
+ "};\n");
         setupJaasConfig(jaasEntries);
     }
+    
+    @BeforeClass
+    public static void notOnJdk6() throws Exception {
+        String specsVersion = System.getProperty("java.specification.version", "1.6");
+        System.out.println("java.specification.version="+specsVersion);
+        assumeFalse("Skipping test as Java Major version is "+specsVersion, "1.6".equals(specsVersion));
+    }
 
     @Before
     public void setUp() throws Exception {
@@ -103,7 +111,7 @@ public class QuorumKerberosAuthTest extends KerberosSecurityTestcase {
         authConfigs.put(QuorumAuth.QUORUM_SERVER_SASL_AUTH_REQUIRED, "true");
         authConfigs.put(QuorumAuth.QUORUM_LEARNER_SASL_AUTH_REQUIRED, "true");
         authConfigs.put(QuorumAuth.QUORUM_KERBEROS_SERVICE_PRINCIPAL, serverPrincipal);
-        String connectStr = startQuorum(3, authConfigs, 3, true);
+        String connectStr = startQuorum(3, authConfigs, 3, false);
         CountdownWatcher watcher = new CountdownWatcher();
         ZooKeeper zk = new ZooKeeper(connectStr, ClientBase.CONNECTION_TIMEOUT, watcher);
         watcher.waitForConnected(ClientBase.CONNECTION_TIMEOUT);

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7b25a707/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosHostBasedAuthTest.java
----------------------------------------------------------------------
diff --git a/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosHostBasedAuthTest.java
b/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosHostBasedAuthTest.java
index 55deefb..aab893e 100644
--- a/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosHostBasedAuthTest.java
+++ b/src/java/test/org/apache/zookeeper/server/quorum/auth/QuorumKerberosHostBasedAuthTest.java
@@ -38,12 +38,17 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 import junit.framework.Assert;
+import org.apache.zookeeper.server.quorum.auth.KerberosTestUtils;
+import org.apache.zookeeper.server.quorum.auth.QuorumAuth;
+import static org.apache.zookeeper.server.quorum.auth.QuorumAuthTestBase.cleanupJaasConfig;
+import static org.apache.zookeeper.server.quorum.auth.QuorumAuthTestBase.setupJaasConfig;
+import static org.junit.Assume.assumeFalse;
 
 public class QuorumKerberosHostBasedAuthTest extends KerberosSecurityTestcase {
     private static File keytabFile;
     private static String hostServerPrincipal = KerberosTestUtils.getHostServerPrincipal();
     private static String hostLearnerPrincipal = KerberosTestUtils.getHostLearnerPrincipal();
-    private static String hostNamedLearnerPrincipal = KerberosTestUtils.getHostNamedLearnerPrincipal("myhost");
+    private static String hostNamedLearnerPrincipal = KerberosTestUtils.getHostNamedLearnerPrincipal("myHost");
     static {
         setupJaasConfigEntries(hostServerPrincipal, hostLearnerPrincipal, hostNamedLearnerPrincipal);
     }
@@ -58,9 +63,7 @@ public class QuorumKerberosHostBasedAuthTest extends KerberosSecurityTestcase
{
                 + "       keyTab=\"" + keytabFilePath + "\"\n"
                 + "       storeKey=true\n"
                 + "       useTicketCache=false\n"
-                + "       debug=true\n"
-                + "       doNotPrompt=true\n"
-                + "       refreshKrb5Config=true\n"
+                + "       debug=false\n"
                 + "       principal=\"" + KerberosTestUtils.replaceHostPattern(hostServerPrincipal)
+ "\";\n" + "};\n"
                 + "QuorumLearner {\n"
                 + "       com.sun.security.auth.module.Krb5LoginModule required\n"
@@ -68,10 +71,7 @@ public class QuorumKerberosHostBasedAuthTest extends KerberosSecurityTestcase
{
                 + "       keyTab=\"" + keytabFilePath + "\"\n"
                 + "       storeKey=true\n"
                 + "       useTicketCache=false\n"
-                + "       debug=true\n"
-                + "       doNotPrompt=true\n"
-                + "       refreshKrb5Config=true\n"
-                + "       isInitiator=true\n"
+                + "       debug=false\n"
                 + "       principal=\"" + KerberosTestUtils.replaceHostPattern(hostLearnerPrincipal)
+ "\";\n" + "};\n"
                 + "QuorumLearnerMyHost {\n"
                 + "       com.sun.security.auth.module.Krb5LoginModule required\n"
@@ -79,13 +79,17 @@ public class QuorumKerberosHostBasedAuthTest extends KerberosSecurityTestcase
{
                 + "       keyTab=\"" + keytabFilePath + "\"\n"
                 + "       storeKey=true\n"
                 + "       useTicketCache=false\n"
-                + "       debug=true\n"
-                + "       doNotPrompt=true\n"
-                + "       refreshKrb5Config=true\n"
-                + "       isInitiator=true\n"
+                + "       debug=false\n"
                 + "       principal=\"" + hostNamedLearnerPrincipal + "\";\n" + "};\n");
         setupJaasConfig(jaasEntries);
     }
+    
+    @BeforeClass
+    public static void notOnJdk6() throws Exception {
+        String specsVersion = System.getProperty("java.specification.version", "1.6");
+        System.out.println("java.specification.version="+specsVersion);
+        assumeFalse("Skipping test as Java Major version is "+specsVersion, "1.6".equals(specsVersion));
+    }
 
     @BeforeClass
     public static void setUp() throws Exception {
@@ -130,7 +134,7 @@ public class QuorumKerberosHostBasedAuthTest extends KerberosSecurityTestcase
{
         authConfigs.put(QuorumAuth.QUORUM_SERVER_SASL_AUTH_REQUIRED, "true");
         authConfigs.put(QuorumAuth.QUORUM_LEARNER_SASL_AUTH_REQUIRED, "true");
         authConfigs.put(QuorumAuth.QUORUM_KERBEROS_SERVICE_PRINCIPAL, serverPrincipal);
-        String connectStr = startQuorum(3, authConfigs, 3, true);
+        String connectStr = startQuorum(3, authConfigs, 3, false);
         CountdownWatcher watcher = new CountdownWatcher();
         ZooKeeper zk = new ZooKeeper(connectStr, ClientBase.CONNECTION_TIMEOUT, watcher);
         watcher.waitForConnected(ClientBase.CONNECTION_TIMEOUT);
@@ -151,7 +155,7 @@ public class QuorumKerberosHostBasedAuthTest extends KerberosSecurityTestcase
{
         authConfigs.put(QuorumAuth.QUORUM_SERVER_SASL_AUTH_REQUIRED, "true");
         authConfigs.put(QuorumAuth.QUORUM_LEARNER_SASL_AUTH_REQUIRED, "true");
         authConfigs.put(QuorumAuth.QUORUM_KERBEROS_SERVICE_PRINCIPAL, serverPrincipal);
-        String connectStr = startQuorum(3, authConfigs, 3, true);
+        String connectStr = startQuorum(3, authConfigs, 3, false);
         CountdownWatcher watcher = new CountdownWatcher();
         ZooKeeper zk = new ZooKeeper(connectStr, ClientBase.CONNECTION_TIMEOUT, watcher);
         watcher.waitForConnected(ClientBase.CONNECTION_TIMEOUT);


Mime
View raw message