You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2019/04/12 00:50:52 UTC

[geode] branch develop updated: GEODE-6633: Remove JSON pretty printing from PdxToJSON (#3444)

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

jensdeppe 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 339196b  GEODE-6633: Remove JSON pretty printing from PdxToJSON (#3444)
339196b is described below

commit 339196b24b11c3d4e2763ea64298531ff3ecc9ff
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Thu Apr 11 17:50:40 2019 -0700

    GEODE-6633: Remove JSON pretty printing from PdxToJSON (#3444)
---
 .../java/org/apache/geode/pdx/internal/json/PdxToJSON.java   |  2 --
 .../geode/experimental/driver/RegionIntegrationTest.java     |  4 +---
 .../v1/operations/GetAndPutJsonDocumentsDUnitTest.java       | 12 +++++++-----
 .../v1/serialization/codec/JsonPdxConverterJUnitTest.java    |  4 +---
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/json/PdxToJSON.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/json/PdxToJSON.java
index ea7b7fa..9ad21a8 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/json/PdxToJSON.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/json/PdxToJSON.java
@@ -27,7 +27,6 @@ import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.core.JsonGenerationException;
 import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.core.JsonGenerator.Feature;
-import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
 
 import org.apache.geode.annotations.internal.MutableForTesting;
 import org.apache.geode.internal.HeapDataOutputStream;
@@ -85,7 +84,6 @@ public class PdxToJSON {
   private void enableDisableJSONGeneratorFeature(JsonGenerator jg) {
     jg.enable(Feature.ESCAPE_NON_ASCII);
     jg.disable(Feature.AUTO_CLOSE_TARGET);
-    jg.setPrettyPrinter(new DefaultPrettyPrinter());
     if (PDXTOJJSON_UNQUOTEFIELDNAMES)
       jg.disable(Feature.QUOTE_FIELD_NAMES);
   }
diff --git a/geode-experimental-driver/src/integrationTest/java/org/apache/geode/experimental/driver/RegionIntegrationTest.java b/geode-experimental-driver/src/integrationTest/java/org/apache/geode/experimental/driver/RegionIntegrationTest.java
index 9d8f964..6d0237e 100644
--- a/geode-experimental-driver/src/integrationTest/java/org/apache/geode/experimental/driver/RegionIntegrationTest.java
+++ b/geode-experimental-driver/src/integrationTest/java/org/apache/geode/experimental/driver/RegionIntegrationTest.java
@@ -36,9 +36,7 @@ import org.apache.geode.test.junit.categories.ClientServerTest;
 public class RegionIntegrationTest extends IntegrationTestBase {
   /** a JSON document */
   private static final String jsonDocument =
-      "{" + System.lineSeparator() + "  \"name\" : \"Charlemagne\"," + System.lineSeparator()
-          + "  \"age\" : 1276," + System.lineSeparator() + "  \"nationality\" : \"french\","
-          + System.lineSeparator() + "  \"emailAddress\" : \"none\"" + System.lineSeparator() + "}";
+      "{\"name\":\"Charlemagne\",\"age\":1276,\"nationality\":\"french\",\"emailAddress\":\"none\"}";
 
   @Test
   public void putNewValueShouldIncrementSize() throws Exception {
diff --git a/geode-protobuf/src/distributedTest/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAndPutJsonDocumentsDUnitTest.java b/geode-protobuf/src/distributedTest/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAndPutJsonDocumentsDUnitTest.java
index 871b708..e7f0872 100644
--- a/geode-protobuf/src/distributedTest/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAndPutJsonDocumentsDUnitTest.java
+++ b/geode-protobuf/src/distributedTest/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAndPutJsonDocumentsDUnitTest.java
@@ -26,6 +26,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.RuleChain;
 
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
@@ -65,9 +66,7 @@ public class GetAndPutJsonDocumentsDUnitTest {
 
   /** this JSON document is used by the "put" the tests */
   private static final String jsonDocument =
-      "{" + System.lineSeparator() + "  \"name\" : \"Charlemagne\"," + System.lineSeparator()
-          + "  \"age\" : 1275," + System.lineSeparator() + "  \"nationality\" : \"french\","
-          + System.lineSeparator() + "  \"emailAddress\" : \"none\"" + System.lineSeparator() + "}";
+      "{\"name\":\"Charlemagne\",\"age\":1275,\"nationality\":\"french\",\"emailAddress\":\"none\"}";
 
   private static final PdxDocument pdxDocument =
       new PdxDocument("Charlemagne", 1275, "french", "none");
@@ -81,11 +80,14 @@ public class GetAndPutJsonDocumentsDUnitTest {
 
   private MemberVM storingVM;
 
-  @Rule
   public ClusterStartupRule clusterStartupRule = new ClusterStartupRule(1);
 
-  @Rule
   public ServerStarterRule serverStarterRule = new ServerStarterRule();
+
+  @Rule
+  public RuleChain chain = RuleChain.outerRule(clusterStartupRule)
+      .around(serverStarterRule);
+
   private InternalCache cache;
   private Region<String, Object> testRegion;
 
diff --git a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/protobuf/v1/serialization/codec/JsonPdxConverterJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/protobuf/v1/serialization/codec/JsonPdxConverterJUnitTest.java
index 6fc3845..5673209 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/protobuf/v1/serialization/codec/JsonPdxConverterJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/protobuf/v1/serialization/codec/JsonPdxConverterJUnitTest.java
@@ -92,9 +92,7 @@ public class JsonPdxConverterJUnitTest {
 
     String encodedJSON = new JsonPdxConverter().encode(pdxInstance);
 
-    String lineSeparator = System.lineSeparator();
-    String expectedJsonString = "{" + lineSeparator + "" + "  \"string\" : \"someString\","
-        + lineSeparator + "" + "  \"boolean\" : true" + lineSeparator + "}";
+    String expectedJsonString = "{\"string\":\"someString\",\"boolean\":true}";
     assertEquals(expectedJsonString, encodedJSON);
   }