geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [1/3] incubator-geode git commit: GEODE-420: ssl-default-alias property addition and validation rules
Date Mon, 15 Aug 2016 18:25:14 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-420 8db6da065 -> bc2868afd


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bc2868af/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SocketCreatorFactoryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SocketCreatorFactoryJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SocketCreatorFactoryJUnitTest.java
index ededd6d..7db1a97 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SocketCreatorFactoryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SocketCreatorFactoryJUnitTest.java
@@ -41,11 +41,6 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
   }
 
   @Test
-  public void testClusterSSLConfig() {
-
-  }
-
-  @Test
   public void testNewSSLConfigSSLComponentLocator() {
     Properties properties = configureSSLProperties(SSLEnabledComponents.LOCATOR);
 
@@ -58,7 +53,6 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest {
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
-
   }
 
   @Test
@@ -74,7 +68,6 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest {
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
-
   }
 
   @Test
@@ -89,6 +82,7 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest {
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
+    Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   @Test
@@ -103,7 +97,7 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
-
+    Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   @Test
@@ -118,7 +112,7 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
-
+    Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   @Test
@@ -133,7 +127,7 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
-
+    Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   @Test
@@ -149,6 +143,7 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
+    Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   @Test
@@ -163,12 +158,12 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
+    Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   @Test
   public void testNewSSLConfigSSLComponentCombinations2() {
-    Properties properties = configureSSLProperties(commaDelimitedString(SSLEnabledComponents.CLUSTER,
SSLEnabledComponents.SERVER, SSLEnabledComponents
-      .HTTP_SERVICE, SSLEnabledComponents.JMX));
+    Properties properties = configureSSLProperties(commaDelimitedString(SSLEnabledComponents.CLUSTER,
SSLEnabledComponents.SERVER, SSLEnabledComponents.HTTP_SERVICE, SSLEnabledComponents.JMX));
 
     DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
     SocketCreatorFactory.setDistributionConfig(distributionConfig);
@@ -178,26 +173,46 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
+    Assert.assertFalse(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   @Test
-  public void testNewSSLConfigSSLComponentSingleKeyStoreWithAlias() {
+  public void testNewSSLConfigSSLComponentAliasWithMultiKeyStore() {
     Properties properties = configureSSLProperties(SSLEnabledComponent.ALL.getConstant());
 
-    properties.setProperty(CLUSTER_SSL_KEYSTORE, TestUtil.getResourcePath(getClass(), "/com/gemstone/gemfire/internal/net/multiKey.jks"));
-    properties.setProperty(CLUSTER_SSL_TRUSTSTORE, TestUtil.getResourcePath(getClass(), "/com/gemstone/gemfire/internal/net/multiKeyTrust.jks"));
+    properties.setProperty(SSL_KEYSTORE, TestUtil.getResourcePath(getClass(), "/com/gemstone/gemfire/internal/net/multiKey.jks"));
+    properties.setProperty(SSL_TRUSTSTORE, TestUtil.getResourcePath(getClass(), "/com/gemstone/gemfire/internal/net/multiKeyTrust.jks"));
 
-    properties.setProperty(CLUSTER_SSL_ALIAS,"clusterKey");
+    properties.setProperty(SSL_CLUSTER_ALIAS, "clusterKey");
+    properties.setProperty(SSL_DEFAULT_ALIAS, "serverKey");
 
     DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
     SocketCreatorFactory.setDistributionConfig(distributionConfig);
 
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.CLUSTER).useSSL());
+    Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.GATEWAY).useSSL());
+    Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
+    Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
+    Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
+    Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
+  }
+
+  @Test
+  public void testNewSSLConfigSSLComponentWithoutAliasWithMultiKeyStore() {
+    Properties properties = configureSSLProperties(SSLEnabledComponent.ALL.getConstant());
+
+    properties.setProperty(SSL_KEYSTORE, TestUtil.getResourcePath(getClass(), "/com/gemstone/gemfire/internal/net/multiKey.jks"));
+    properties.setProperty(SSL_TRUSTSTORE, TestUtil.getResourcePath(getClass(), "/com/gemstone/gemfire/internal/net/multiKeyTrust.jks"));
+
+    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
+    SocketCreatorFactory.setDistributionConfig(distributionConfig);
+
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.CLUSTER).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.GATEWAY).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.JMX).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.SERVER).useSSL());
     Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.HTTP_SERVICE).useSSL());
+    Assert.assertTrue(SocketCreatorFactory.getSSLSocketCreatorForComponent(SSLEnabledComponent.LOCATOR).useSSL());
   }
 
   private Properties configureSSLProperties(String sslComponents) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bc2868af/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
index 4c6bd30..1b2115e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
@@ -42,7 +42,6 @@ import org.junit.Test;
 import com.gemstone.gemfire.distributed.AbstractLauncher;
 import com.gemstone.gemfire.distributed.LocatorLauncher;
 import com.gemstone.gemfire.distributed.ServerLauncher;
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.net.SSLEnabledComponent;
 import com.gemstone.gemfire.test.dunit.DistributedTestCase;
@@ -297,7 +296,7 @@ public class JMXMBeanDUnitTest extends DistributedTestCase {
         if (useMultiKey) {
           properties.setProperty(SSL_KEYSTORE, getMultiKeyKeystore());
           properties.setProperty(SSL_TRUSTSTORE, getMultiKeyTruststore());
-          properties.setProperty(JMX_MANAGER_SSL_ALIAS, "jmxkey");
+          properties.setProperty(SSL_JMX_MANAGER_ALIAS, "jmxkey");
         }
       }
     }


Mime
View raw message