Repository: ignite Updated Branches: refs/heads/ignite-2099 20ff80a7c -> a2e18c786
IGNITE-2099: Test for initial problem. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a2e18c78 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a2e18c78 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a2e18c78 Branch: refs/heads/ignite-2099 Commit: a2e18c786fc7677ea841571d343d4271c7769d4a Parents: 20ff80a Author: vozerov-gridgain <[email protected]> Authored: Thu Dec 10 11:22:47 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Thu Dec 10 11:22:47 2015 +0300 ---------------------------------------------------------------------- .../portable/BinaryMarshallerSelfTest.java | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/a2e18c78/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java index 1b414c6..5a60bac 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java @@ -40,6 +40,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Queue; @@ -383,6 +384,29 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest { } /** + * Test serialization of custom collections. + * + * @throws Exception If failed. + */ + @SuppressWarnings("unchecked") + public void testCustomCollections() throws Exception { + CustomCollections cc = new CustomCollections(); + + cc.list.add(1); + cc.customList.add(2); + + CustomCollections copiedCc = marshalUnmarshal(cc); + + assert copiedCc.customList.getClass().equals(CustomArrayList.class); + + assertEquals(cc.list.size(), copiedCc.list.size()); + assertEquals(cc.customList.size(), copiedCc.customList.size()); + + assertEquals(cc.list.get(0), copiedCc.list.get(0)); + assertEquals(cc.customList.get(0), copiedCc.customList.get(0)); + } + + /** * @throws Exception If failed. */ public void testExternalizableHashCode() throws Exception { @@ -3460,6 +3484,21 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest { } /** + * Custom array list. + */ + private static class CustomArrayList extends ArrayList { + // No-op. + } + + /** + * Holder for non-stadard collections. + */ + private static class CustomCollections { + public List list = new ArrayList(); + public List customList = new CustomArrayList(); + } + + /** */ private static class CycleLinkObject { /** */
