You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2017/08/11 17:26:34 UTC

[04/23] geode git commit: GEODE-3397: Fixed issue with Tomcat locators in cache-client.xml file

GEODE-3397: Fixed issue with Tomcat locators in cache-client.xml file

This closes #688


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

Branch: refs/heads/feature/GEODE-3304
Commit: 1bd15f8a27b9875d65910bd8ad51bd32122bc002
Parents: 8a6e309
Author: David Anuta <da...@gmail.com>
Authored: Fri Aug 4 13:26:24 2017 -0700
Committer: Jason Huynh <hu...@gmail.com>
Committed: Thu Aug 10 13:11:18 2017 -0700

----------------------------------------------------------------------
 .../geode/session/tests/ContainerInstall.java   | 20 ++++++++++++++++----
 .../geode/session/tests/ServerContainer.java    |  2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/1bd15f8a/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java b/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java
index 45b8668..9d03417 100644
--- a/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java
+++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/ContainerInstall.java
@@ -419,13 +419,25 @@ public abstract class ContainerInstall {
       DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
       Document doc = docBuilder.parse(XMLPath);
 
+      Node node = null;
       // Get node with specified tagId
-      Node node = findNodeWithAttribute(doc, tagName, "id", tagId);
+      if (tagId != null) {
+        node = findNodeWithAttribute(doc, tagName, "id", tagId);
+      } else if (writeOnSimilarAttributeNames) {
+        NodeList nodes = doc.getElementsByTagName(tagName);
+        for (int i = 0; i < nodes.getLength(); i++) {
+          Node n = nodes.item(i);
+          if (nodeHasExactAttributes(n, attributes, false)) {
+            node = n;
+            break;
+          }
+        }
+      }
       // If no node is found
-      if (node != null
-          || (writeOnSimilarAttributeNames && nodeHasExactAttributes(node, attributes, false))) {
+      if (node != null) {
         rewriteNodeAttributes(node, attributes);
-        ((Element) node).setAttribute("id", tagId);
+        if (tagId != null)
+          ((Element) node).setAttribute("id", tagId);
       } else {
         Element e = doc.createElement(tagName);
         // Set id attribute

http://git-wip-us.apache.org/repos/asf/geode/blob/1bd15f8a/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java b/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
index 94a13e9..dbd438a 100644
--- a/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
+++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/ServerContainer.java
@@ -368,7 +368,7 @@ public abstract class ServerContainer {
       attributes.put("port", Integer.toString(locatorPort));
 
       ContainerInstall.editXMLFile(getSystemProperty("cache-xml-file"), "locator", "pool",
-          attributes);
+          attributes, true);
     } else {
       setSystemProperty("locators", locatorAddress + "[" + locatorPort + "]");
     }