helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject git commit: HELIX-194: ZNRecord has too many constructors, rb=13346
Date Fri, 09 Aug 2013 17:55:08 GMT
Updated Branches:
  refs/heads/master e67a66ef1 -> dd136710d


HELIX-194: ZNRecord has too many constructors, rb=13346


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

Branch: refs/heads/master
Commit: dd136710d3ca697e1e227e407d1919a37c98026a
Parents: e67a66e
Author: zzhang <zzhang5@uci.edu>
Authored: Fri Aug 9 10:55:05 2013 -0700
Committer: zzhang <zzhang5@uci.edu>
Committed: Fri Aug 9 10:55:05 2013 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/helix/ZNRecord.java    | 26 ++------------------
 .../TestJacksonPayloadSerializer.java           |  9 ++++---
 2 files changed, 8 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/dd136710/helix-core/src/main/java/org/apache/helix/ZNRecord.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/ZNRecord.java b/helix-core/src/main/java/org/apache/helix/ZNRecord.java
index 4e6080a..130d673 100644
--- a/helix-core/src/main/java/org/apache/helix/ZNRecord.java
+++ b/helix-core/src/main/java/org/apache/helix/ZNRecord.java
@@ -25,6 +25,7 @@ import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.helix.ZNRecordDelta.MergeOperation;
+import org.apache.helix.manager.zk.serializer.JacksonPayloadSerializer;
 import org.apache.helix.manager.zk.serializer.PayloadSerializer;
 import org.apache.log4j.Logger;
 import org.codehaus.jackson.annotate.JsonCreator;
@@ -74,12 +75,7 @@ public class ZNRecord
     mapFields = new TreeMap<String, Map<String, String>>();
     listFields = new TreeMap<String, List<String>>();
     rawPayload = new byte[0];
-  }
-
-  public ZNRecord(String id, PayloadSerializer serializer)
-  {
-    this(id);
-    _serializer = serializer;
+    _serializer = new JacksonPayloadSerializer();
   }
 
   public ZNRecord(ZNRecord record)
@@ -100,24 +96,6 @@ public class ZNRecord
     _modifiedTime = record.getModifiedTime();
   }
 
-  public ZNRecord(ZNRecord record, int version)
-  {
-    this(record);
-    _version = version;
-  }
-
-  public ZNRecord(ZNRecord record, String id, PayloadSerializer serializer)
-  {
-    this(record, id);
-    _serializer = serializer;
-  }
-
-  public ZNRecord(ZNRecord record, int version, PayloadSerializer serializer)
-  {
-    this(record, version);
-    _serializer = serializer;
-  }
-
   @JsonIgnore(true)
   public void setPayloadSerializer(PayloadSerializer serializer)
   {

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/dd136710/helix-core/src/test/java/org/apache/helix/manager/zk/serializer/TestJacksonPayloadSerializer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/serializer/TestJacksonPayloadSerializer.java
b/helix-core/src/test/java/org/apache/helix/manager/zk/serializer/TestJacksonPayloadSerializer.java
index 0c4bc66..8d03ec5 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/serializer/TestJacksonPayloadSerializer.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/serializer/TestJacksonPayloadSerializer.java
@@ -40,7 +40,8 @@ public class TestJacksonPayloadSerializer
   {
     final String RECORD_ID = "testJacksonSerializeDeserialize";
     SampleDeserialized sample = getSample();
-    ZNRecord znRecord = new ZNRecord(RECORD_ID, new JacksonPayloadSerializer());
+    ZNRecord znRecord = new ZNRecord(RECORD_ID);
+    znRecord.setPayloadSerializer(new JacksonPayloadSerializer());
     znRecord.setPayload(sample);
     SampleDeserialized duplicate = znRecord.getPayload(SampleDeserialized.class);
     Assert.assertEquals(duplicate, sample);
@@ -55,7 +56,8 @@ public class TestJacksonPayloadSerializer
   {
     final String RECORD_ID = "testFullZNRecordSerializeDeserialize";
     SampleDeserialized sample = getSample();
-    ZNRecord znRecord = new ZNRecord(RECORD_ID, new JacksonPayloadSerializer());
+    ZNRecord znRecord = new ZNRecord(RECORD_ID);
+    znRecord.setPayloadSerializer(new JacksonPayloadSerializer());
     znRecord.setPayload(sample);
     ZNRecordSerializer znRecordSerializer = new ZNRecordSerializer();
     byte[] serialized = znRecordSerializer.serialize(znRecord);
@@ -74,7 +76,8 @@ public class TestJacksonPayloadSerializer
   {
     final String RECORD_ID = "testFullZNRecordStreamingSerializeDeserialize";
     SampleDeserialized sample = getSample();
-    ZNRecord znRecord = new ZNRecord(RECORD_ID, new JacksonPayloadSerializer());
+    ZNRecord znRecord = new ZNRecord(RECORD_ID);
+    znRecord.setPayloadSerializer(new JacksonPayloadSerializer());
     znRecord.setPayload(sample);
     ZNRecordStreamingSerializer znRecordSerializer = new ZNRecordStreamingSerializer();
     byte[] serialized = znRecordSerializer.serialize(znRecord);


Mime
View raw message