Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-2156 3e84342bd -> 13a046b41 (forced update)


GEODE-1955: make the tests more stable

* added the ignored tests back and mark them as flaky
* revert unwanted checkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/b633f679
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/b633f679
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/b633f679

Branch: refs/heads/feature/GEODE-2156
Commit: b633f6791fd2a36c29817a8935a30e0847505687
Parents: f67554b
Author: Jinmei Liao <jil...@pivotal.io>
Authored: Mon Nov 28 11:23:14 2016 -0800
Committer: Jinmei Liao <jil...@pivotal.io>
Committed: Wed Nov 30 10:23:54 2016 -0800

----------------------------------------------------------------------
 .../distributed/ConfigurationProperties.java    |  7 ++++++
 .../internal/DistributionConfig.java            | 24 +++++++++++--------
 .../internal/net/SSLConfigurationFactory.java   | 11 +++++----
 .../internal/cli/shell/JmxOperationInvoker.java |  3 ++-
 .../ConnectToLocatorSSLDUnitTest.java           | 25 +++++++++++++++-----
 5 files changed, 48 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b633f679/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
 
b/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
index c58a398..536e4b6 100644
--- 
a/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
+++ 
b/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
@@ -165,7 +165,10 @@ public interface ConfigurationProperties {
    * with other <i>cluster-ssl-*</i> properties property <a 
name="cluster-ssl"/a>
    * </p>
    * <U>Description</U>: The cluster-ssl property prefix
+   *
+   * @deprecated Since Geode1.0, use ssl-* properties and 
ssl-enabled-components
    */
+  @Deprecated
   String CLUSTER_SSL_PREFIX = "cluster-ssl";
 
   /**
@@ -827,8 +830,12 @@ public interface ConfigurationProperties {
    * </p>
    * <U>Default</U>: Optional
    * </p>
+   * 
+   * @deprecated Since Geode1.0, use ssl-* properties and 
ssl-enabled-components
    */
+  @Deprecated
   String JMX_MANAGER_SSL_PREFIX = "jmx-manager-ssl-";
+
   /**
    * The static String definition of the <i>"jmx-manager"</i> property <a 
name="jmx-manager"/a>
    * </p>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b633f679/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
index 3a2660c..5eb070d 100644
--- 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
+++ 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
@@ -17,6 +17,16 @@ package org.apache.geode.distributed.internal;
 
 import static org.apache.geode.distributed.ConfigurationProperties.*;
 
+import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.internal.Config;
+import org.apache.geode.internal.ConfigSource;
+import org.apache.geode.internal.logging.InternalLogWriter;
+import org.apache.geode.internal.logging.LogConfig;
+import org.apache.geode.internal.security.SecurableCommunicationChannel;
+import org.apache.geode.internal.tcp.Connection;
+import org.apache.geode.memcached.GemFireMemcachedServer;
+
 import java.io.File;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -28,16 +38,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.internal.Config;
-import org.apache.geode.internal.ConfigSource;
-import org.apache.geode.internal.logging.InternalLogWriter;
-import org.apache.geode.internal.logging.LogConfig;
-import org.apache.geode.internal.security.SecurableCommunicationChannel;
-import org.apache.geode.internal.tcp.Connection;
-import org.apache.geode.memcached.GemFireMemcachedServer;
-
 /**
  * Provides accessor (and in some cases mutator) methods for the various 
GemFire distribution
  * configuration properties. The interface also provides constants for the 
names of properties and
@@ -53,6 +53,10 @@ import org.apache.geode.memcached.GemFireMemcachedServer;
 public interface DistributionConfig extends Config, LogConfig {
 
   //////////////////// Instance Methods ////////////////////
+  /**
+   * The static String definition of the prefix used to defined ssl-* 
properties
+   */
+  String SSL_PREFIX = "ssl-";
 
   /**
    * The prefix used for Gemfire properties set through java system properties

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b633f679/geode-core/src/main/java/org/apache/geode/internal/net/SSLConfigurationFactory.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/net/SSLConfigurationFactory.java
 
b/geode-core/src/main/java/org/apache/geode/internal/net/SSLConfigurationFactory.java
index 3731d4d..aa61ca3 100644
--- 
a/geode-core/src/main/java/org/apache/geode/internal/net/SSLConfigurationFactory.java
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/net/SSLConfigurationFactory.java
@@ -148,7 +148,7 @@ public class SSLConfigurationFactory {
   private SSLConfig createSSLConfig(final SecurableCommunicationChannel 
sslEnabledComponent) {
     SSLConfig sslConfig = new SSLConfig();
     sslConfig.setCiphers(getDistributionConfig().getSSLCiphers());
-    sslConfig.setEnabled(isSSLEnabledForComponent(getDistributionConfig(), 
sslEnabledComponent));
+    
sslConfig.setEnabled(determineIfSSLEnabledForSSLComponent(sslEnabledComponent));
     sslConfig.setKeystore(getDistributionConfig().getSSLKeyStore());
     
sslConfig.setKeystorePassword(getDistributionConfig().getSSLKeyStorePassword());
     sslConfig.setKeystoreType(getDistributionConfig().getSSLKeyStoreType());
@@ -160,17 +160,18 @@ public class SSLConfigurationFactory {
     return sslConfig;
   }
 
-  public static boolean isSSLEnabledForComponent(DistributionConfig dc,
+  private boolean determineIfSSLEnabledForSSLComponent(
       final SecurableCommunicationChannel sslEnabledComponent) {
-    if (ArrayUtils.contains(dc.getSecurableCommunicationChannels(),
+    if 
(ArrayUtils.contains(getDistributionConfig().getSecurableCommunicationChannels(),
         SecurableCommunicationChannel.NONE)) {
       return false;
     }
-    if (ArrayUtils.contains(dc.getSecurableCommunicationChannels(),
+    if 
(ArrayUtils.contains(getDistributionConfig().getSecurableCommunicationChannels(),
         SecurableCommunicationChannel.ALL)) {
       return true;
     }
-    return ArrayUtils.contains(dc.getSecurableCommunicationChannels(), 
sslEnabledComponent);
+    return 
ArrayUtils.contains(getDistributionConfig().getSecurableCommunicationChannels(),
+        sslEnabledComponent) ? true : false;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b633f679/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
index 0fa47d4..e9d183e 100644
--- 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
@@ -17,6 +17,7 @@ package org.apache.geode.management.internal.cli.shell;
 import static 
org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_PREFIX;
 import static 
org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_SSL_PREFIX;
 
+import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.lang.StringUtils;
 import org.apache.geode.internal.util.ArrayUtils;
 import org.apache.geode.internal.util.IOUtils;
@@ -240,7 +241,7 @@ public class JmxOperationInvoker implements 
OperationInvoker {
       returnKey = key;
     }
     if (key.startsWith(CLUSTER_SSL_PREFIX) || 
key.startsWith(JMX_MANAGER_SSL_PREFIX)
-        || key.startsWith("ssl-")) {
+        || key.startsWith(DistributionConfig.SSL_PREFIX)) {
       if (key.endsWith("keystore")) {
         returnKey = Gfsh.SSL_KEYSTORE;
       } else if (key.endsWith("keystore-password")) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b633f679/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
index 0c16c1a..751425a 100644
--- 
a/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
@@ -43,10 +43,10 @@ import 
org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.FlakyTest;
 import 
org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -91,14 +91,27 @@ public class ConnectToLocatorSSLDUnitTest extends 
JUnit4DistributedTestCase {
 
     GfshShellConnectionRule gfshConnector =
         new GfshShellConnectionRule(lsRule.getPort(0), 
GfshShellConnectionRule.PortType.locator);
-    gfshConnector.connect(CliStrings.CONNECT__SECURITY_PROPERTIES,
-        securityPropsFile.getCanonicalPath());
-    assertTrue(gfshConnector.isConnected());
 
+    // when we connect too soon, we would get "Failed to retrieve RMIServer 
stub:
+    // javax.naming.CommunicationException [Root exception is 
java.rmi.NoSuchObjectException: no
+    // such object in table]" Exception.
+    // Tried to wait on jmx connector server being ready, but it doesn't work.
+    // Add the retry logic here to try at most 10 times for connection.
+    for (int i = 0; i < 10; i++) {
+      gfshConnector.connect(CliStrings.CONNECT__SECURITY_PROPERTIES,
+          securityPropsFile.getCanonicalPath());
+      if (gfshConnector.isConnected()) {
+        break;
+      }
+      Thread.currentThread().sleep(3000);
+    }
+
+    assertTrue(gfshConnector.isConnected());
     gfshConnector.close();
   }
 
   @Test
+  @Category(FlakyTest.class) // GEODE-2099
   public void testConnectToLocatorWithSSLJMX() throws Exception {
     securityProps.setProperty(SSL_ENABLED_COMPONENTS, 
SecurableCommunicationChannels.JMX);
     securityProps.setProperty(SSL_KEYSTORE, jks.getCanonicalPath());
@@ -112,7 +125,7 @@ public class ConnectToLocatorSSLDUnitTest extends 
JUnit4DistributedTestCase {
   }
 
   @Test
-  @Ignore("GEODE-2099")
+  @Category(FlakyTest.class) // GEODE-2099
   public void testConnectToLocatorWithLegacyClusterSSL() throws Exception {
     securityProps.setProperty(CLUSTER_SSL_ENABLED, "true");
     securityProps.setProperty(CLUSTER_SSL_KEYSTORE, jks.getCanonicalPath());
@@ -125,7 +138,7 @@ public class ConnectToLocatorSSLDUnitTest extends 
JUnit4DistributedTestCase {
   }
 
   @Test
-  @Ignore("GEODE-2099")
+  @Category(FlakyTest.class) // GEODE-2099
   public void testConnectToLocatorWithLegacyJMXSSL() throws Exception {
     securityProps.setProperty(JMX_MANAGER_SSL_ENABLED, "true");
     securityProps.setProperty(JMX_MANAGER_SSL_KEYSTORE, 
jks.getCanonicalPath());

Reply via email to