http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java index 11b54ae..6eac446 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java @@ -37,6 +37,7 @@ import java.util.Set; import java.util.UUID; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteBinary; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.portable.builder.PortableBuilderEnum; @@ -45,7 +46,7 @@ import org.apache.ignite.internal.portable.mutabletest.GridBinaryMarshalerAwareT import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl; import org.apache.ignite.internal.processors.cache.portable.IgniteBinaryImpl; import org.apache.ignite.internal.util.lang.GridMapEntry; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.binary.BinaryObjectBuilder; import org.apache.ignite.binary.BinaryType; import org.apache.ignite.binary.BinaryObject; @@ -78,11 +79,11 @@ public class GridBinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstrac cfg.setCacheConfiguration(cacheCfg); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryConfiguration bCfg = new BinaryConfiguration(); - marsh.setClassNames(Arrays.asList("org.apache.ignite.internal.portable.mutabletest.*")); + bCfg.setClassNames(Arrays.asList("org.apache.ignite.internal.portable.mutabletest.*")); - cfg.setMarshaller(marsh); + cfg.setMarshaller(new BinaryMarshaller()); return cfg; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java index a74315b..ab63a0b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java @@ -22,13 +22,18 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; -import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteBinary; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.binary.BinaryIdMapper; +import org.apache.ignite.binary.BinaryObject; +import org.apache.ignite.binary.BinaryObjectBuilder; +import org.apache.ignite.binary.BinaryType; +import org.apache.ignite.binary.BinaryTypeConfiguration; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.portable.builder.BinaryObjectBuilderImpl; import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectAllTypes; @@ -39,12 +44,7 @@ import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.T import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl; import org.apache.ignite.internal.util.GridUnsafe; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.marshaller.portable.PortableMarshaller; -import org.apache.ignite.binary.BinaryObjectBuilder; -import org.apache.ignite.binary.BinaryIdMapper; -import org.apache.ignite.binary.BinaryType; -import org.apache.ignite.binary.BinaryObject; -import org.apache.ignite.binary.BinaryTypeConfiguration; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import sun.misc.Unsafe; @@ -63,15 +63,10 @@ public class GridBinaryObjectBuilderSelfTest extends GridCommonAbstractTest { @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryTypeConfiguration customTypeCfg = new BinaryTypeConfiguration(); - marsh.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName(), - "org.gridgain.grid.internal.util.portable.mutabletest.*")); - - BinaryTypeConfiguration customIdMapper = new BinaryTypeConfiguration(); - - customIdMapper.setClassName(CustomIdMapper.class.getName()); - customIdMapper.setIdMapper(new BinaryIdMapper() { + customTypeCfg.setTypeName(CustomIdMapper.class.getName()); + customTypeCfg.setIdMapper(new BinaryIdMapper() { @Override public int typeId(String clsName) { return ~PortableContext.DFLT_ID_MAPPER.typeId(clsName); } @@ -81,9 +76,17 @@ public class GridBinaryObjectBuilderSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Collections.singleton(customIdMapper)); + BinaryConfiguration bCfg = new BinaryConfiguration(); + + bCfg.setTypeConfigurations(Arrays.asList( + new BinaryTypeConfiguration(Key.class.getName()), + new BinaryTypeConfiguration(Value.class.getName()), + new BinaryTypeConfiguration("org.gridgain.grid.internal.util.portable.mutabletest.*"), + customTypeCfg)); + + cfg.setBinaryConfiguration(bCfg); - cfg.setMarshaller(marsh); + cfg.setMarshaller(new BinaryMarshaller()); return cfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java index 748c423..9fb3a6f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java @@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.ignite.Ignite; import org.apache.ignite.cache.CacheKeyConfiguration; import org.apache.ignite.cache.affinity.Affinity; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteKernal; @@ -32,7 +33,7 @@ import org.apache.ignite.internal.processors.cache.CacheObjectContext; import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor; import org.apache.ignite.lang.IgniteCallable; import org.apache.ignite.lang.IgniteRunnable; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.binary.BinaryTypeConfiguration; import org.apache.ignite.resources.IgniteInstanceResource; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; @@ -61,17 +62,19 @@ public class GridPortableAffinityKeySelfTest extends GridCommonAbstractTest { BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(); - typeCfg.setClassName(TestObject.class.getName()); + typeCfg.setTypeName(TestObject.class.getName()); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryConfiguration bCfg = new BinaryConfiguration(); - marsh.setTypeConfigurations(Collections.singleton(typeCfg)); + bCfg.setTypeConfigurations(Collections.singleton(typeCfg)); + + cfg.setBinaryConfiguration(bCfg); CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject.class.getName(), "affKey"); cfg.setCacheKeyCfg(keyCfg); - cfg.setMarshaller(marsh); + cfg.setMarshaller(new BinaryMarshaller()); if (!gridName.equals(getTestGridName(GRID_CNT))) { CacheConfiguration cacheCfg = new CacheConfiguration(); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java index 747f8ea..d2291c3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java @@ -25,7 +25,7 @@ import org.apache.ignite.binary.Binarylizable; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.MarshallerContextAdapter; import org.apache.ignite.internal.util.IgniteUtils; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import java.io.Externalizable; @@ -42,12 +42,14 @@ public class GridPortableMarshallerCtxDisabledSelfTest extends GridCommonAbstrac * @throws Exception If failed. */ public void testObjectExchange() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); + BinaryMarshaller marsh = new BinaryMarshaller(); marsh.setContext(new MarshallerContextWithNoStorage()); - PortableContext context = new PortableContext(BinaryNoopMetadataHandler.instance(), new IgniteConfiguration()); + IgniteConfiguration cfg = new IgniteConfiguration(); - IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", context); + PortableContext context = new PortableContext(BinaryNoopMetadataHandler.instance(), cfg); + + IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", context, cfg); SimpleObject simpleObj = new SimpleObject(); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/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 d0a5709..c59cada 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 @@ -41,6 +41,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListSet; import junit.framework.Assert; import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.binary.BinaryIdMapper; import org.apache.ignite.binary.BinaryObject; import org.apache.ignite.binary.BinaryObjectBuilder; import org.apache.ignite.binary.BinaryObjectException; @@ -48,13 +49,13 @@ import org.apache.ignite.binary.BinaryRawReader; import org.apache.ignite.binary.BinaryRawWriter; import org.apache.ignite.binary.BinaryReader; import org.apache.ignite.binary.BinarySerializer; -import org.apache.ignite.binary.BinaryType; import org.apache.ignite.binary.BinaryTypeConfiguration; -import org.apache.ignite.binary.BinaryIdMapper; import org.apache.ignite.binary.BinaryWriter; import org.apache.ignite.binary.Binarylizable; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.portable.builder.BinaryObjectBuilderImpl; +import org.apache.ignite.internal.processors.cache.CacheObjectContext; import org.apache.ignite.internal.util.GridUnsafe; import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.internal.util.lang.GridMapEntry; @@ -62,7 +63,7 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.MarshallerContextTestImpl; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jsr166.ConcurrentHashMap8; @@ -384,9 +385,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testBinaryObject() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); SimpleObject obj = simpleObject(); @@ -413,9 +412,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testEnum() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setClassNames(Arrays.asList(TestEnum.class.getName())); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(TestEnum.class.getName()))); assertEquals(TestEnum.B, marshalUnmarshal(TestEnum.B, marsh)); } @@ -426,9 +423,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testDateAndTimestampInSingleObject() throws Exception { BinaryTypeConfiguration cfg1 = new BinaryTypeConfiguration(DateClass1.class.getName()); - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList(cfg1)); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(cfg1)); Date date = new Date(); Timestamp ts = new Timestamp(System.currentTimeMillis()); @@ -453,9 +448,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testSimpleObject() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -540,9 +533,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortable() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()), new BinaryTypeConfiguration(TestBinary.class.getName()) )); @@ -704,16 +695,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testClassWithoutPublicConstructor() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(NoPublicConstructor.class.getName()), new BinaryTypeConfiguration(NoPublicDefaultConstructor.class.getName()), new BinaryTypeConfiguration(ProtectedConstructor.class.getName())) ); - initPortableContext(marsh); - NoPublicConstructor npc = new NoPublicConstructor(); BinaryObject npc2 = marshal(npc, marsh); @@ -734,14 +721,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCustomSerializer() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - BinaryTypeConfiguration type = new BinaryTypeConfiguration(CustomSerializedObject1.class.getName()); type.setSerializer(new CustomSerializer1()); - marsh.setTypeConfigurations(Arrays.asList(type)); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(type)); CustomSerializedObject1 obj1 = new CustomSerializedObject1(10); @@ -754,10 +739,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCustomSerializerWithGlobal() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setSerializer(new CustomSerializer1()); - BinaryTypeConfiguration type1 = new BinaryTypeConfiguration(CustomSerializedObject1.class.getName()); BinaryTypeConfiguration type2 = @@ -765,7 +746,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { type2.setSerializer(new CustomSerializer2()); - marsh.setTypeConfigurations(Arrays.asList(type1, type2)); + BinaryMarshaller marsh = binaryMarshaller(new CustomSerializer1(), Arrays.asList(type1, type2)); CustomSerializedObject1 obj1 = new CustomSerializedObject1(10); @@ -784,8 +765,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCustomIdMapper() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - BinaryTypeConfiguration type = new BinaryTypeConfiguration(CustomMappedObject1.class.getName()); @@ -808,7 +787,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Arrays.asList(type)); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(type)); CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str"); @@ -826,18 +805,21 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCustomIdMapperWithGlobal() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); + BinaryTypeConfiguration type1 = + new BinaryTypeConfiguration(CustomMappedObject1.class.getName()); + BinaryTypeConfiguration type2 = + new BinaryTypeConfiguration(CustomMappedObject2.class.getName()); - marsh.setIdMapper(new BinaryIdMapper() { + type2.setIdMapper(new BinaryIdMapper() { @Override public int typeId(String clsName) { - return 11111; + return 44444; } @Override public int fieldId(int typeId, String fieldName) { - assert typeId == 11111; + assert typeId == 44444; - if ("val1".equals(fieldName)) return 22222; - else if ("val2".equals(fieldName)) return 33333; + if ("val1".equals(fieldName)) return 55555; + else if ("val2".equals(fieldName)) return 66666; assert false : "Unknown field: " + fieldName; @@ -845,29 +827,24 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - BinaryTypeConfiguration type1 = - new BinaryTypeConfiguration(CustomMappedObject1.class.getName()); - BinaryTypeConfiguration type2 = - new BinaryTypeConfiguration(CustomMappedObject2.class.getName()); - - type2.setIdMapper(new BinaryIdMapper() { + BinaryMarshaller marsh = binaryMarshaller(new BinaryIdMapper() { @Override public int typeId(String clsName) { - return 44444; + return 11111; } @Override public int fieldId(int typeId, String fieldName) { - assert typeId == 44444; + assert typeId == 11111; - if ("val1".equals(fieldName)) return 55555; - else if ("val2".equals(fieldName)) return 66666; + if ("val1".equals(fieldName)) + return 22222; + else if ("val2".equals(fieldName)) + return 33333; assert false : "Unknown field: " + fieldName; return 0; } - }); - - marsh.setTypeConfigurations(Arrays.asList(type1, type2)); + }, Arrays.asList(type1, type2)); CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str1"); @@ -896,9 +873,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testDynamicObject() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(DynamicObject.class.getName()) )); @@ -943,9 +918,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCycleLink() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(CycleLinkObject.class.getName()) )); @@ -964,9 +937,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testDetached() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(DetachedTestObject.class.getName()), new BinaryTypeConfiguration(DetachedInnerTestObject.class.getName()) )); @@ -1020,9 +991,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCollectionFields() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(CollectionFieldsObject.class.getName()), new BinaryTypeConfiguration(Key.class.getName()), new BinaryTypeConfiguration(Value.class.getName()) @@ -1062,8 +1031,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testDefaultMapping() throws Exception { - PortableMarshaller marsh1 = new PortableMarshaller(); - BinaryTypeConfiguration customMappingType = new BinaryTypeConfiguration(TestBinary.class.getName()); @@ -1090,7 +1057,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - marsh1.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh1 = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()), customMappingType )); @@ -1099,16 +1066,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { BinaryObjectImpl po = marshal(obj, marsh1); - PortableMarshaller marsh2 = new PortableMarshaller(); - - marsh2.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh2 = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()), new BinaryTypeConfiguration(TestBinary.class.getName()) )); - PortableContext ctx = initPortableContext(marsh2); - - po.context(ctx); + po = marshal(obj, marsh2); assertEquals(obj, po.deserialize()); } @@ -1117,8 +1080,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTypeNames() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - BinaryTypeConfiguration customType1 = new BinaryTypeConfiguration(Value.class.getName()); customType1.setIdMapper(new BinaryIdMapper() { @@ -1167,7 +1128,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(Key.class.getName()), new BinaryTypeConfiguration("org.gridgain.NonExistentClass3"), new BinaryTypeConfiguration("NonExistentClass4"), @@ -1177,7 +1138,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { customType4 )); - PortableContext ctx = initPortableContext(marsh); + PortableContext ctx = portableContext(marsh); assertEquals("notconfiguredclass".hashCode(), ctx.typeId("NotConfiguredClass")); assertEquals("key".hashCode(), ctx.typeId("Key")); @@ -1193,8 +1154,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testFieldIdMapping() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - BinaryTypeConfiguration customType1 = new BinaryTypeConfiguration(Value.class.getName()); customType1.setIdMapper(new BinaryIdMapper() { @@ -1237,12 +1196,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(Key.class.getName()), + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(Key.class.getName()), new BinaryTypeConfiguration("NonExistentClass2"), customType1, customType2)); - PortableContext ctx = initPortableContext(marsh); + PortableContext ctx = portableContext(marsh); assertEquals("val".hashCode(), ctx.fieldId("key".hashCode(), "val")); assertEquals("val".hashCode(), ctx.fieldId("nonexistentclass2".hashCode(), "val")); @@ -1259,8 +1218,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testDuplicateTypeId() throws Exception { - final PortableMarshaller marsh = new PortableMarshaller(); - BinaryTypeConfiguration customType1 = new BinaryTypeConfiguration("org.gridgain.Class1"); customType1.setIdMapper(new BinaryIdMapper() { @@ -1285,13 +1242,11 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Arrays.asList(customType1, customType2)); - try { - initPortableContext(marsh); + binaryMarshaller(Arrays.asList(customType1, customType2)); } catch (IgniteCheckedException e) { - assertEquals("Duplicate type ID [clsName=org.gridgain.Class1, id=100]", + assertEquals("Duplicate type ID [clsName=org.gridgain.Class2, id=100]", e.getCause().getCause().getMessage()); return; @@ -1304,9 +1259,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopy() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1427,9 +1380,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyString() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1450,9 +1401,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyUuid() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1475,9 +1424,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyByteArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1514,9 +1461,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyShortArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1537,9 +1482,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyIntArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1560,9 +1503,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyLongArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1583,9 +1524,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyFloatArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1606,9 +1545,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyDoubleArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1629,9 +1566,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyCharArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1652,9 +1587,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyStringArray() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1675,9 +1608,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyObject() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1704,9 +1635,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyNonPrimitives() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( new BinaryTypeConfiguration(SimpleObject.class.getName()) )); @@ -1743,9 +1672,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPortableCopyMixed() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); SimpleObject obj = simpleObject(); @@ -1789,82 +1716,26 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testKeepDeserialized() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setClassNames(Arrays.asList(SimpleObject.class.getName())); - marsh.setKeepDeserialized(true); - - BinaryObject po = marshal(simpleObject(), marsh); - - assert po.deserialize() == po.deserialize(); - - marsh = new PortableMarshaller(); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); - marsh.setClassNames(Arrays.asList(SimpleObject.class.getName())); - marsh.setKeepDeserialized(false); + BinaryObjectImpl po = marshal(simpleObject(), marsh); - po = marshal(simpleObject(), marsh); - - assert po.deserialize() != po.deserialize(); - - marsh = new PortableMarshaller(); - - marsh.setKeepDeserialized(true); - marsh.setTypeConfigurations(Arrays.asList( - new BinaryTypeConfiguration(SimpleObject.class.getName()))); - - po = marshal(simpleObject(), marsh); - - assert po.deserialize() == po.deserialize(); - - marsh = new PortableMarshaller(); - - marsh.setKeepDeserialized(false); - marsh.setTypeConfigurations(Arrays.asList( - new BinaryTypeConfiguration(SimpleObject.class.getName()))); - - po = marshal(simpleObject(), marsh); - - assert po.deserialize() != po.deserialize(); - - marsh = new PortableMarshaller(); - - marsh.setKeepDeserialized(true); - - BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(SimpleObject.class.getName()); - - typeCfg.setKeepDeserialized(false); + CacheObjectContext coCtx = new CacheObjectContext(newContext(), null, false, true, false); - marsh.setTypeConfigurations(Arrays.asList(typeCfg)); + assert po.value(coCtx, false) == po.value(coCtx, false); po = marshal(simpleObject(), marsh); assert po.deserialize() != po.deserialize(); - - marsh = new PortableMarshaller(); - - marsh.setKeepDeserialized(false); - - typeCfg = new BinaryTypeConfiguration(SimpleObject.class.getName()); - - typeCfg.setKeepDeserialized(true); - - marsh.setTypeConfigurations(Arrays.asList(typeCfg)); - - po = marshal(simpleObject(), marsh); - - assert po.deserialize() == po.deserialize(); } /** * @throws Exception If failed. */ public void testOffheapPortable() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); - PortableContext ctx = initPortableContext(marsh); + PortableContext ctx = portableContext(marsh); SimpleObject simpleObj = simpleObject(); @@ -1956,10 +1827,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * */ public void testReadResolve() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setClassNames( - Arrays.asList(MySingleton.class.getName(), SingletonMarker.class.getName())); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList( + new BinaryTypeConfiguration(MySingleton.class.getName()), + new BinaryTypeConfiguration(SingletonMarker.class.getName()))); BinaryObjectImpl portableObj = marshal(MySingleton.INSTANCE, marsh); @@ -1974,9 +1844,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * */ public void testReadResolveOnPortableAware() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setClassNames(Collections.singletonList(MyTestClass.class.getName())); + BinaryMarshaller marsh = binaryMarshaller(Collections.singletonList( + new BinaryTypeConfiguration(MyTestClass.class.getName()))); BinaryObjectImpl portableObj = marshal(new MyTestClass(), marsh); @@ -1989,9 +1858,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If ecxeption thrown. */ public void testDeclareReadResolveInParent() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - marsh.setClassNames(Arrays.asList(ChildPortable.class.getName())); + BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(ChildPortable.class.getName()))); BinaryObjectImpl portableObj = marshal(new ChildPortable(), marsh); @@ -2004,14 +1871,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * */ public void testDecimalFields() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); + Collection<BinaryTypeConfiguration> clsNames = new ArrayList<>(); - Collection<String> clsNames = new ArrayList<>(); + clsNames.add(new BinaryTypeConfiguration(DecimalReflective.class.getName())); + clsNames.add(new BinaryTypeConfiguration(DecimalMarshalAware.class.getName())); - clsNames.add(DecimalReflective.class.getName()); - clsNames.add(DecimalMarshalAware.class.getName()); - - marsh.setClassNames(clsNames); + BinaryMarshaller marsh = binaryMarshaller(clsNames); // 1. Test reflective stuff. DecimalReflective obj1 = new DecimalReflective(); @@ -2050,7 +1915,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws IgniteCheckedException If failed. */ public void testFinalField() throws IgniteCheckedException { - PortableMarshaller marsh = new PortableMarshaller(); + BinaryMarshaller marsh = binaryMarshaller(); SimpleObjectWithFinal obj = new SimpleObjectWithFinal(); @@ -2066,7 +1931,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { // Checking the writer directly. assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); - try (BinaryWriterExImpl writer = new BinaryWriterExImpl(initPortableContext(new PortableMarshaller()))) { + BinaryMarshaller marsh = binaryMarshaller(); + + try (BinaryWriterExImpl writer = new BinaryWriterExImpl(portableContext(marsh))) { assertEquals(true, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); writer.writeString("Thread local test"); @@ -2079,16 +1946,16 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { // Checking the portable marshaller. assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); - PortableMarshaller marsh = new PortableMarshaller(); - - initPortableContext(marsh); + marsh = binaryMarshaller(); marsh.marshal(new SimpleObject()); assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); + marsh = binaryMarshaller(); + // Checking the builder. - BinaryObjectBuilder builder = new BinaryObjectBuilderImpl(initPortableContext(new PortableMarshaller()), + BinaryObjectBuilder builder = new BinaryObjectBuilderImpl(portableContext(marsh), "org.gridgain.foo.bar.TestClass"); builder.setField("a", "1"); @@ -2102,9 +1969,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testDuplicateName() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - initPortableContext(marsh); + BinaryMarshaller marsh = binaryMarshaller(); Test1.Job job1 = new Test1().new Job(); Test2.Job job2 = new Test2().new Job(); @@ -2125,9 +1990,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testClass() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - initPortableContext(marsh); + BinaryMarshaller marsh = binaryMarshaller(); Class cls = GridPortableMarshallerSelfTest.class; @@ -2140,9 +2003,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testClassFieldsMarshalling() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - initPortableContext(marsh); + BinaryMarshaller marsh = binaryMarshaller(); ObjectWithClassFields obj = new ObjectWithClassFields(); obj.cls1 = GridPortableMarshallerSelfTest.class; @@ -2165,9 +2026,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testMarshallingThroughJdk() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); - - initPortableContext(marsh); + BinaryMarshaller marsh = binaryMarshaller(); InetSocketAddress addr = new InetSocketAddress("192.168.0.2", 4545); @@ -2203,9 +2062,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPredefinedTypeIds() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); + BinaryMarshaller marsh = binaryMarshaller(); - PortableContext pCtx = initPortableContext(marsh); + PortableContext pCtx = portableContext(marsh); Field field = pCtx.getClass().getDeclaredField("predefinedTypeNames"); @@ -2232,7 +2091,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCyclicReferencesMarshalling() throws Exception { - PortableMarshaller marsh = new PortableMarshaller(); + BinaryMarshaller marsh = binaryMarshaller(); SimpleObject obj = simpleObject(); @@ -2367,7 +2226,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @return Result object. */ private <T> T marshalUnmarshal(T obj) throws IgniteCheckedException { - return marshalUnmarshal(obj, new PortableMarshaller()); + return marshalUnmarshal(obj, binaryMarshaller()); } /** @@ -2375,9 +2234,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @param marsh Marshaller. * @return Result object. */ - private <T> T marshalUnmarshal(Object obj, PortableMarshaller marsh) throws IgniteCheckedException { - initPortableContext(marsh); - + private <T> T marshalUnmarshal(Object obj, BinaryMarshaller marsh) throws IgniteCheckedException { byte[] bytes = marsh.marshal(obj); return marsh.unmarshal(bytes, null); @@ -2388,9 +2245,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @param marsh Marshaller. * @return Portable object. */ - private <T> BinaryObjectImpl marshal(T obj, PortableMarshaller marsh) throws IgniteCheckedException { - initPortableContext(marsh); - + private <T> BinaryObjectImpl marshal(T obj, BinaryMarshaller marsh) throws IgniteCheckedException { byte[] bytes = marsh.marshal(obj); return new BinaryObjectImpl(U.<GridPortableMarshaller>field(marsh, "impl").context(), @@ -2398,18 +2253,75 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** + * @param marsh Marshaller. * @return Portable context. */ - protected PortableContext initPortableContext(PortableMarshaller marsh) throws IgniteCheckedException { + protected PortableContext portableContext(BinaryMarshaller marsh) { + GridPortableMarshaller impl = U.field(marsh, "impl"); + + return impl.context(); + } + + /** + * + */ + protected BinaryMarshaller binaryMarshaller() + throws IgniteCheckedException { + return binaryMarshaller(null, null, null); + } + + /** + * + */ + protected BinaryMarshaller binaryMarshaller(Collection<BinaryTypeConfiguration> cfgs) + throws IgniteCheckedException { + return binaryMarshaller(null, null, cfgs); + } + + /** + * + */ + protected BinaryMarshaller binaryMarshaller(BinaryIdMapper mapper, Collection<BinaryTypeConfiguration> cfgs) + throws IgniteCheckedException { + return binaryMarshaller(mapper, null, cfgs); + } + + /** + * + */ + protected BinaryMarshaller binaryMarshaller(BinarySerializer serializer, Collection<BinaryTypeConfiguration> cfgs) + throws IgniteCheckedException { + return binaryMarshaller(null, serializer, cfgs); + } + + /** + * @return Binary marshaller. + */ + protected BinaryMarshaller binaryMarshaller( + BinaryIdMapper mapper, + BinarySerializer serializer, + Collection<BinaryTypeConfiguration> cfgs + ) throws IgniteCheckedException { IgniteConfiguration iCfg = new IgniteConfiguration(); + BinaryConfiguration bCfg = new BinaryConfiguration(); + + bCfg.setIdMapper(mapper); + bCfg.setSerializer(serializer); + + bCfg.setTypeConfigurations(cfgs); + + iCfg.setBinaryConfiguration(bCfg); + PortableContext ctx = new PortableContext(BinaryNoopMetadataHandler.instance(), iCfg); + BinaryMarshaller marsh = new BinaryMarshaller(); + marsh.setContext(new MarshallerContextTestImpl(null)); - IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", ctx); + IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, iCfg); - return ctx; + return marsh; } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java index 2a367a8..5c25d3b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java @@ -23,9 +23,10 @@ import java.util.Collection; import java.util.Date; import java.util.HashMap; import org.apache.ignite.IgniteBinary; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.binary.Binarylizable; import org.apache.ignite.binary.BinaryType; @@ -46,11 +47,13 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryConfiguration bCfg = new BinaryConfiguration(); - marsh.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName())); + bCfg.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName())); - cfg.setMarshaller(marsh); + cfg.setBinaryConfiguration(bCfg); + + cfg.setMarshaller(new BinaryMarshaller()); CacheConfiguration ccfg = new CacheConfiguration(); @@ -148,8 +151,6 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testNoConfiguration() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-1377"); - portables().toBinary(new TestObject3()); assertNotNull(portables().metadata(TestObject3.class)); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java index 52af867..a00ad75 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java @@ -17,12 +17,17 @@ package org.apache.ignite.internal.portable; +import java.util.Collection; +import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.binary.BinaryIdMapper; +import org.apache.ignite.binary.BinarySerializer; import org.apache.ignite.binary.BinaryTypeConfiguration; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.MarshallerContextTestImpl; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import java.util.Arrays; @@ -33,36 +38,15 @@ import java.util.Map; */ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { /** - * @return Portable context. - */ - private PortableContext portableContext() { - return new PortableContext(BinaryNoopMetadataHandler.instance(), new IgniteConfiguration()); - } - - /** - * @return Portable marshaller. - */ - private PortableMarshaller portableMarshaller() { - PortableMarshaller marsh = new PortableMarshaller(); - marsh.setContext(new MarshallerContextTestImpl(null)); - - return marsh; - } - - /** * @throws Exception If failed. */ public void testClassNames() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setClassNames(Arrays.asList( - "org.apache.ignite.internal.portable.test.*", - "unknown.*" + BinaryMarshaller marsh = portableMarshaller(Arrays.asList( + new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), + new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<Integer, Class> typeIds = U.field(ctx, "userTypes"); @@ -77,11 +61,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testClassNamesWithMapper() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setIdMapper(new BinaryIdMapper() { + BinaryMarshaller marsh = portableMarshaller(new BinaryIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -97,14 +77,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { @Override public int fieldId(int typeId, String fieldName) { return 0; } - }); - - marsh.setClassNames(Arrays.asList( - "org.apache.ignite.internal.portable.test.*", - "unknown.*" + }, Arrays.asList( + new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), + new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<String, BinaryIdMapper> typeMappers = U.field(ctx, "typeMappers"); @@ -119,16 +97,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTypeConfigurations() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = portableMarshaller(Arrays.asList( new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<Integer, Class> typeIds = U.field(ctx, "userTypes"); @@ -143,11 +117,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTypeConfigurationsWithGlobalMapper() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setIdMapper(new BinaryIdMapper() { + BinaryMarshaller marsh = portableMarshaller(new BinaryIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -163,14 +133,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { @Override public int fieldId(int typeId, String fieldName) { return 0; } - }); - - marsh.setTypeConfigurations(Arrays.asList( + }, Arrays.asList( new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<String, BinaryIdMapper> typeMappers = U.field(ctx, "typeMappers"); @@ -185,11 +153,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTypeConfigurationsWithNonGlobalMapper() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setIdMapper(new BinaryIdMapper() { + BinaryMarshaller marsh = portableMarshaller(new BinaryIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -205,14 +169,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { @Override public int fieldId(int typeId, String fieldName) { return 0; } - }); - - marsh.setTypeConfigurations(Arrays.asList( + }, Arrays.asList( new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<String, BinaryIdMapper> typeMappers = U.field(ctx, "typeMappers"); @@ -227,17 +189,9 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testOverride() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setClassNames(Arrays.asList( - "org.apache.ignite.internal.portable.test.*" - )); - BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(); - typeCfg.setClassName("org.apache.ignite.internal.portable.test.GridPortableTestClass2"); + typeCfg.setTypeName("org.apache.ignite.internal.portable.test.GridPortableTestClass2"); typeCfg.setIdMapper(new BinaryIdMapper() { @Override public int typeId(String clsName) { return 100; @@ -248,9 +202,11 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Arrays.asList(typeCfg)); + BinaryMarshaller marsh = portableMarshaller(Arrays.asList( + new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), + typeCfg)); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<Integer, Class> typeIds = U.field(ctx, "userTypes"); @@ -269,16 +225,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testClassNamesJar() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setClassNames(Arrays.asList( - "org.apache.ignite.portable.testjar.*", - "unknown.*" + BinaryMarshaller marsh = portableMarshaller(Arrays.asList( + new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), + new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<Integer, Class> typeIds = U.field(ctx, "userTypes"); @@ -292,11 +244,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testClassNamesWithMapperJar() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setIdMapper(new BinaryIdMapper() { + BinaryMarshaller marsh = portableMarshaller(new BinaryIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -310,14 +258,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { @Override public int fieldId(int typeId, String fieldName) { return 0; } - }); - - marsh.setClassNames(Arrays.asList( - "org.apache.ignite.portable.testjar.*", - "unknown.*" + }, Arrays.asList( + new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), + new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<String, BinaryIdMapper> typeMappers = U.field(ctx, "typeMappers"); @@ -331,16 +277,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTypeConfigurationsJar() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setTypeConfigurations(Arrays.asList( + BinaryMarshaller marsh = portableMarshaller(Arrays.asList( new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<Integer, Class> typeIds = U.field(ctx, "userTypes"); @@ -354,11 +296,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTypeConfigurationsWithGlobalMapperJar() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setIdMapper(new BinaryIdMapper() { + BinaryMarshaller marsh = portableMarshaller(new BinaryIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -372,14 +310,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { @Override public int fieldId(int typeId, String fieldName) { return 0; } - }); - - marsh.setTypeConfigurations(Arrays.asList( + }, Arrays.asList( new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<String, BinaryIdMapper> typeMappers = U.field(ctx, "typeMappers"); @@ -393,11 +329,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTypeConfigurationsWithNonGlobalMapperJar() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setIdMapper(new BinaryIdMapper() { + BinaryMarshaller marsh = portableMarshaller(new BinaryIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -411,14 +343,12 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { @Override public int fieldId(int typeId, String fieldName) { return 0; } - }); - - marsh.setTypeConfigurations(Arrays.asList( + }, Arrays.asList( new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), new BinaryTypeConfiguration("unknown.*") )); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<String, BinaryIdMapper> typeMappers = U.field(ctx, "typeMappers"); @@ -432,14 +362,6 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testOverrideJar() throws Exception { - PortableContext ctx = portableContext(); - - PortableMarshaller marsh = portableMarshaller(); - - marsh.setClassNames(Arrays.asList( - "org.apache.ignite.portable.testjar.*" - )); - BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration( "org.apache.ignite.portable.testjar.GridPortableTestClass2"); @@ -453,9 +375,11 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Arrays.asList(typeCfg)); + BinaryMarshaller marsh = portableMarshaller(Arrays.asList( + new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), + typeCfg)); - ctx.configure(marsh); + PortableContext ctx = portableContext(marsh); Map<Integer, Class> typeIds = U.field(ctx, "userTypes"); @@ -469,4 +393,73 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { assertEquals(100, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2")); } + + /** + * @param marsh Marshaller. + * @return Portable context. + */ + protected PortableContext portableContext(BinaryMarshaller marsh) { + GridPortableMarshaller impl = U.field(marsh, "impl"); + + return impl.context(); + } + + /** + * + */ + protected BinaryMarshaller portableMarshaller() + throws IgniteCheckedException { + return portableMarshaller(null, null, null); + } + + /** + * + */ + protected BinaryMarshaller portableMarshaller(Collection<BinaryTypeConfiguration> cfgs) + throws IgniteCheckedException { + return portableMarshaller(null, null, cfgs); + } + + /** + * + */ + protected BinaryMarshaller portableMarshaller(BinaryIdMapper mapper, Collection<BinaryTypeConfiguration> cfgs) + throws IgniteCheckedException { + return portableMarshaller(mapper, null, cfgs); + } + + /** + * + */ + protected BinaryMarshaller portableMarshaller(BinarySerializer serializer, Collection<BinaryTypeConfiguration> cfgs) + throws IgniteCheckedException { + return portableMarshaller(null, serializer, cfgs); + } + + protected BinaryMarshaller portableMarshaller( + BinaryIdMapper mapper, + BinarySerializer serializer, + Collection<BinaryTypeConfiguration> cfgs + ) throws IgniteCheckedException { + IgniteConfiguration iCfg = new IgniteConfiguration(); + + BinaryConfiguration bCfg = new BinaryConfiguration(); + + bCfg.setIdMapper(mapper); + bCfg.setSerializer(serializer); + + bCfg.setTypeConfigurations(cfgs); + + iCfg.setBinaryConfiguration(bCfg); + + PortableContext ctx = new PortableContext(BinaryNoopMetadataHandler.instance(), iCfg); + + BinaryMarshaller marsh = new BinaryMarshaller(); + + marsh.setContext(new MarshallerContextTestImpl(null)); + + IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, iCfg); + + return marsh; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java index 9225b97..cdae1da 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java @@ -17,16 +17,16 @@ package org.apache.ignite.internal.portable; +import java.util.Arrays; import org.apache.ignite.binary.BinaryField; import org.apache.ignite.binary.BinaryTypeConfiguration; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.marshaller.MarshallerContextTestImpl; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import java.util.Arrays; - /** * Contains tests for compact offsets. */ @@ -38,7 +38,7 @@ public abstract class PortableCompactOffsetsAbstractSelfTest extends GridCommonA private static int POW_16 = 1 << 16; /** Marshaller. */ - protected PortableMarshaller marsh; + protected BinaryMarshaller marsh; /** Portable context. */ protected PortableContext ctx; @@ -49,12 +49,19 @@ public abstract class PortableCompactOffsetsAbstractSelfTest extends GridCommonA ctx = new PortableContext(new TestCachingMetadataHandler(), new IgniteConfiguration()); - marsh = new PortableMarshaller(); + marsh = new BinaryMarshaller(); + + IgniteConfiguration iCfg = new IgniteConfiguration(); + + BinaryConfiguration bCfg = new BinaryConfiguration(); + + bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName()))); + + iCfg.setBinaryConfiguration(bCfg); - marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName()))); marsh.setContext(new MarshallerContextTestImpl(null)); - IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", ctx); + IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, iCfg); } /** @@ -154,7 +161,7 @@ public abstract class PortableCompactOffsetsAbstractSelfTest extends GridCommonA * @return Portable object. * @throws Exception If failed. */ - protected abstract BinaryObjectEx toPortable(PortableMarshaller marsh, Object obj) throws Exception; + protected abstract BinaryObjectEx toPortable(BinaryMarshaller marsh, Object obj) throws Exception; /** * Test object. http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsHeapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsHeapSelfTest.java index ebdef38..15e4fb0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsHeapSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsHeapSelfTest.java @@ -17,14 +17,14 @@ package org.apache.ignite.internal.portable; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; /** * Compact offsets tests for heap portable objects. */ public class PortableCompactOffsetsHeapSelfTest extends PortableCompactOffsetsAbstractSelfTest { /** {@inheritDoc} */ - @Override protected BinaryObjectEx toPortable(PortableMarshaller marsh, Object obj) throws Exception { + @Override protected BinaryObjectEx toPortable(BinaryMarshaller marsh, Object obj) throws Exception { byte[] bytes = marsh.marshal(obj); return new BinaryObjectImpl(ctx, bytes, 0); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsOffheapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsOffheapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsOffheapSelfTest.java index e3b6bda..f3528c6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsOffheapSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsOffheapSelfTest.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.portable; import org.apache.ignite.internal.util.GridUnsafe; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.eclipse.jetty.util.ConcurrentHashSet; import sun.misc.Unsafe; @@ -47,7 +47,7 @@ public class PortableCompactOffsetsOffheapSelfTest extends PortableCompactOffset } /** {@inheritDoc} */ - @Override protected BinaryObjectEx toPortable(PortableMarshaller marsh, Object obj) throws Exception { + @Override protected BinaryObjectEx toPortable(BinaryMarshaller marsh, Object obj) throws Exception { byte[] arr = marsh.marshal(obj); long ptr = UNSAFE.allocateMemory(arr.length); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java index 80c339c..c855c9d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java @@ -24,7 +24,7 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.testframework.GridTestExternalClassLoader; import org.apache.ignite.testframework.config.GridTestProperties; @@ -65,7 +65,7 @@ public abstract class IgniteCacheAbstractExecutionContextTest extends IgniteCach * @throws Exception If failed. */ public void testUsersClassLoader() throws Exception { - if (F.eq(GridTestProperties.getProperty(GridTestProperties.MARSH_CLASS_NAME), PortableMarshaller.class.getName())) + if (F.eq(GridTestProperties.getProperty(GridTestProperties.MARSH_CLASS_NAME), BinaryMarshaller.class.getName())) fail("https://issues.apache.org/jira/browse/IGNITE-1272"); UsersClassLoader testClassLdr = (UsersClassLoader)grid(0).configuration().getClassLoader(); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java index aaefc90..1cde3f8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java @@ -21,8 +21,6 @@ import org.apache.ignite.cache.CacheAtomicWriteOrderMode; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.marshaller.portable.PortableMarshaller; -import org.apache.ignite.testframework.config.GridTestProperties; import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java index c1144b6..7ee6cb6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java @@ -26,11 +26,12 @@ import org.apache.ignite.IgniteDataStreamer; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.binary.Binarylizable; import org.apache.ignite.binary.BinaryReader; @@ -61,12 +62,13 @@ public abstract class GridCacheBinaryObjectsAbstractDataStreamerSelfTest extends cfg.setCacheConfiguration(cacheCfg); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryConfiguration bCfg = new BinaryConfiguration(); - marsh.setTypeConfigurations(Arrays.asList( + bCfg.setTypeConfigurations(Arrays.asList( new BinaryTypeConfiguration(TestObject.class.getName()))); - cfg.setMarshaller(marsh); + cfg.setBinaryConfiguration(bCfg); + cfg.setMarshaller(new BinaryMarshaller()); return cfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java index b626093..5fb02b6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java @@ -27,12 +27,13 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.binary.Binarylizable; import org.apache.ignite.binary.BinaryObject; @@ -67,12 +68,13 @@ public abstract class GridCacheBinaryObjectsAbstractMultiThreadedSelfTest extend cfg.setCacheConfiguration(cacheCfg); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryConfiguration bCfg = new BinaryConfiguration(); - marsh.setTypeConfigurations(Arrays.asList( + bCfg.setTypeConfigurations(Arrays.asList( new BinaryTypeConfiguration(TestObject.class.getName()))); - cfg.setMarshaller(marsh); + cfg.setBinaryConfiguration(bCfg); + cfg.setMarshaller(new BinaryMarshaller()); return cfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractSelfTest.java index 0892750..3925045 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractSelfTest.java @@ -46,7 +46,7 @@ import org.apache.ignite.internal.util.typedef.P2; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiInClosure; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.binary.BinaryObjectBuilder; import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.binary.Binarylizable; @@ -107,7 +107,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA cfg.setCacheConfiguration(cacheCfg); - cfg.setMarshaller(new PortableMarshaller()); + cfg.setMarshaller(new BinaryMarshaller()); return cfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java index d19c1ce..99e2073 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java @@ -33,7 +33,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.binary.BinaryObjectBuilder; import org.apache.ignite.binary.BinaryType; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; @@ -63,7 +63,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder).setForceServerMode(true); - cfg.setMarshaller(new PortableMarshaller()); + cfg.setMarshaller(new BinaryMarshaller()); CacheConfiguration ccfg = new CacheConfiguration();