You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2015/10/16 22:58:17 UTC
[3/3] incubator-geode git commit: GEODE-405: sameAs needs to ignore
ssl-* properties
GEODE-405: sameAs needs to ignore ssl-* properties
Since toProperties does not include ssl-* properties
sameAs needs to also ignore ssl-* properties.
Since the ssl-* are always copied to cluster-ssl-*
and sameAs compares these it will still return false
if the ssl-* properties had different values.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e45f5e3a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e45f5e3a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e45f5e3a
Branch: refs/heads/develop
Commit: e45f5e3aa5cdb9e47016154df5eae220a9a1d9ae
Parents: fbe8c37
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed Oct 14 16:23:56 2015 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Fri Oct 16 13:51:47 2015 -0700
----------------------------------------------------------------------
.../gemfire/internal/AbstractConfig.java | 6 +++++
.../InternalDistributedSystemJUnitTest.java | 24 ++++++++++++++++++++
2 files changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e45f5e3a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
index 75e4314..2bb047d 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
@@ -276,6 +276,12 @@ public abstract class AbstractConfig implements Config {
String[] validAttributeNames = getAttributeNames();
for (int i=0; i < validAttributeNames.length; i++) {
String attName = validAttributeNames[i];
+ if (this.isDeprecated(attName)) {
+ // since toProperties skips isDeprecated sameAs
+ // needs to also skip them.
+ // See GEODE-405.
+ continue;
+ }
Object thisAtt = this.getAttributeObject(attName);
Object otherAtt = other.getAttributeObject(attName);
if (thisAtt == otherAtt) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e45f5e3a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
index 88a0654..3af05cb 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
@@ -704,6 +704,7 @@ public class InternalDistributedSystemJUnitTest
try {
sys.validateSameProperties(config2.toProperties(), true);
+ fail("should have detected different mcast-ports");
} catch (IllegalStateException iex) {
// This passes the test
}
@@ -712,6 +713,29 @@ public class InternalDistributedSystemJUnitTest
sys.disconnect();
}
}
+ @Test
+ public void testDeprecatedSSLProps() {
+ Properties props = new Properties();
+ props.setProperty("mcast-port", "0");
+ props.setProperty("locators", "");
+ props.setProperty("ssl-enabled", "true");
+ Config config1 = new DistributionConfigImpl(props, false);
+ Properties props1 = config1.toProperties();
+ // For the deprecated ssl-* properties a decision was made
+ // to not include them in the result of "toProperties".
+ // The cause of this is: com.gemstone.gemfire.internal.AbstractConfig.isDeprecated(String)
+ // and its use in toProperties.
+ // The other thing that is done is the ssl-* props are copied to cluster-ssl-*.
+ // The following two assertions demonstrate this.
+ assertEquals(null, props1.getProperty("ssl-enabled"));
+ assertEquals("true", props1.getProperty("cluster-ssl-enabled"));
+ Config config2 = new DistributionConfigImpl(props1, false);
+ assertEquals(true, config1.sameAs(config2));
+ Properties props3 = new Properties(props1);
+ props3.setProperty("ssl-enabled", "false");
+ Config config3 = new DistributionConfigImpl(props3, false);
+ assertEquals(false, config1.sameAs(config3));
+ }
public static String getHostAddress(InetAddress addr) {
String address = addr.getHostAddress();
if (addr instanceof Inet4Address