geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [1/2] incubator-geode git commit: GEODE-420: Added SSLConfigurationFactory to have a single location that determines the SSLConfiguration. Amended all affected classes
Date Thu, 21 Jul 2016 16:16:51 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-420 399a63878 -> 9891f06ed


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java
b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java
index 42dcd64..32d2045 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java
@@ -17,7 +17,6 @@
 package com.gemstone.gemfire.management.internal;
 
 import java.io.File;
-import java.util.Properties;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.logging.log4j.Logger;
@@ -34,30 +33,32 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.webapp.WebAppContext;
 
 import com.gemstone.gemfire.GemFireConfigException;
+import com.gemstone.gemfire.internal.admin.SSLConfig;
 import com.gemstone.gemfire.internal.lang.StringUtils;
 import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.net.SSLConfigurationFactory;
+import com.gemstone.gemfire.internal.net.SSLEnabledComponent;
 
 /**
  * @since GemFire 8.1
  */
 @SuppressWarnings("unused")
 public class JettyHelper {
+
   private static final Logger logger = LogService.getLogger();
 
-  private static final String FILE_PATH_SEPARATOR = System.getProperty(
-      "file.separator");
+  private static final String FILE_PATH_SEPARATOR = System.getProperty("file.separator");
   private static final String USER_DIR = System.getProperty("user.dir");
 
   private static final String USER_NAME = System.getProperty("user.name");
-  
+
   private static final String HTTPS = "https";
 
   private static String bindAddress = "0.0.0.0";
 
   private static int port = 0;
-  
-  public static Server initJetty(final String bindAddress, final int port, boolean useSSL,
-      boolean needClientAuth, String protocols, String ciphers, Properties sysProps) throws
Exception {
+
+  public static Server initJetty(final String bindAddress, final int port, SSLConfig sslConfig)
throws Exception {
 
     final Server jettyServer = new Server();
 
@@ -65,82 +66,79 @@ public class JettyHelper {
     // to this collection.
     jettyServer.setHandler(new HandlerCollection());
     ServerConnector connector = null;
-    
+
     HttpConfiguration httpConfig = new HttpConfiguration();
     httpConfig.setSecureScheme(HTTPS);
     httpConfig.setSecurePort(port);
 
-    if (useSSL) {
+    if (sslConfig.isEnabled()) {
       SslContextFactory sslContextFactory = new SslContextFactory();
-      
-      sslContextFactory.setNeedClientAuth(needClientAuth);
-   
-      if (!StringUtils.isBlank(ciphers) && !"any".equalsIgnoreCase(ciphers)) {
+
+      sslContextFactory.setNeedClientAuth(sslConfig.isRequireAuth());
+
+      if (!StringUtils.isBlank(sslConfig.getCiphers()) && !"any".equalsIgnoreCase(sslConfig.getCiphers()))
{
         //If use has mentioned "any" let the SSL layer decide on the ciphers
-        sslContextFactory.setIncludeCipherSuites(SSLUtil.readArray(ciphers));
+        sslContextFactory.setIncludeCipherSuites(SSLUtil.readArray(sslConfig.getCiphers()));
       }
 
-      String protocol = SSLUtil.getSSLAlgo(SSLUtil.readArray(protocols));
+      String protocol = SSLUtil.getSSLAlgo(SSLUtil.readArray(sslConfig.getProtocols()));
       if (protocol != null) {
         sslContextFactory.setProtocol(protocol);
       } else {
         logger.warn(ManagementStrings.SSL_PROTOCOAL_COULD_NOT_BE_DETERMINED);
       }
-      
 
-      if (StringUtils.isBlank(sysProps.getProperty("javax.net.ssl.keyStore"))) {
+
+      if (StringUtils.isBlank(sslConfig.getKeystore())) {
         throw new GemFireConfigException("Key store can't be empty if SSL is enabled for
HttpService");
       }
 
-      sslContextFactory.setKeyStorePath(sysProps.getProperty("javax.net.ssl.keyStore"));
+      sslContextFactory.setKeyStorePath(sslConfig.getKeystore());
 
-      if (!StringUtils.isBlank(sysProps.getProperty("javax.net.ssl.keyStoreType"))) {
-        sslContextFactory.setKeyStoreType(sysProps.getProperty("javax.net.ssl.keyStoreType"));
+      if (!StringUtils.isBlank(sslConfig.getKeystoreType())) {
+        sslContextFactory.setKeyStoreType(sslConfig.getKeystoreType());
       }
 
-      if (!StringUtils.isBlank(sysProps.getProperty("javax.net.ssl.keyStorePassword"))){
-        sslContextFactory.setKeyStorePassword(sysProps.getProperty("javax.net.ssl.keyStorePassword"));
+      if (!StringUtils.isBlank(sslConfig.getKeystorePassword())) {
+        sslContextFactory.setKeyStorePassword(sslConfig.getKeystorePassword());
       }
 
-      if (!StringUtils.isBlank(sysProps.getProperty("javax.net.ssl.trustStore"))){
-        sslContextFactory.setTrustStorePath(sysProps.getProperty("javax.net.ssl.trustStore"));
+      if (!StringUtils.isBlank(sslConfig.getTruststore())) {
+        sslContextFactory.setTrustStorePath(sslConfig.getTruststore());
       }
 
-      if (!StringUtils.isBlank(sysProps.getProperty("javax.net.ssl.trustStorePassword"))){
-        sslContextFactory.setTrustStorePassword(sysProps.getProperty("javax.net.ssl.trustStorePassword"));
+      if (!StringUtils.isBlank(sslConfig.getTruststorePassword())) {
+        sslContextFactory.setTrustStorePassword(sslConfig.getTruststorePassword());
       }
-      
 
       httpConfig.addCustomizer(new SecureRequestCustomizer());
 
       //Somehow With HTTP_2.0 Jetty throwing NPE. Need to investigate further whether all
GemFire web application(Pulse, REST) can do with HTTP_1.1
-      connector = new ServerConnector(jettyServer, new SslConnectionFactory(sslContextFactory,
-          HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpConfig));
-      
+      connector = new ServerConnector(jettyServer, new SslConnectionFactory(sslContextFactory,
HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpConfig));
+
 
       connector.setPort(port);
     } else {
       connector = new ServerConnector(jettyServer, new HttpConnectionFactory(httpConfig));
-     
+
       connector.setPort(port);
     }
 
-    jettyServer.setConnectors(new Connector[] { connector});
-    
+    jettyServer.setConnectors(new Connector[] { connector });
+
     if (!StringUtils.isBlank(bindAddress)) {
       connector.setHost(bindAddress);
     }
-    
+
 
     if (bindAddress != null && !bindAddress.isEmpty()) {
       JettyHelper.bindAddress = bindAddress;
     }
-    
+
     JettyHelper.port = port;
 
     return jettyServer;
   }
-  
 
 
   public static Server startJetty(final Server jetty) throws Exception {
@@ -148,8 +146,7 @@ public class JettyHelper {
     return jetty;
   }
 
-  public static Server addWebApplication(final Server jetty,
-      final String webAppContext, final String warFilePath) {
+  public static Server addWebApplication(final Server jetty, final String webAppContext,
final String warFilePath) {
     WebAppContext webapp = new WebAppContext();
     webapp.setContextPath(webAppContext);
     webapp.setWar(warFilePath);
@@ -166,60 +163,49 @@ public class JettyHelper {
   }
 
 
-
   private static String getWebAppBaseDirectory(final String context) {
     String underscoredContext = context.replace("/", "_");
-    final String workingDirectory = USER_DIR
-        .concat(FILE_PATH_SEPARATOR)
-        .concat("GemFire_" + USER_NAME)
-        .concat(FILE_PATH_SEPARATOR)
-        .concat("services")
-        .concat(FILE_PATH_SEPARATOR)
-        .concat("http")
-        .concat(FILE_PATH_SEPARATOR)
-        .concat(
-            (StringUtils.isBlank(bindAddress)) ? "0.0.0.0" : bindAddress)
-        .concat("_")
-        .concat(String.valueOf(port)
-        .concat(underscoredContext));
+    final String workingDirectory = USER_DIR.concat(FILE_PATH_SEPARATOR)
+                                            .concat("GemFire_" + USER_NAME)
+                                            .concat(FILE_PATH_SEPARATOR)
+                                            .concat("services")
+                                            .concat(FILE_PATH_SEPARATOR)
+                                            .concat("http")
+                                            .concat(FILE_PATH_SEPARATOR)
+                                            .concat((StringUtils.isBlank(bindAddress)) ?
"0.0.0.0" : bindAddress)
+                                            .concat("_")
+                                            .concat(String.valueOf(port).concat(underscoredContext));
 
     return workingDirectory;
   }
 
   private static final CountDownLatch latch = new CountDownLatch(1);
 
-  private static String normalizeWebAppArchivePath(
-      final String webAppArchivePath) {
-    return (webAppArchivePath.startsWith(File.separator) ? new File(
-        webAppArchivePath) :
-        new File(".", webAppArchivePath)).getAbsolutePath();
+  private static String normalizeWebAppArchivePath(final String webAppArchivePath) {
+    return (webAppArchivePath.startsWith(File.separator) ? new File(webAppArchivePath) :
new File(".", webAppArchivePath)).getAbsolutePath();
   }
 
   private static String normalizeWebAppContext(final String webAppContext) {
-    return (webAppContext.startsWith(
-        "/") ? webAppContext : "/" + webAppContext);
+    return (webAppContext.startsWith("/") ? webAppContext : "/" + webAppContext);
   }
 
   public static void main(final String... args) throws Exception {
     if (args.length > 1) {
       System.out.printf("Temporary Directory @ ($1%s)%n", USER_DIR);
 
-      final Server jetty = JettyHelper.initJetty(null, 8090, false, false, null, null, null);
+      final Server jetty = JettyHelper.initJetty(null, 8090, SSLConfigurationFactory.getSSLConfigForComponent(SSLEnabledComponent.HTTP_SERVICE));
 
       for (int index = 0; index < args.length; index += 2) {
         final String webAppContext = args[index];
         final String webAppArchivePath = args[index + 1];
 
-        JettyHelper.addWebApplication(jetty,
-            normalizeWebAppContext(webAppContext),
-            normalizeWebAppArchivePath(webAppArchivePath));
+        JettyHelper.addWebApplication(jetty, normalizeWebAppContext(webAppContext), normalizeWebAppArchivePath(webAppArchivePath));
       }
 
       JettyHelper.startJetty(jetty);
       latch.await();
     } else {
-      System.out.printf(
-          "usage:%n>java com.gemstone.gemfire.management.internal.TomcatHelper <web-app-context>
<war-file-path> [<web-app-context> <war-file-path>]*");
+      System.out.printf("usage:%n>java com.gemstone.gemfire.management.internal.TomcatHelper
<web-app-context> <war-file-path> [<web-app-context> <war-file-path>]*");
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
index bb9bfb4..9a8f83a 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
@@ -57,6 +57,8 @@ import com.gemstone.gemfire.internal.GemFireVersion;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.lang.StringUtils;
 import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.net.SSLConfigurationFactory;
+import com.gemstone.gemfire.internal.net.SSLEnabledComponent;
 import com.gemstone.gemfire.internal.net.SocketCreator;
 import com.gemstone.gemfire.internal.net.SocketCreatorFactory;
 import com.gemstone.gemfire.internal.security.shiro.JMXShiroAuthenticator;
@@ -224,8 +226,7 @@ public class ManagementAgent {
 
           boolean isRestWebAppAdded = false;
 
-          this.httpServer = JettyHelper.initJetty(bindAddress, port, this.config.getHttpServiceSSLEnabled(),
this.config.getHttpServiceSSLRequireAuthentication(), this.config
-            .getHttpServiceSSLProtocols(), this.config.getHttpServiceSSLCiphers(), this.config.getHttpServiceSSLProperties());
+          this.httpServer = JettyHelper.initJetty(bindAddress, port, SSLConfigurationFactory.getSSLConfigForComponent(SSLEnabledComponent.HTTP_SERVICE));
 
           if (agentUtil.isWebApplicationAvailable(gemfireWar)) {
             this.httpServer = JettyHelper.addWebApplication(this.httpServer, "/gemfire",
gemfireWar);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
index 53f0894..033b9bd 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
@@ -20,6 +20,9 @@ package com.gemstone.gemfire.management.internal;
 import com.gemstone.gemfire.cache.*;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.admin.SSLConfig;
+import com.gemstone.gemfire.internal.net.SSLConfigurationFactory;
+import com.gemstone.gemfire.internal.net.SSLEnabledComponent;
 import com.gemstone.gemfire.internal.net.SocketCreator;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
@@ -126,11 +129,7 @@ public class RestAgent {
 
         final int port = this.config.getHttpServicePort();
 
-        this.httpServer = JettyHelper.initJetty(httpServiceBindAddress, port,
-            this.config.getHttpServiceSSLEnabled(),
-            this.config.getHttpServiceSSLRequireAuthentication(),
-            this.config.getHttpServiceSSLProtocols(), this.config.getHttpServiceSSLCiphers(),
-            this.config.getHttpServiceSSLProperties());
+        this.httpServer = JettyHelper.initJetty(httpServiceBindAddress, port, SSLConfigurationFactory.getSSLConfigForComponent(SSLEnabledComponent.HTTP_SERVICE));
 
         this.httpServer = JettyHelper.addWebApplication(httpServer, "/gemfire-api", gemfireAPIWar);
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
index 5c62a31..a813248 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
@@ -359,6 +359,7 @@ public class DistributionConfigJUnitTest {
   @Test
   public void testSSLEnabledComponents() {
     Properties props = new Properties();
+    props.put(MCAST_PORT, "0");
     props.put(CLUSTER_SSL_ENABLED, "true");
     props.put(SSL_ENABLED_COMPONENTS, "all");
 
@@ -368,6 +369,7 @@ public class DistributionConfigJUnitTest {
   @Test(expected = IllegalArgumentException.class)
   public void testSSLEnabledComponentsLegacyFail() {
     Properties props = new Properties();
+    props.put(MCAST_PORT, "0");
     props.put(CLUSTER_SSL_ENABLED, "true");
     props.put(HTTP_SERVICE_SSL_ENABLED, "true");
     props.put(SSL_ENABLED_COMPONENTS, "all");
@@ -377,6 +379,7 @@ public class DistributionConfigJUnitTest {
   @Test
   public void testSSLEnabledComponentsLegacyPass() {
     Properties props = new Properties();
+    props.put(MCAST_PORT, "0");
     props.put(CLUSTER_SSL_ENABLED, "true");
     props.put(HTTP_SERVICE_SSL_ENABLED, "true");
     props.put(SSL_ENABLED_COMPONENTS, "");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
index c90a263..d9a1d1b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
@@ -683,10 +683,7 @@ public class InternalDistributedSystemJUnitTest
 
   @Test
   public void testDeprecatedSSLProps() {
-    Properties props = new Properties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "");
-    props.setProperty(CLUSTER_SSL_ENABLED, "true");
+    Properties props = getCommonProperties();
     Config config1 = new DistributionConfigImpl(props, false);
     Properties props1 = config1.toProperties();
     // For the deprecated ssl-* properties a decision was made
@@ -706,13 +703,10 @@ public class InternalDistributedSystemJUnitTest
 
   @Test
   public void testSSLEnabledComponents() {
-    Properties props = new Properties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "");
-    props.setProperty(CLUSTER_SSL_ENABLED, "true");
+    Properties props = getCommonProperties();
     props.setProperty(SSL_ENABLED_COMPONENTS, "cluster,server");
     Config config1 = new DistributionConfigImpl(props, false);
-    assertEquals("cluster,server", config1.getAttribute(SSL_ENABLED_COMPONENTS));
+    assertEquals("cluster server", config1.getAttribute(SSL_ENABLED_COMPONENTS));
   }
 
   @Rule
@@ -720,10 +714,7 @@ public class InternalDistributedSystemJUnitTest
 
   @Test(expected = IllegalArgumentException.class)
   public void testSSLEnabledComponentsWrongComponentName() {
-    Properties props = new Properties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "");
-    props.setProperty(CLUSTER_SSL_ENABLED, "true");
+    Properties props = getCommonProperties();
     props.setProperty(SSL_ENABLED_COMPONENTS, "testing");
     new DistributionConfigImpl(props, false);
     illegalArgumentException.expect(IllegalArgumentException.class);
@@ -733,10 +724,9 @@ public class InternalDistributedSystemJUnitTest
 
   @Test(expected = IllegalArgumentException.class)
   public void testSSLEnabledComponentsWithLegacyJMXSSLSettings() {
-    Properties props = new Properties();
-    props.setProperty(CLUSTER_SSL_ENABLED, "true");
-    props.setProperty(JMX_MANAGER_SSL_ENABLED, "true");
+    Properties props = getCommonProperties();
     props.setProperty(SSL_ENABLED_COMPONENTS, "all");
+    props.setProperty(JMX_MANAGER_SSL_ENABLED, "true");
     new DistributionConfigImpl(props, false);
     illegalArgumentException.expect(IllegalArgumentException.class);
     illegalArgumentException.expectMessage(LocalizedStrings.AbstractDistributionConfig_SSL_ENABLED_COMPONENTS_SET_INVALID_DEPRECATED_SSL_SET.getRawText());
@@ -744,10 +734,9 @@ public class InternalDistributedSystemJUnitTest
 
   @Test(expected = IllegalArgumentException.class)
   public void testSSLEnabledComponentsWithLegacyGatewaySSLSettings() {
-    Properties props = new Properties();
-    props.setProperty(CLUSTER_SSL_ENABLED, "true");
-    props.setProperty(GATEWAY_SSL_ENABLED, "true");
+    Properties props = getCommonProperties();
     props.setProperty(SSL_ENABLED_COMPONENTS, "all");
+    props.setProperty(GATEWAY_SSL_ENABLED, "true");
     new DistributionConfigImpl(props, false);
 
     illegalArgumentException.expect(IllegalArgumentException.class);
@@ -756,10 +745,9 @@ public class InternalDistributedSystemJUnitTest
 
   @Test(expected = IllegalArgumentException.class)
   public void testSSLEnabledComponentsWithLegacyServerSSLSettings() {
-    Properties props = new Properties();
-    props.setProperty(CLUSTER_SSL_ENABLED, "true");
-    props.setProperty(SERVER_SSL_ENABLED, "true");
+    Properties props = getCommonProperties();
     props.setProperty(SSL_ENABLED_COMPONENTS, "all");
+    props.setProperty(SERVER_SSL_ENABLED, "true");
     new DistributionConfigImpl(props, false);
 
     illegalArgumentException.expect(IllegalArgumentException.class);
@@ -768,16 +756,23 @@ public class InternalDistributedSystemJUnitTest
 
   @Test(expected = IllegalArgumentException.class)
   public void testSSLEnabledComponentsWithLegacyHTTPServiceSSLSettings() {
-    Properties props = new Properties();
-    props.setProperty(CLUSTER_SSL_ENABLED, "true");
-    props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    Properties props = getCommonProperties();
     props.setProperty(SSL_ENABLED_COMPONENTS, "all");
+    props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
     new DistributionConfigImpl(props, false);
 
     illegalArgumentException.expect(IllegalArgumentException.class);
     illegalArgumentException.expectMessage(LocalizedStrings.AbstractDistributionConfig_SSL_ENABLED_COMPONENTS_SET_INVALID_DEPRECATED_SSL_SET.getRawText());
   }
 
+  private Properties getCommonProperties() {
+    Properties props = new Properties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "");
+    props.setProperty(CLUSTER_SSL_ENABLED, "true");
+    return props;
+  }
+
   public static String getHostAddress(InetAddress addr) {
     String address = addr.getHostAddress();
     if (addr instanceof Inet4Address || (!addr.isLinkLocalAddress() && !addr.isLoopbackAddress()))
{

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/test/java/com/gemstone/gemfire/internal/net/JSSESocketJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/net/JSSESocketJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/net/JSSESocketJUnitTest.java
index 63c556b..bbcce71 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/net/JSSESocketJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/net/JSSESocketJUnitTest.java
@@ -29,6 +29,7 @@ import java.io.StringReader;
 import java.net.InetAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
+import java.util.Properties;
 
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
@@ -46,6 +47,7 @@ import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
 import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.test.dunit.ThreadUtils;
@@ -120,6 +122,9 @@ public class JSSESocketJUnitTest {
         System.setProperty("javax.net.ssl.keyStorePassword", "password");
       }
 
+      DistributionConfigImpl distributionConfig = new DistributionConfigImpl(new Properties());
+
+      SocketCreatorFactory.setDistributionConfig(distributionConfig);
       assertTrue(SocketCreatorFactory.getClusterSSLSocketCreator().useSSL());
 
       final ServerSocket serverSocket = SocketCreatorFactory.getClusterSSLSocketCreator().createServerSocket(randport,
0, InetAddress.getByName("localhost"));
@@ -174,7 +179,9 @@ public class JSSESocketJUnitTest {
   @Test
   public void testClientSocketFactory() {
     System.getProperties().put(DistributionConfig.GEMFIRE_PREFIX + "clientSocketFactory",
TSocketFactory.class.getName());
-    System.getProperties().remove(DistributionConfig.GEMFIRE_PREFIX + CLUSTER_SSL_ENABLED);
+    System.getProperties().put(DistributionConfig.GEMFIRE_PREFIX + CLUSTER_SSL_ENABLED, "false");
+    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(new Properties());
+    SocketCreatorFactory.setDistributionConfig(distributionConfig);
     factoryInvoked = false;
     try {
       try {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/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 c4d6846..442467f 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
@@ -123,6 +123,7 @@ public class SocketCreatorFactoryJUnitTest extends JSSESocketJUnitTest
{
     Properties properties = configureSSLProperties(SSLEnabledComponents.SERVER);
 
     DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
+
     SocketCreatorFactory.setDistributionConfig(distributionConfig);
 
     Assert.assertFalse(SocketCreatorFactory.getClusterSSLSocketCreator().useSSL());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/JettyHelperJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/JettyHelperJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/JettyHelperJUnitTest.java
index 1c66780..b53f39c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/JettyHelperJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/JettyHelperJUnitTest.java
@@ -23,6 +23,10 @@ import org.eclipse.jetty.server.ServerConnector;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import com.gemstone.gemfire.internal.admin.SSLConfig;
+import com.gemstone.gemfire.internal.net.SSLConfigurationFactory;
+import com.gemstone.gemfire.internal.net.SSLEnabledComponent;
+import com.gemstone.gemfire.internal.net.SocketCreatorFactory;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 /**
@@ -40,7 +44,7 @@ public class JettyHelperJUnitTest {
   @Test
   public void testSetPortNoBindAddress() throws Exception {
 
-    final Server jetty = JettyHelper.initJetty(null, 8090, false, false, null, null, null);
+    final Server jetty = JettyHelper.initJetty(null, 8090, SSLConfigurationFactory.getSSLConfigForComponent(SSLEnabledComponent.HTTP_SERVICE));
 
     assertNotNull(jetty);
     assertNotNull(jetty.getConnectors()[0]);
@@ -50,7 +54,7 @@ public class JettyHelperJUnitTest {
   @Test
   public void testSetPortWithBindAddress() throws Exception {
 
-    final Server jetty = JettyHelper.initJetty("10.123.50.1", 10480, false, false, null,
null, null);
+    final Server jetty = JettyHelper.initJetty("10.123.50.1", 10480, SSLConfigurationFactory.getSSLConfigForComponent(SSLEnabledComponent.HTTP_SERVICE));
 
     assertNotNull(jetty);
     assertNotNull(jetty.getConnectors()[0]);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
index 5704ad7..2e61c23 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
@@ -785,7 +785,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
     // Start the default manager
     Properties managerProps = new Properties();
     managerProps.setProperty(MCAST_PORT, "0");
-    managerProps.setProperty(LOCATORS, "localhost:" + locatorPort);
+    managerProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
     setUpJmxManagerOnVm0ThenConnect(managerProps);
 
     // Create a cache in VM 1
@@ -793,7 +793,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
     vm.invoke(() -> {
       Properties localProps = new Properties();
       localProps.setProperty(MCAST_PORT, "0");
-      localProps.setProperty(LOCATORS, "localhost:" + locatorPort);
+      localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
       localProps.setProperty(GROUPS, groupName);
       getSystem(localProps);
       assertNotNull(getCache());
@@ -831,7 +831,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
 
       Properties localProps = new Properties();
       localProps.setProperty(MCAST_PORT, "0");
-      localProps.setProperty(LOCATORS, "localhost:" + locatorPort);
+      localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
       localProps.setProperty(GROUPS, groupName);
       localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
       getSystem(localProps);
@@ -873,7 +873,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
 
         Properties localProps = new Properties();
         localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost:" + locatorPort);
+        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
         localProps.setProperty(GROUPS, groupName);
         localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
         getSystem(localProps);
@@ -919,7 +919,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
     // Start the default manager
     Properties managerProps = new Properties();
     managerProps.setProperty(MCAST_PORT, "0");
-    managerProps.setProperty(LOCATORS, "localhost:" + locatorPort);
+    managerProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
     setUpJmxManagerOnVm0ThenConnect(managerProps);
 
     // Create a cache in VM 1
@@ -927,7 +927,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
     vm.invoke(() -> {
       Properties localProps = new Properties();
       localProps.setProperty(MCAST_PORT, "0");
-      localProps.setProperty(LOCATORS, "localhost:" + locatorPort);
+      localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
       localProps.setProperty(GROUPS, groupName);
       getSystem(localProps);
       assertNotNull(getCache());
@@ -983,7 +983,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
 
       Properties localProps = new Properties();
       localProps.setProperty(MCAST_PORT, "0");
-      localProps.setProperty(LOCATORS, "localhost:" + locatorPort);
+      localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
       localProps.setProperty(GROUPS, groupName);
       localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
       getSystem(localProps);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
index bed3cad..46744ed 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
@@ -31,6 +31,7 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.net.SSLConfigurationFactory;
 import com.gemstone.gemfire.internal.net.SocketCreator;
 import com.gemstone.gemfire.internal.admin.ClientStatsManager;
 import com.gemstone.gemfire.internal.cache.*;
@@ -155,6 +156,7 @@ public abstract class JUnit4DistributedTestCase implements DistributedTestFixtur
     if (system == null || !system.isConnected()) {
       // Figure out our distributed system properties
       SocketCreatorFactory.close();
+      SSLConfigurationFactory.close();
       Properties p = DistributedTestUtils.getAllDistributedSystemProperties(props);
       lastSystemCreatedInTest = getTestClass(); // used to be getDeclaringClass()
       if (logPerTest) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
index 24ba815..35339d7 100644
--- a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
+++ b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
@@ -35,6 +35,8 @@ import org.openqa.selenium.firefox.FirefoxDriver;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 import org.openqa.selenium.support.ui.WebDriverWait;
 
+import com.gemstone.gemfire.internal.net.SSLConfigurationFactory;
+import com.gemstone.gemfire.internal.net.SSLEnabledComponent;
 import com.gemstone.gemfire.management.internal.JettyHelper;
 import com.gemstone.gemfire.test.junit.categories.UITest;
 import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Locator;
@@ -70,7 +72,7 @@ public class PulseUITest {
     path = getPulseWarPath();
     //System.setProperty("pulse.propMockDataUpdaterClass", "com.vmware.gemfire.tools.pulse.testbed.PropMockDataUpdater");
 
-    jetty = JettyHelper.initJetty(host, port, false, false, null, null, null);
+    jetty = JettyHelper.initJetty(host, port, SSLConfigurationFactory.getSSLConfigForComponent(SSLEnabledComponent.HTTP_SERVICE));
     JettyHelper.addWebApplication(jetty, context, getPulseWarPath());
     jetty.start();
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9891f06e/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseAbstractTest.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseAbstractTest.java
b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseAbstractTest.java
index 23c7f75..e5cd058 100644
--- a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseAbstractTest.java
+++ b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseAbstractTest.java
@@ -44,6 +44,8 @@ import org.openqa.selenium.support.ui.ExpectedCondition;
 import org.openqa.selenium.support.ui.ExpectedConditions;
 import org.openqa.selenium.support.ui.WebDriverWait;
 
+import com.gemstone.gemfire.internal.net.SSLConfigurationFactory;
+import com.gemstone.gemfire.internal.net.SSLEnabledComponent;
 import com.gemstone.gemfire.management.internal.JettyHelper;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
 
@@ -145,7 +147,7 @@ public abstract class PulseAbstractTest extends PulseBaseTest {
     int port = 8080;
     String context = "/pulse";
 
-    jetty = JettyHelper.initJetty(host, port, false, false, null, null, null);
+    jetty = JettyHelper.initJetty(host, port, SSLConfigurationFactory.getSSLConfigForComponent(SSLEnabledComponent.HTTP_SERVICE));
     JettyHelper.addWebApplication(jetty, context, getPulseWarPath());
     jetty.start();
 


Mime
View raw message