You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/12 09:01:39 UTC

[3/3] ignite git commit: IGNITE-1816: WIP on tests.

IGNITE-1816: WIP on tests.


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

Branch: refs/heads/ignite-1816
Commit: d5dbf632a5505af545fce45b9fd771a61760fc0a
Parents: 66d9ffc
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Nov 12 11:02:20 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Nov 12 11:02:20 2015 +0300

----------------------------------------------------------------------
 .../marshaller/portable/PortableMarshaller.java       |  2 +-
 .../portable/GridPortableMarshallerSelfTest.java      | 14 +++++++++-----
 .../internal/portable/TestCachingMetadataHandler.java |  8 ++++----
 3 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d5dbf632/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
index b84ba68..1704c8a 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
@@ -78,7 +78,7 @@ public class PortableMarshaller extends AbstractMarshaller {
     public static final boolean DFLT_KEEP_DESERIALIZED = true;
 
     /** Default value of "compact footer" flag. */
-    public static final boolean DFLT_COMPACT_FOOTER = false;
+    public static final boolean DFLT_COMPACT_FOOTER = true;
 
     // TODO ignite-1282 Move to IgniteConfiguration.
     /** Class names. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/d5dbf632/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
index 6c80767..69d0d42 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
@@ -546,7 +546,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
             new BinaryTypeConfiguration(TestBinary.class.getName())
         ));
 
-        TestBinary obj = BinaryObject();
+        TestBinary obj = binaryObject();
 
         BinaryObject po = marshal(obj, marsh);
 
@@ -899,6 +899,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
             new BinaryTypeConfiguration(DynamicObject.class.getName())
         ));
 
+        initializePortableContext(marsh);
+
         BinaryObject po1 = marshal(new DynamicObject(0, 10, 20, 30), marsh);
 
         assertEquals(new Integer(10), po1.field("val1"));
@@ -1092,7 +1094,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
             customMappingType
         ));
 
-        TestBinary obj = BinaryObject();
+        TestBinary obj = binaryObject();
 
         BinaryObjectImpl po = marshal(obj, marsh1);
 
@@ -1307,10 +1309,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
             new BinaryTypeConfiguration(SimpleObject.class.getName())
         ));
 
+        initializePortableContext(marsh);
+
         SimpleObject obj = simpleObject();
 
         final BinaryObject po = marshal(obj, marsh);
 
+        assertEquals(obj, po.deserialize());
+
         BinaryObject copy = copy(po, null);
 
         assertEquals(obj, copy.deserialize());
@@ -2547,7 +2553,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
     /**
      * @return Portable object.
      */
-    private TestBinary BinaryObject() {
+    private TestBinary binaryObject() {
         SimpleObject innerSimple = new SimpleObject();
 
         innerSimple.b = 1;
@@ -3389,8 +3395,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
 
             if (idx > 1)
                 writer.writeInt("val3", val3);
-
-            idx++;
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/d5dbf632/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java
index bb80781..f863317 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java
@@ -20,17 +20,17 @@ package org.apache.ignite.internal.portable;
 import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinaryType;
 
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.HashMap;
 
 /**
  * Test metadata handler.
  */
 public class TestCachingMetadataHandler implements BinaryMetadataHandler {
     /** Cached metadatas. */
-    private final ConcurrentHashMap<Integer, BinaryType> metas = new ConcurrentHashMap<>();
+    private final HashMap<Integer, BinaryType> metas = new HashMap<>();
 
     /** {@inheritDoc} */
-    @Override public void addMeta(int typeId, BinaryType type) throws BinaryObjectException {
+    @Override public synchronized void addMeta(int typeId, BinaryType type) throws BinaryObjectException {
         synchronized (this) {
             BinaryType oldType = metas.put(typeId, type);
 
@@ -48,7 +48,7 @@ public class TestCachingMetadataHandler implements BinaryMetadataHandler {
     }
 
     /** {@inheritDoc} */
-    @Override public BinaryType metadata(int typeId) throws BinaryObjectException {
+    @Override public synchronized BinaryType metadata(int typeId) throws BinaryObjectException {
         return metas.get(typeId);
     }
 }