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

[13/13] geode git commit: addressing review comments

addressing review comments


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

Branch: refs/heads/feature/GEODE-3503
Commit: c3a913b6ef210c013f7c05de6a4ceb427dd7e961
Parents: cbe51bd
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Fri Aug 25 09:58:46 2017 -0700
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Fri Aug 25 10:00:58 2017 -0700

----------------------------------------------------------------------
 .../geode/serialization/SerializationType.java  | 11 +------
 .../RoundTripCacheConnectionJUnitTest.java      | 11 ++-----
 .../serialization/codec/JSONCodecJUnitTest.java | 31 +++++++++++---------
 3 files changed, 21 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/c3a913b6/geode-protobuf/src/main/java/org/apache/geode/serialization/SerializationType.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/serialization/SerializationType.java b/geode-protobuf/src/main/java/org/apache/geode/serialization/SerializationType.java
index 10a3e51..01ef048 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/serialization/SerializationType.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/serialization/SerializationType.java
@@ -22,16 +22,7 @@ import org.apache.geode.pdx.PdxInstance;
  */
 @Experimental
 public enum SerializationType {
-  STRING(String.class),
-  BINARY(byte[].class),
-  INT(int.class),
-  BYTE(byte.class),
-  SHORT(short.class),
-  LONG(long.class),
-  JSON(PdxInstance.class),
-  BOOLEAN(boolean.class),
-  FLOAT(float.class),
-  DOUBLE(double.class);
+  JSON(PdxInstance.class);
 
   public final Class klass;
 

http://git-wip-us.apache.org/repos/asf/geode/blob/c3a913b6/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
index 91e839c..b80e90e 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
@@ -122,14 +122,9 @@ public class RoundTripCacheConnectionJUnitTest {
     }
 
     CacheFactory cacheFactory = new CacheFactory(properties);
-    cacheFactory.set(ConfigurationProperties.MCAST_PORT, "0"); // sometimes it isn't due to other
-                                                               // tests.
-    cacheFactory.set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false"); // sometimes it
-                                                                                     // isn't due to
-                                                                                     // other tests.
-    cacheFactory.set(ConfigurationProperties.USE_CLUSTER_CONFIGURATION, "false"); // sometimes it
-                                                                                  // isn't due to
-                                                                                  // other tests.
+    cacheFactory.set(ConfigurationProperties.MCAST_PORT, "0");
+    cacheFactory.set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false");
+    cacheFactory.set(ConfigurationProperties.USE_CLUSTER_CONFIGURATION, "false");
     cache = cacheFactory.create();
 
     CacheServer cacheServer = cache.addCacheServer();

http://git-wip-us.apache.org/repos/asf/geode/blob/c3a913b6/geode-protobuf/src/test/java/org/apache/geode/serialization/codec/JSONCodecJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/serialization/codec/JSONCodecJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/serialization/codec/JSONCodecJUnitTest.java
index ffdd744..bb7169e 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/serialization/codec/JSONCodecJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/serialization/codec/JSONCodecJUnitTest.java
@@ -101,26 +101,29 @@ public class JSONCodecJUnitTest {
     PdxInstance pdxInstanceForComplexJSONString = createPDXInstanceForComplexJSONString();
     PdxInstance decodedJSONPdxInstance = new JSONCodec().decode(complexJSONString.getBytes());
 
-    assertEquals(pdxInstanceForComplexJSONString.getFieldNames(),
-        decodedJSONPdxInstance.getFieldNames());
+    pdxInstanceEquals(pdxInstanceForComplexJSONString, decodedJSONPdxInstance);
+  }
 
-    List<String> fieldNames = asList("_id", "index", "guid", "isActive", "balance", "picture",
-        "age", "eyeColor", "name", "gender", "company", "email", "phone", "address", "about",
-        "registered", "latitude", "longitude", "tags", "friends", "greeting", "favoriteFruit");
-    fieldNames.forEach(
-        fieldName -> assertEquals(pdxInstanceForComplexJSONString.getField(fieldName).getClass(),
-            decodedJSONPdxInstance.getField(fieldName).getClass()));
+  private void pdxInstanceEquals(PdxInstance expectedPdxInstance,
+                                 PdxInstance decodedJSONPdxInstance) {
+    List<String> expectedFieldNames = expectedPdxInstance.getFieldNames();
+
+    assertEquals(expectedFieldNames, decodedJSONPdxInstance.getFieldNames());
 
-    fieldNames.forEach(
-        fieldName -> assertEquals(pdxFieldValues(pdxInstanceForComplexJSONString, fieldName),
-            pdxFieldValues(decodedJSONPdxInstance, fieldName)));
+    expectedFieldNames.forEach(
+        fieldName -> {
+          assertEquals(expectedPdxInstance.getField(fieldName).getClass(),
+              decodedJSONPdxInstance.getField(fieldName).getClass());
+          assertEquals(pdxFieldValues(expectedPdxInstance, fieldName),
+              pdxFieldValues(decodedJSONPdxInstance, fieldName));
+        });
   }
 
   /**
-   * This method is very specific to this test. It will take an pdxInstance object and return you
+   * This method is very specific to this test. It will take a pdxInstance object and return you
    * the value for the fieldName. In most cases it will return the value directly, but in the case
-   * of collections LinkedList<String> it will return an ArrayList<String> or in the case of a
-   * LinkedList<PdxInstance> it will return an ArrayList<ArrayList>.
+   * of collections LinkedList&lt;String&gt; it will return an ArrayList&lt;String&gt; or in the case of a
+   * LinkedList&lt;PdxInstance&gt; it will return an ArrayList&lt;ArrayList&lt;String&gt;&gt;.
    */
   private Object pdxFieldValues(PdxInstance pdxInstance, String fieldName) {
     Object fieldValue = pdxInstance.getField(fieldName);