Skip to content

Commit

Permalink
GEODE-6633: Remove JSON pretty printing from PdxToJSON (apache#3444)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeppe-pivotal authored Apr 12, 2019
1 parent 1432e3d commit 339196b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
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;
Expand Down Expand Up @@ -85,7 +84,6 @@ public byte[] getJSONByteArray() {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand Down Expand Up @@ -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");
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ public void testSimpleJSONEncode() throws Exception {

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);
}

Expand Down

0 comments on commit 339196b

Please sign in to comment.