You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bo...@apache.org on 2018/07/31 19:01:49 UTC

[geode] branch feature/GEODE-5502 updated: GEODe-5502: Added additional tests

This is an automated email from the ASF dual-hosted git repository.

boglesby pushed a commit to branch feature/GEODE-5502
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-5502 by this push:
     new 2c449f2  GEODe-5502: Added additional tests
2c449f2 is described below

commit 2c449f265cfa5e01c8677a8166ec515467102fbf
Author: Barry Oglesby <bo...@pivotal.io>
AuthorDate: Tue Jul 31 12:01:20 2018 -0700

    GEODe-5502: Added additional tests
---
 ...InternalConfigurationPersistenceServiceTest.java | 21 +++++++++++++++++++++
 ...tipleReceiversDefinedInClusterConfiguration.java | 10 ++++++++++
 2 files changed, 31 insertions(+)

diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java
index 5563cbf..dbc4375 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java
@@ -251,6 +251,17 @@ public class InternalConfigurationPersistenceServiceTest {
   }
 
   @Test
+  public void keepValidGatewayReceiversWithDefaultBindAddress() throws Exception {
+    Document document =
+        XmlUtils.createDocumentFromXml(getSingleReceiverWithDefaultBindAddressXml());
+    System.out.println("Initial document:\n" + XmlUtils.prettyXml(document));
+    assertThat(document.getElementsByTagName("gateway-receiver").getLength()).isEqualTo(1);
+    service.removeInvalidGatewayReceivers(document);
+    System.out.println("Processed document:\n" + XmlUtils.prettyXml(document));
+    assertThat(document.getElementsByTagName("gateway-receiver").getLength()).isEqualTo(1);
+  }
+
+  @Test
   @Parameters(method = "getXmlAndExpectedElements")
   public void removeInvalidXmlConfiguration(String xml, int expectedInitialElements,
       int expectFinalElements) throws Exception {
@@ -282,6 +293,14 @@ public class InternalConfigurationPersistenceServiceTest {
     return "<cache>\n<gateway-receiver bind-address=\"123.12.12.12\"/>\n<gateway-receiver bind-address=\"123.12.12.11\"/>\n</cache>";
   }
 
+  private String getSingleReceiverWithDefaultBindAddressXml() {
+    return "<cache>\n<gateway-receiver bind-address=\"0.0.0.0\"/>\n</cache>";
+  }
+
+  private String getDuplicateReceiversWithDefaultBindAddressesXml() {
+    return "<cache>\n<gateway-receiver bind-address=\"0.0.0.0\"/>\n<gateway-receiver bind-address=\"0.0.0.0\"/>\n</cache>";
+  }
+
   private String getValidReceiversXml() {
     return "<cache>\n<gateway-receiver/>\n</cache>";
   }
@@ -291,6 +310,8 @@ public class InternalConfigurationPersistenceServiceTest {
         new Object[] {getDuplicateReceiversWithDefaultPropertiesXml(), 2, 1},
         new Object[] {getDuplicateReceiversWithDifferentHostNameForSendersXml(), 2, 0},
         new Object[] {getDuplicateReceiversWithDifferentBindAddressesXml(), 2, 0},
+        new Object[] {getSingleReceiverWithDefaultBindAddressXml(), 1, 1},
+        new Object[] {getDuplicateReceiversWithDefaultBindAddressesXml(), 2, 1},
         new Object[] {getValidReceiversXml(), 1, 1});
   }
 }
diff --git a/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeMultipleReceiversDefinedInClusterConfiguration.java b/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeMultipleReceiversDefinedInClusterConfiguration.java
index aa34424..aecd3e5 100644
--- a/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeMultipleReceiversDefinedInClusterConfiguration.java
+++ b/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeMultipleReceiversDefinedInClusterConfiguration.java
@@ -78,6 +78,9 @@ public class WANRollingUpgradeMultipleReceiversDefinedInClusterConfiguration
       // Add a case for multiple receivers with default attributes
       addMultipleReceiversWithDefaultAttributes(result, version);
 
+      // Add a case for single receiver with default bind-address
+      addSingleReceiverWithDefaultBindAddress(result, version);
+
       // Add a case for single receiver with default attributes
       addSingleReceiverWithDefaultAttributes(result, version);
     });
@@ -129,6 +132,13 @@ public class WANRollingUpgradeMultipleReceiversDefinedInClusterConfiguration
     result.add(new Object[] {version, attributes, 1, 1});
   }
 
+  private static void addSingleReceiverWithDefaultBindAddress(List<Object[]> result,
+      String version) {
+    List<Attribute> attributes = new ArrayList<>();
+    attributes.add(new Attribute("bind-address", "0.0.0.0"));
+    result.add(new Object[] {version, attributes, 1, 1});
+  }
+
   @Test
   public void testMultipleReceiversRemovedDuringRoll() throws Exception {
     // Get old locator properties