geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [geode] branch develop updated: GEODE-6281: RegionHelper.generateCacheXml should not include entry va… (#3080)
Date Wed, 16 Jan 2019 21:42:47 GMT
This is an automated email from the ASF dual-hosted git repository.

jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4f300f9  GEODE-6281: RegionHelper.generateCacheXml should not include entry va…
(#3080)
4f300f9 is described below

commit 4f300f91f06961189192980d958a7149a873d191
Author: jinmeiliao <jiliao@pivotal.io>
AuthorDate: Wed Jan 16 13:42:30 2019 -0800

    GEODE-6281: RegionHelper.generateCacheXml should not include entry va… (#3080)
    
    * GEODE-6281: RegionHelper.generateCacheXml should not include entry values in the generated
xml to avoid OOME.
---
 .../modules/util/RegionHelperIntegrationTest.java  | 42 ++++++++++++++++++++++
 .../apache/geode/modules/util/RegionHelper.java    |  2 +-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/extensions/geode-modules/src/integrationTest/java/org/apache/geode/modules/util/RegionHelperIntegrationTest.java
b/extensions/geode-modules/src/integrationTest/java/org/apache/geode/modules/util/RegionHelperIntegrationTest.java
new file mode 100644
index 0000000..c776226
--- /dev/null
+++ b/extensions/geode-modules/src/integrationTest/java/org/apache/geode/modules/util/RegionHelperIntegrationTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information
regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version
2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain
a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express
+ * or implied. See the License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package org.apache.geode.modules.util;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.test.junit.rules.ServerStarterRule;
+
+public class RegionHelperIntegrationTest {
+  @ClassRule
+  public static ServerStarterRule server =
+      new ServerStarterRule().withNoCacheServer().withRegion(RegionShortcut.REPLICATE, "test");
+
+  @Test
+  public void generateXml() throws Exception {
+    Region region = server.getCache().getRegion("/test");
+    region.put("key", "value");
+    String cacheXml = RegionHelper.generateCacheXml(server.getCache());
+
+    // make sure the generated cache.xml skips region entries
+    assertThat(cacheXml).doesNotContain("<entry>")
+        .doesNotContain("<string>key</string>")
+        .doesNotContain("<string>value</string>");
+  }
+}
diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java
b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java
index 9a21cac..f22bdee 100644
--- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java
+++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java
@@ -110,7 +110,7 @@ public class RegionHelper {
     try {
       StringWriter sw = new StringWriter();
       PrintWriter pw = new PrintWriter(sw, true);
-      CacheXmlGenerator.generate(cache, pw);
+      CacheXmlGenerator.generate(cache, pw, true, false);
       pw.close();
       return sw.toString();
     } catch (Exception ex) {


Mime
View raw message