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/24 15:48:59 UTC

[3/4] ignite git commit: IGNITE-1956: Further WIP on tests.

IGNITE-1956: Further 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/b5fe3456
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b5fe3456
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b5fe3456

Branch: refs/heads/ignite-1956
Commit: b5fe34560fab9f6805c4109e667d5ee39cf8f73e
Parents: 642218d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Nov 24 17:16:58 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Nov 24 17:16:58 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryEnumsSelfTest.java  | 68 +++++++++++++++++++-
 .../IgnitePortableObjectsTestSuite.java         |  2 +
 2 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b5fe3456/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
index 9b2cb84..c5a4c90 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
@@ -115,13 +115,75 @@ public class BinaryEnumsSelfTest extends GridCommonAbstractTest {
     /**
      * Test operations on simple type which is registered in advance.
      *
-     * @throws Exception
+     * @throws Exception If failed.
+     */
+    public void testSimpleRegistered() throws Exception {
+        checkSimple(true);
+    }
+
+    /**
+     * Test operations on simple type which is not registered in advance.
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleNotRegistered() throws Exception {
+        checkSimple(false);
+    }
+
+    /**
+     * Test builder operations on simple type which is registered in advance.
+     *
+     * @throws Exception If failed.
+     */
+    public void testBuilderSimpleRegistered() throws Exception {
+        checkBuilderSimple(true);
+    }
+
+    /**
+     * Test builder operations on simple type which is not registered in advance.
+     *
+     * @throws Exception If failed.
+     */
+    public void testBuilderSimpleNotRegistered() throws Exception {
+        checkBuilderSimple(false);
+    }
+
+    /**
+     * Check simple serialization - deserialization.
+     *
+     * @param registered If type should be registered in advance.
+     * @throws Exception If failed.
      */
-    public void testSimpleRegistered() throws Exception{
-        startUp(true);
+    public void checkSimple(boolean registered) throws Exception {
+        startUp(registered);
 
         cache1.put(1, EnumType.ONE);
 
+        validateSimple();
+    }
+
+    /**
+     * Check simple serialization - deserialization using builder.
+     *
+     * @param registered If type should be registered in advance.
+     * @throws Exception If failed.
+     */
+    public void checkBuilderSimple(boolean registered) throws Exception {
+        startUp(registered);
+
+        BinaryObject binary = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.ONE.ordinal());
+
+        cacheBinary1.put(1, binary);
+
+        validateSimple();
+    }
+
+    /**
+     * Internal check routine for simple scenario.
+     *
+     * @throws Exception If failed.
+     */
+    private void validateSimple() throws Exception {
         assertEquals(EnumType.ONE, cache1.get(1));
         assertEquals(EnumType.ONE, cache2.get(1));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5fe3456/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
index 16eeb2b..629835b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryEnumsSelfTest;
 import org.apache.ignite.internal.portable.GridPortableAffinityKeySelfTest;
 import org.apache.ignite.internal.portable.BinaryObjectBuilderAdditionalSelfTest;
 import org.apache.ignite.internal.portable.BinaryObjectBuilderSelfTest;
@@ -72,6 +73,7 @@ public class IgnitePortableObjectsTestSuite extends TestSuite {
         suite.addTestSuite(BinaryFieldsOffheapSelfTest.class);
         suite.addTestSuite(BinaryFooterOffsetsHeapSelfTest.class);
         suite.addTestSuite(BinaryFooterOffsetsOffheapSelfTest.class);
+        suite.addTestSuite(BinaryEnumsSelfTest.class);
         suite.addTestSuite(GridPortableMetaDataSelfTest.class);
         suite.addTestSuite(GridPortableAffinityKeySelfTest.class);
         suite.addTestSuite(GridPortableWildcardsSelfTest.class);