http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/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 1647a25..001032e 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,19 +41,19 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListSet; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.igniteobject.IgniteObject; -import org.apache.ignite.igniteobject.IgniteObjectBuilder; -import org.apache.ignite.igniteobject.IgniteObjectConfiguration; -import org.apache.ignite.igniteobject.IgniteObjectException; -import org.apache.ignite.igniteobject.IgniteObjectIdMapper; -import org.apache.ignite.igniteobject.IgniteObjectMarshalAware; -import org.apache.ignite.igniteobject.IgniteObjectMetadata; -import org.apache.ignite.igniteobject.IgniteObjectRawReader; -import org.apache.ignite.igniteobject.IgniteObjectRawWriter; -import org.apache.ignite.igniteobject.IgniteObjectReader; -import org.apache.ignite.igniteobject.IgniteObjectSerializer; -import org.apache.ignite.igniteobject.IgniteObjectWriter; -import org.apache.ignite.internal.portable.builder.IgniteObjectBuilderImpl; +import org.apache.ignite.binary.BinaryObject; +import org.apache.ignite.binary.BinaryObjectBuilder; +import org.apache.ignite.binary.BinaryTypeConfiguration; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.BinaryTypeIdMapper; +import org.apache.ignite.binary.Binarylizable; +import org.apache.ignite.binary.BinaryTypeMetadata; +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.BinaryWriter; +import org.apache.ignite.internal.portable.builder.BinaryObjectBuilderImpl; import org.apache.ignite.internal.util.GridUnsafe; import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.internal.util.lang.GridMapEntry; @@ -83,11 +83,11 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { /** */ protected static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() { - @Override public void addMeta(int typeId, IgniteObjectMetadata meta) { + @Override public void addMeta(int typeId, BinaryTypeMetadata meta) { // No-op. } - @Override public IgniteObjectMetadata metadata(int typeId) { + @Override public BinaryTypeMetadata metadata(int typeId) { return null; } }; @@ -396,13 +396,13 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testPortableObject() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - marsh.setTypeConfigurations(Arrays.asList(new IgniteObjectConfiguration(SimpleObject.class.getName()))); + marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject po0 = marshalUnmarshal(po, marsh); + BinaryObject po0 = marshalUnmarshal(po, marsh); assertTrue(po.hasField("b")); assertTrue(po.hasField("s")); @@ -434,7 +434,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testDateAndTimestampInSingleObject() throws Exception { - IgniteObjectConfiguration cfg1 = new IgniteObjectConfiguration(DateClass1.class.getName()); + BinaryTypeConfiguration cfg1 = new BinaryTypeConfiguration(DateClass1.class.getName()); PortableMarshaller marsh = new PortableMarshaller(); @@ -447,7 +447,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { obj1.date = date; obj1.ts = ts; - IgniteObject po1 = marshal(obj1, marsh); + BinaryObject po1 = marshal(obj1, marsh); assertEquals(date, po1.field("date")); assertEquals(Date.class, po1.field("date").getClass()); @@ -466,12 +466,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); assertEquals(obj.hashCode(), po.hashCode()); @@ -508,7 +508,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr"))); assertNull(po.field("unknown")); - IgniteObject innerPo = po.field("inner"); + BinaryObject innerPo = po.field("inner"); assertEquals(obj.inner, innerPo.deserialize()); @@ -553,13 +553,13 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()), - new IgniteObjectConfiguration(TestIgniteObjectObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()), + new BinaryTypeConfiguration(TestBinary.class.getName()) )); - TestIgniteObjectObject obj = portableObject(); + TestBinary obj = portableObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); assertEquals(obj.hashCode(), po.hashCode()); @@ -595,7 +595,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("_enumArr"))); assertNull(po.field("unknown")); - IgniteObject simplePo = po.field("_simple"); + BinaryObject simplePo = po.field("_simple"); assertEquals(obj.simple, simplePo.deserialize()); @@ -633,7 +633,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertNull(simplePo.field("portable")); assertNull(simplePo.field("unknown")); - IgniteObject portablePo = po.field("_portable"); + BinaryObject portablePo = po.field("_portable"); assertEquals(obj.portable, portablePo.deserialize()); @@ -675,7 +675,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @param obj Simple object. * @param po Portable object. */ - private void checkSimpleObjectData(SimpleObject obj, IgniteObject po) { + private void checkSimpleObjectData(SimpleObject obj, BinaryObject po) { assertEquals(obj.b, (byte)po.field("b")); assertEquals(obj.s, (short)po.field("s")); assertEquals(obj.i, (int)po.field("i")); @@ -717,25 +717,25 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(NoPublicConstructor.class.getName()), - new IgniteObjectConfiguration(NoPublicDefaultConstructor.class.getName()), - new IgniteObjectConfiguration(ProtectedConstructor.class.getName())) + new BinaryTypeConfiguration(NoPublicConstructor.class.getName()), + new BinaryTypeConfiguration(NoPublicDefaultConstructor.class.getName()), + new BinaryTypeConfiguration(ProtectedConstructor.class.getName())) ); initPortableContext(marsh); NoPublicConstructor npc = new NoPublicConstructor(); - IgniteObject npc2 = marshal(npc, marsh); + BinaryObject npc2 = marshal(npc, marsh); assertEquals("test", npc2.<NoPublicConstructor>deserialize().val); NoPublicDefaultConstructor npdc = new NoPublicDefaultConstructor(239); - IgniteObject npdc2 = marshal(npdc, marsh); + BinaryObject npdc2 = marshal(npdc, marsh); assertEquals(239, npdc2.<NoPublicDefaultConstructor>deserialize().val); ProtectedConstructor pc = new ProtectedConstructor(); - IgniteObject pc2 = marshal(pc, marsh); + BinaryObject pc2 = marshal(pc, marsh); assertEquals(ProtectedConstructor.class, pc2.<ProtectedConstructor>deserialize().getClass()); } @@ -746,8 +746,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testCustomSerializer() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - IgniteObjectConfiguration type = - new IgniteObjectConfiguration(CustomSerializedObject1.class.getName()); + BinaryTypeConfiguration type = + new BinaryTypeConfiguration(CustomSerializedObject1.class.getName()); type.setSerializer(new CustomSerializer1()); @@ -755,7 +755,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { CustomSerializedObject1 obj1 = new CustomSerializedObject1(10); - IgniteObject po1 = marshal(obj1, marsh); + BinaryObject po1 = marshal(obj1, marsh); assertEquals(20, po1.<CustomSerializedObject1>deserialize().val); } @@ -768,10 +768,10 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setSerializer(new CustomSerializer1()); - IgniteObjectConfiguration type1 = - new IgniteObjectConfiguration(CustomSerializedObject1.class.getName()); - IgniteObjectConfiguration type2 = - new IgniteObjectConfiguration(CustomSerializedObject2.class.getName()); + BinaryTypeConfiguration type1 = + new BinaryTypeConfiguration(CustomSerializedObject1.class.getName()); + BinaryTypeConfiguration type2 = + new BinaryTypeConfiguration(CustomSerializedObject2.class.getName()); type2.setSerializer(new CustomSerializer2()); @@ -779,13 +779,13 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { CustomSerializedObject1 obj1 = new CustomSerializedObject1(10); - IgniteObject po1 = marshal(obj1, marsh); + BinaryObject po1 = marshal(obj1, marsh); assertEquals(20, po1.<CustomSerializedObject1>deserialize().val); CustomSerializedObject2 obj2 = new CustomSerializedObject2(10); - IgniteObject po2 = marshal(obj2, marsh); + BinaryObject po2 = marshal(obj2, marsh); assertEquals(30, po2.<CustomSerializedObject2>deserialize().val); } @@ -796,10 +796,10 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testCustomIdMapper() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - IgniteObjectConfiguration type = - new IgniteObjectConfiguration(CustomMappedObject1.class.getName()); + BinaryTypeConfiguration type = + new BinaryTypeConfiguration(CustomMappedObject1.class.getName()); - type.setIdMapper(new IgniteObjectIdMapper() { + type.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 11111; } @@ -822,7 +822,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str"); - IgniteObjectEx po1 = marshal(obj1, marsh); + BinaryObjectEx po1 = marshal(obj1, marsh); assertEquals(11111, po1.typeId()); assertEquals(10, po1.field(22222)); @@ -838,7 +838,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testCustomIdMapperWithGlobal() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - marsh.setIdMapper(new IgniteObjectIdMapper() { + marsh.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 11111; } @@ -855,12 +855,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - IgniteObjectConfiguration type1 = - new IgniteObjectConfiguration(CustomMappedObject1.class.getName()); - IgniteObjectConfiguration type2 = - new IgniteObjectConfiguration(CustomMappedObject2.class.getName()); + BinaryTypeConfiguration type1 = + new BinaryTypeConfiguration(CustomMappedObject1.class.getName()); + BinaryTypeConfiguration type2 = + new BinaryTypeConfiguration(CustomMappedObject2.class.getName()); - type2.setIdMapper(new IgniteObjectIdMapper() { + type2.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 44444; } @@ -881,7 +881,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str1"); - IgniteObjectEx po1 = marshal(obj1, marsh); + BinaryObjectEx po1 = marshal(obj1, marsh); assertEquals(11111, po1.typeId()); assertEquals(10, po1.field(22222)); @@ -892,7 +892,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { CustomMappedObject2 obj2 = new CustomMappedObject2(20, "str2"); - IgniteObjectEx po2 = marshal(obj2, marsh); + BinaryObjectEx po2 = marshal(obj2, marsh); assertEquals(44444, po2.typeId()); assertEquals(20, po2.field(55555)); @@ -909,10 +909,10 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(DynamicObject.class.getName()) + new BinaryTypeConfiguration(DynamicObject.class.getName()) )); - IgniteObject po1 = marshal(new DynamicObject(0, 10, 20, 30), marsh); + BinaryObject po1 = marshal(new DynamicObject(0, 10, 20, 30), marsh); assertEquals(new Integer(10), po1.field("val1")); assertEquals(null, po1.field("val2")); @@ -924,7 +924,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertEquals(0, do1.val2); assertEquals(0, do1.val3); - IgniteObject po2 = marshal(new DynamicObject(1, 10, 20, 30), marsh); + BinaryObject po2 = marshal(new DynamicObject(1, 10, 20, 30), marsh); assertEquals(new Integer(10), po2.field("val1")); assertEquals(new Integer(20), po2.field("val2")); @@ -936,7 +936,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertEquals(20, do2.val2); assertEquals(0, do2.val3); - IgniteObject po3 = marshal(new DynamicObject(2, 10, 20, 30), marsh); + BinaryObject po3 = marshal(new DynamicObject(2, 10, 20, 30), marsh); assertEquals(new Integer(10), po3.field("val1")); assertEquals(new Integer(20), po3.field("val2")); @@ -956,14 +956,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(CycleLinkObject.class.getName()) + new BinaryTypeConfiguration(CycleLinkObject.class.getName()) )); CycleLinkObject obj = new CycleLinkObject(); obj.self = obj; - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); CycleLinkObject obj0 = po.deserialize(); @@ -977,8 +977,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(DetachedTestObject.class.getName()), - new IgniteObjectConfiguration(DetachedInnerTestObject.class.getName()) + new BinaryTypeConfiguration(DetachedTestObject.class.getName()), + new BinaryTypeConfiguration(DetachedInnerTestObject.class.getName()) )); UUID id = UUID.randomUUID(); @@ -991,7 +991,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assert obj.inner1 == obj.inner4; - IgniteObjectImpl innerPo = (IgniteObjectImpl)obj.inner2; + BinaryObjectImpl innerPo = (BinaryObjectImpl)obj.inner2; assert innerPo.detached(); @@ -999,7 +999,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertEquals(id, inner.id); - IgniteObjectImpl detachedPo = (IgniteObjectImpl)innerPo.detach(); + BinaryObjectImpl detachedPo = (BinaryObjectImpl)innerPo.detach(); assert detachedPo.detached(); @@ -1007,7 +1007,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertEquals(id, inner.id); - innerPo = (IgniteObjectImpl)obj.inner3; + innerPo = (BinaryObjectImpl)obj.inner3; assert innerPo.detached(); @@ -1016,7 +1016,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertEquals(id, inner.id); assertNotNull(inner.inner); - detachedPo = (IgniteObjectImpl)innerPo.detach(); + detachedPo = (BinaryObjectImpl)innerPo.detach(); assert detachedPo.detached(); @@ -1033,9 +1033,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(CollectionFieldsObject.class.getName()), - new IgniteObjectConfiguration(Key.class.getName()), - new IgniteObjectConfiguration(Value.class.getName()) + new BinaryTypeConfiguration(CollectionFieldsObject.class.getName()), + new BinaryTypeConfiguration(Key.class.getName()), + new BinaryTypeConfiguration(Value.class.getName()) )); Object[] arr = new Object[] {new Value(1), new Value(2), new Value(3)}; @@ -1044,7 +1044,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { CollectionFieldsObject obj = new CollectionFieldsObject(arr, col, map); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); Object[] arr0 = po.field("arr"); @@ -1053,18 +1053,18 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { int i = 1; for (Object valPo : arr0) - assertEquals(i++, ((IgniteObject)valPo).<Value>deserialize().val); + assertEquals(i++, ((BinaryObject)valPo).<Value>deserialize().val); - Collection<IgniteObject> col0 = po.field("col"); + Collection<BinaryObject> col0 = po.field("col"); i = 4; - for (IgniteObject valPo : col0) + for (BinaryObject valPo : col0) assertEquals(i++, valPo.<Value>deserialize().val); - Map<IgniteObject, IgniteObject> map0 = po.field("map"); + Map<BinaryObject, BinaryObject> map0 = po.field("map"); - for (Map.Entry<IgniteObject, IgniteObject> e : map0.entrySet()) + for (Map.Entry<BinaryObject, BinaryObject> e : map0.entrySet()) assertEquals(e.getKey().<Key>deserialize().key, e.getValue().<Value>deserialize().val); } @@ -1074,10 +1074,10 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testDefaultMapping() throws Exception { PortableMarshaller marsh1 = new PortableMarshaller(); - IgniteObjectConfiguration customMappingType = - new IgniteObjectConfiguration(TestIgniteObjectObject.class.getName()); + BinaryTypeConfiguration customMappingType = + new BinaryTypeConfiguration(TestBinary.class.getName()); - customMappingType.setIdMapper(new IgniteObjectIdMapper() { + customMappingType.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { String typeName; @@ -1101,19 +1101,19 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { }); marsh1.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()), + new BinaryTypeConfiguration(SimpleObject.class.getName()), customMappingType )); - TestIgniteObjectObject obj = portableObject(); + TestBinary obj = portableObject(); - IgniteObjectImpl po = marshal(obj, marsh1); + BinaryObjectImpl po = marshal(obj, marsh1); PortableMarshaller marsh2 = new PortableMarshaller(); marsh2.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()), - new IgniteObjectConfiguration(TestIgniteObjectObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()), + new BinaryTypeConfiguration(TestBinary.class.getName()) )); PortableContext ctx = initPortableContext(marsh2); @@ -1129,9 +1129,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testTypeNames() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - IgniteObjectConfiguration customType1 = new IgniteObjectConfiguration(Value.class.getName()); + BinaryTypeConfiguration customType1 = new BinaryTypeConfiguration(Value.class.getName()); - customType1.setIdMapper(new IgniteObjectIdMapper() { + customType1.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 300; } @@ -1141,9 +1141,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - IgniteObjectConfiguration customType2 = new IgniteObjectConfiguration("org.gridgain.NonExistentClass1"); + BinaryTypeConfiguration customType2 = new BinaryTypeConfiguration("org.gridgain.NonExistentClass1"); - customType2.setIdMapper(new IgniteObjectIdMapper() { + customType2.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 400; } @@ -1153,9 +1153,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - IgniteObjectConfiguration customType3 = new IgniteObjectConfiguration("NonExistentClass2"); + BinaryTypeConfiguration customType3 = new BinaryTypeConfiguration("NonExistentClass2"); - customType3.setIdMapper(new IgniteObjectIdMapper() { + customType3.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 500; } @@ -1165,9 +1165,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - IgniteObjectConfiguration customType4 = new IgniteObjectConfiguration("NonExistentClass5"); + BinaryTypeConfiguration customType4 = new BinaryTypeConfiguration("NonExistentClass5"); - customType4.setIdMapper(new IgniteObjectIdMapper() { + customType4.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 0; } @@ -1178,9 +1178,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { }); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(Key.class.getName()), - new IgniteObjectConfiguration("org.gridgain.NonExistentClass3"), - new IgniteObjectConfiguration("NonExistentClass4"), + new BinaryTypeConfiguration(Key.class.getName()), + new BinaryTypeConfiguration("org.gridgain.NonExistentClass3"), + new BinaryTypeConfiguration("NonExistentClass4"), customType1, customType2, customType3, @@ -1205,9 +1205,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testFieldIdMapping() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - IgniteObjectConfiguration customType1 = new IgniteObjectConfiguration(Value.class.getName()); + BinaryTypeConfiguration customType1 = new BinaryTypeConfiguration(Value.class.getName()); - customType1.setIdMapper(new IgniteObjectIdMapper() { + customType1.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 300; } @@ -1226,9 +1226,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - IgniteObjectConfiguration customType2 = new IgniteObjectConfiguration("NonExistentClass1"); + BinaryTypeConfiguration customType2 = new BinaryTypeConfiguration("NonExistentClass1"); - customType2.setIdMapper(new IgniteObjectIdMapper() { + customType2.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 400; } @@ -1247,8 +1247,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - marsh.setTypeConfigurations(Arrays.asList(new IgniteObjectConfiguration(Key.class.getName()), - new IgniteObjectConfiguration("NonExistentClass2"), + marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(Key.class.getName()), + new BinaryTypeConfiguration("NonExistentClass2"), customType1, customType2)); @@ -1271,9 +1271,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testDuplicateTypeId() throws Exception { final PortableMarshaller marsh = new PortableMarshaller(); - IgniteObjectConfiguration customType1 = new IgniteObjectConfiguration("org.gridgain.Class1"); + BinaryTypeConfiguration customType1 = new BinaryTypeConfiguration("org.gridgain.Class1"); - customType1.setIdMapper(new IgniteObjectIdMapper() { + customType1.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 100; } @@ -1283,9 +1283,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } }); - IgniteObjectConfiguration customType2 = new IgniteObjectConfiguration("org.gridgain.Class2"); + BinaryTypeConfiguration customType2 = new BinaryTypeConfiguration("org.gridgain.Class2"); - customType2.setIdMapper(new IgniteObjectIdMapper() { + customType2.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 100; } @@ -1317,14 +1317,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - final IgniteObject po = marshal(obj, marsh); + final BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, null); + BinaryObject copy = copy(po, null); assertEquals(obj, copy.deserialize()); @@ -1440,14 +1440,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("str", "str3")); + BinaryObject copy = copy(po, F.<String, Object>asMap("str", "str3")); assertEquals("str3", copy.<String>field("str")); @@ -1463,16 +1463,16 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); UUID uuid = UUID.randomUUID(); - IgniteObject copy = copy(po, F.<String, Object>asMap("uuid", uuid)); + BinaryObject copy = copy(po, F.<String, Object>asMap("uuid", uuid)); assertEquals(uuid, copy.<UUID>field("uuid")); @@ -1488,14 +1488,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("bArr", new byte[]{1, 2, 3})); + BinaryObject copy = copy(po, F.<String, Object>asMap("bArr", new byte[]{1, 2, 3})); assertArrayEquals(new byte[] {1, 2, 3}, copy.<byte[]>field("bArr")); @@ -1509,8 +1509,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @param fields Fields. * @return Copy. */ - private IgniteObject copy(IgniteObject po, Map<String, Object> fields) { - IgniteObjectBuilder builder = IgniteObjectBuilderImpl.wrap(po); + private BinaryObject copy(BinaryObject po, Map<String, Object> fields) { + BinaryObjectBuilder builder = BinaryObjectBuilderImpl.wrap(po); if (fields != null) { for (Map.Entry<String, Object> e : fields.entrySet()) @@ -1527,14 +1527,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("sArr", new short[]{1, 2, 3})); + BinaryObject copy = copy(po, F.<String, Object>asMap("sArr", new short[]{1, 2, 3})); assertArrayEquals(new short[] {1, 2, 3}, copy.<short[]>field("sArr")); @@ -1550,14 +1550,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("iArr", new int[]{1, 2, 3})); + BinaryObject copy = copy(po, F.<String, Object>asMap("iArr", new int[]{1, 2, 3})); assertArrayEquals(new int[] {1, 2, 3}, copy.<int[]>field("iArr")); @@ -1573,14 +1573,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("lArr", new long[]{1, 2, 3})); + BinaryObject copy = copy(po, F.<String, Object>asMap("lArr", new long[]{1, 2, 3})); assertArrayEquals(new long[] {1, 2, 3}, copy.<long[]>field("lArr")); @@ -1596,14 +1596,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("fArr", new float[]{1, 2, 3})); + BinaryObject copy = copy(po, F.<String, Object>asMap("fArr", new float[]{1, 2, 3})); assertArrayEquals(new float[] {1, 2, 3}, copy.<float[]>field("fArr"), 0); @@ -1619,14 +1619,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("dArr", new double[]{1, 2, 3})); + BinaryObject copy = copy(po, F.<String, Object>asMap("dArr", new double[]{1, 2, 3})); assertArrayEquals(new double[] {1, 2, 3}, copy.<double[]>field("dArr"), 0); @@ -1642,14 +1642,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("cArr", new char[]{1, 2, 3})); + BinaryObject copy = copy(po, F.<String, Object>asMap("cArr", new char[]{1, 2, 3})); assertArrayEquals(new char[]{1, 2, 3}, copy.<char[]>field("cArr")); @@ -1665,14 +1665,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); - IgniteObject copy = copy(po, F.<String, Object>asMap("strArr", new String[]{"str1", "str2"})); + BinaryObject copy = copy(po, F.<String, Object>asMap("strArr", new String[]{"str1", "str2"})); assertArrayEquals(new String[]{"str1", "str2"}, copy.<String[]>field("strArr")); @@ -1688,12 +1688,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); SimpleObject newObj = new SimpleObject(); @@ -1701,9 +1701,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { newObj.fArr = new float[] {5, 8, 0}; newObj.str = "newStr"; - IgniteObject copy = copy(po, F.<String, Object>asMap("inner", newObj)); + BinaryObject copy = copy(po, F.<String, Object>asMap("inner", newObj)); - assertEquals(newObj, copy.<IgniteObject>field("inner").deserialize()); + assertEquals(newObj, copy.<BinaryObject>field("inner").deserialize()); SimpleObject obj0 = copy.deserialize(); @@ -1717,12 +1717,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = new PortableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()) + new BinaryTypeConfiguration(SimpleObject.class.getName()) )); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); Map<String, Object> map = new HashMap<>(3, 1.0f); @@ -1736,10 +1736,10 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { map.put("inner", newObj); map.put("bArr", new byte[]{6, 7, 9}); - IgniteObject copy = copy(po, map); + BinaryObject copy = copy(po, map); assertEquals("str555", copy.<String>field("str")); - assertEquals(newObj, copy.<IgniteObject>field("inner").deserialize()); + assertEquals(newObj, copy.<BinaryObject>field("inner").deserialize()); assertArrayEquals(new byte[]{6, 7, 9}, copy.<byte[]>field("bArr")); SimpleObject obj0 = copy.deserialize(); @@ -1755,11 +1755,11 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testPortableCopyMixed() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - marsh.setTypeConfigurations(Arrays.asList(new IgniteObjectConfiguration(SimpleObject.class.getName()))); + marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); SimpleObject obj = simpleObject(); - IgniteObject po = marshal(obj, marsh); + BinaryObject po = marshal(obj, marsh); Map<String, Object> map = new HashMap<>(3, 1.0f); @@ -1776,11 +1776,11 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { map.put("bArr", new byte[]{6, 7, 9}); map.put("b", (byte)111); - IgniteObject copy = copy(po, map); + BinaryObject copy = copy(po, map); assertEquals(1234, copy.<Integer>field("i").intValue()); assertEquals("str555", copy.<String>field("str")); - assertEquals(newObj, copy.<IgniteObject>field("inner").deserialize()); + assertEquals(newObj, copy.<BinaryObject>field("inner").deserialize()); assertEquals((short)2323, copy.<Short>field("s").shortValue()); assertArrayEquals(new byte[] {6, 7, 9}, copy.<byte[]>field("bArr")); assertEquals((byte)111, copy.<Byte>field("b").byteValue()); @@ -1804,7 +1804,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setClassNames(Arrays.asList(SimpleObject.class.getName())); marsh.setKeepDeserialized(true); - IgniteObject po = marshal(simpleObject(), marsh); + BinaryObject po = marshal(simpleObject(), marsh); assert po.deserialize() == po.deserialize(); @@ -1821,7 +1821,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setKeepDeserialized(true); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()))); + new BinaryTypeConfiguration(SimpleObject.class.getName()))); po = marshal(simpleObject(), marsh); @@ -1831,7 +1831,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setKeepDeserialized(false); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(SimpleObject.class.getName()))); + new BinaryTypeConfiguration(SimpleObject.class.getName()))); po = marshal(simpleObject(), marsh); @@ -1841,7 +1841,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setKeepDeserialized(true); - IgniteObjectConfiguration typeCfg = new IgniteObjectConfiguration(SimpleObject.class.getName()); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(SimpleObject.class.getName()); typeCfg.setKeepDeserialized(false); @@ -1855,7 +1855,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setKeepDeserialized(false); - typeCfg = new IgniteObjectConfiguration(SimpleObject.class.getName()); + typeCfg = new BinaryTypeConfiguration(SimpleObject.class.getName()); typeCfg.setKeepDeserialized(true); @@ -1872,13 +1872,13 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public void testOffheapPortable() throws Exception { PortableMarshaller marsh = new PortableMarshaller(); - marsh.setTypeConfigurations(Arrays.asList(new IgniteObjectConfiguration(SimpleObject.class.getName()))); + marsh.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); PortableContext ctx = initPortableContext(marsh); SimpleObject simpleObj = simpleObject(); - IgniteObjectImpl obj = marshal(simpleObj, marsh); + BinaryObjectImpl obj = marshal(simpleObj, marsh); long ptr = 0; @@ -1889,7 +1889,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { try { ptr = copyOffheap(obj); - IgniteObjectOffheapImpl offheapObj = new IgniteObjectOffheapImpl(ctx, + BinaryObjectOffheapImpl offheapObj = new BinaryObjectOffheapImpl(ctx, ptr, 0, obj.array().length); @@ -1902,7 +1902,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { ptr1 = copyOffheap(obj); - IgniteObjectOffheapImpl offheapObj1 = new IgniteObjectOffheapImpl(ctx, + BinaryObjectOffheapImpl offheapObj1 = new BinaryObjectOffheapImpl(ctx, ptr1, 0, obj.array().length); @@ -1915,20 +1915,20 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { checkSimpleObjectData(simpleObj, offheapObj); - IgniteObjectOffheapImpl innerOffheapObj = offheapObj.field("inner"); + BinaryObjectOffheapImpl innerOffheapObj = offheapObj.field("inner"); assertNotNull(innerOffheapObj); checkSimpleObjectData(simpleObj.inner, innerOffheapObj); - obj = (IgniteObjectImpl)offheapObj.heapCopy(); + obj = (BinaryObjectImpl)offheapObj.heapCopy(); assertEquals(obj.typeId(), offheapObj.typeId()); assertEquals(obj.hashCode(), offheapObj.hashCode()); checkSimpleObjectData(simpleObj, obj); - IgniteObjectImpl innerObj = obj.field("inner"); + BinaryObjectImpl innerObj = obj.field("inner"); assertNotNull(innerObj); @@ -1943,7 +1943,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { ptr2 = copyOffheap(obj); - IgniteObjectOffheapImpl offheapObj2 = new IgniteObjectOffheapImpl(ctx, + BinaryObjectOffheapImpl offheapObj2 = new BinaryObjectOffheapImpl(ctx, ptr2, 0, obj.array().length); @@ -1971,7 +1971,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setClassNames( Arrays.asList(MySingleton.class.getName(), SingletonMarker.class.getName())); - IgniteObjectImpl portableObj = marshal(MySingleton.INSTANCE, marsh); + BinaryObjectImpl portableObj = marshal(MySingleton.INSTANCE, marsh); assertTrue(portableObj.array().length <= 1024); // Check that big string was not serialized. @@ -1988,7 +1988,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setClassNames(Collections.singletonList(MyTestClass.class.getName())); - IgniteObjectImpl portableObj = marshal(new MyTestClass(), marsh); + BinaryObjectImpl portableObj = marshal(new MyTestClass(), marsh); MyTestClass obj = portableObj.deserialize(); @@ -2003,7 +2003,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { marsh.setClassNames(Arrays.asList(ChildPortable.class.getName())); - IgniteObjectImpl portableObj = marshal(new ChildPortable(), marsh); + BinaryObjectImpl portableObj = marshal(new ChildPortable(), marsh); ChildPortable singleton = portableObj.deserialize(); @@ -2029,7 +2029,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { obj1.val = BigDecimal.ZERO; obj1.valArr = new BigDecimal[] { BigDecimal.ONE, BigDecimal.TEN }; - IgniteObjectImpl portObj = marshal(obj1, marsh); + BinaryObjectImpl portObj = marshal(obj1, marsh); assertEquals(obj1.val, portObj.field("val")); assertArrayEquals(obj1.valArr, portObj.<BigDecimal[]>field("valArr")); @@ -2076,7 +2076,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { // Checking the writer directly. assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); - try (IgniteObjectWriterExImpl writer = new IgniteObjectWriterExImpl(initPortableContext(new PortableMarshaller()))) { + try (BinaryWriterExImpl writer = new BinaryWriterExImpl(initPortableContext(new PortableMarshaller()))) { assertEquals(true, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); writer.writeString("Thread local test"); @@ -2098,12 +2098,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); // Checking the builder. - IgniteObjectBuilder builder = new IgniteObjectBuilderImpl(initPortableContext(new PortableMarshaller()), + BinaryObjectBuilder builder = new BinaryObjectBuilderImpl(initPortableContext(new PortableMarshaller()), "org.gridgain.foo.bar.TestClass"); builder.setField("a", "1"); - IgniteObject portableObj = builder.build(); + BinaryObject portableObj = builder.build(); assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired()); } @@ -2123,7 +2123,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { try { marsh.marshal(job2); - } catch (IgniteObjectException e) { + } catch (BinaryObjectException e) { assertEquals(true, e.getMessage().contains("Failed to register class")); return; } @@ -2315,7 +2315,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @param obj Object. * @return Offheap address. */ - private long copyOffheap(IgniteObjectImpl obj) { + private long copyOffheap(BinaryObjectImpl obj) { byte[] arr = obj.array(); long ptr = UNSAFE.allocateMemory(arr.length); @@ -2343,7 +2343,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @param off Offset. * @return Value. */ - private int intFromPortable(IgniteObject po, int off) { + private int intFromPortable(BinaryObject po, int off) { byte[] arr = U.field(po, "arr"); return Integer.reverseBytes(U.bytesToInt(arr, off)); @@ -2375,12 +2375,12 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @param marsh Marshaller. * @return Portable object. */ - private <T> IgniteObjectImpl marshal(T obj, PortableMarshaller marsh) throws IgniteCheckedException { + private <T> BinaryObjectImpl marshal(T obj, PortableMarshaller marsh) throws IgniteCheckedException { initPortableContext(marsh); byte[] bytes = marsh.marshal(obj); - return new IgniteObjectImpl(U.<GridPortableMarshaller>field(marsh, "impl").context(), + return new BinaryObjectImpl(U.<GridPortableMarshaller>field(marsh, "impl").context(), bytes, 0); } @@ -2514,7 +2514,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { /** * @return Portable object. */ - private TestIgniteObjectObject portableObject() { + private TestBinary portableObject() { SimpleObject innerSimple = new SimpleObject(); innerSimple.b = 1; @@ -2554,7 +2554,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { innerSimple.map.put(2, "str2"); innerSimple.map.put(3, "str3"); - TestIgniteObjectObject innerPortable = new TestIgniteObjectObject(); + TestBinary innerPortable = new TestBinary(); innerPortable.b = 2; innerPortable.s = 2; @@ -2629,7 +2629,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { innerPortable.mapRaw.put(8, "str8"); innerPortable.mapRaw.put(9, "str9"); - TestIgniteObjectObject outer = new TestIgniteObjectObject(); + TestBinary outer = new TestBinary(); outer.b = 4; outer.s = 4; @@ -2833,7 +2833,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** */ - private static class TestIgniteObjectObject implements IgniteObjectMarshalAware { + private static class TestBinary implements Binarylizable { /** */ private byte b; @@ -3009,13 +3009,13 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { private SimpleObject simpleRaw; /** */ - private TestIgniteObjectObject portable; + private TestBinary portable; /** */ - private TestIgniteObjectObject portableRaw; + private TestBinary portableRaw; /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { writer.writeByte("_b", b); writer.writeShort("_s", s); writer.writeInt("_i", i); @@ -3047,7 +3047,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { writer.writeObject("_simple", simple); writer.writeObject("_portable", portable); - IgniteObjectRawWriter raw = writer.rawWriter(); + BinaryRawWriter raw = writer.rawWriter(); raw.writeByte(bRaw); raw.writeShort(sRaw); @@ -3082,7 +3082,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { b = reader.readByte("_b"); s = reader.readShort("_s"); i = reader.readInt("_i"); @@ -3114,7 +3114,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { simple = reader.readObject("_simple"); portable = reader.readObject("_portable"); - IgniteObjectRawReader raw = reader.rawReader(); + BinaryRawReader raw = reader.rawReader(); bRaw = raw.readByte(); sRaw = raw.readShort(); @@ -3157,20 +3157,20 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { if (other == null || getClass() != other.getClass()) return false; - TestIgniteObjectObject obj = (TestIgniteObjectObject)other; + TestBinary obj = (TestBinary)other; return GridTestUtils.deepEquals(this, obj); } /** {@inheritDoc} */ @Override public String toString() { - return S.toString(TestIgniteObjectObject.class, this); + return S.toString(TestBinary.class, this); } } /** */ - private static class CustomSerializedObject1 implements IgniteObjectMarshalAware { + private static class CustomSerializedObject1 implements Binarylizable { /** */ private int val; @@ -3188,19 +3188,19 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { // No-op. } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { // No-op. } } /** */ - private static class CustomSerializedObject2 implements IgniteObjectMarshalAware { + private static class CustomSerializedObject2 implements Binarylizable { /** */ private int val; @@ -3218,28 +3218,28 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { // No-op. } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { // No-op. } } /** */ - private static class CustomSerializer1 implements IgniteObjectSerializer { + private static class CustomSerializer1 implements BinarySerializer { /** {@inheritDoc} */ - @Override public void writePortable(Object obj, IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException { CustomSerializedObject1 o = (CustomSerializedObject1)obj; writer.writeInt("val", o.val * 2); } /** {@inheritDoc} */ - @Override public void readPortable(Object obj, IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException { CustomSerializedObject1 o = (CustomSerializedObject1)obj; o.val = reader.readInt("val"); @@ -3248,16 +3248,16 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { /** */ - private static class CustomSerializer2 implements IgniteObjectSerializer { + private static class CustomSerializer2 implements BinarySerializer { /** {@inheritDoc} */ - @Override public void writePortable(Object obj, IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException { CustomSerializedObject2 o = (CustomSerializedObject2)obj; writer.writeInt("val", o.val * 3); } /** {@inheritDoc} */ - @Override public void readPortable(Object obj, IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException { CustomSerializedObject2 o = (CustomSerializedObject2)obj; o.val = reader.readInt("val"); @@ -3316,7 +3316,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { /** */ - private static class DynamicObject implements IgniteObjectMarshalAware { + private static class DynamicObject implements Binarylizable { /** */ private int idx; @@ -3348,7 +3348,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { writer.writeInt("val1", val1); if (idx > 0) @@ -3361,7 +3361,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { val1 = reader.readInt("val1"); val2 = reader.readInt("val2"); val3 = reader.readInt("val3"); @@ -3377,7 +3377,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { /** */ - private static class DetachedTestObject implements IgniteObjectMarshalAware { + private static class DetachedTestObject implements Binarylizable { /** */ private DetachedInnerTestObject inner1; @@ -3407,8 +3407,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { - IgniteObjectRawWriterEx raw = (IgniteObjectRawWriterEx)writer.rawWriter(); + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { + BinaryRawWriterEx raw = (BinaryRawWriterEx)writer.rawWriter(); raw.writeObject(inner1); raw.writeObjectDetached(inner2); @@ -3417,8 +3417,8 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { - IgniteObjectRawReaderEx raw = (IgniteObjectRawReaderEx)reader.rawReader(); + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { + BinaryRawReaderEx raw = (BinaryRawReaderEx)reader.rawReader(); inner1 = (DetachedInnerTestObject)raw.readObject(); inner2 = raw.readObjectDetached(); @@ -3598,7 +3598,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { /** * */ - private static class MyTestClass implements IgniteObjectMarshalAware { + private static class MyTestClass implements Binarylizable { /** */ private boolean readyToSerialize; @@ -3624,14 +3624,14 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { if (!readyToSerialize) fail(); } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { - s = "readPortable"; + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { + s = "readBinary"; } } @@ -3715,7 +3715,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { /** * */ - private static class DecimalMarshalAware extends DecimalReflective implements IgniteObjectMarshalAware { + private static class DecimalMarshalAware extends DecimalReflective implements Binarylizable { /** */ public BigDecimal rawVal; @@ -3723,22 +3723,22 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { public BigDecimal[] rawValArr; /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { writer.writeDecimal("val", val); writer.writeDecimalArray("valArr", valArr); - IgniteObjectRawWriter rawWriter = writer.rawWriter(); + BinaryRawWriter rawWriter = writer.rawWriter(); rawWriter.writeDecimal(rawVal); rawWriter.writeDecimalArray(rawValArr); } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { val = reader.readDecimal("val"); valArr = reader.readDecimalArray("valArr"); - IgniteObjectRawReader rawReader = reader.rawReader(); + BinaryRawReader rawReader = reader.rawReader(); rawVal = rawReader.readDecimal(); rawValArr = rawReader.readDecimalArray();
http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java index 8800d81..ed7190e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java @@ -20,12 +20,12 @@ import java.util.Arrays; import org.apache.ignite.IgniteObjects; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.marshaller.portable.PortableMarshaller; -import org.apache.ignite.igniteobject.IgniteObjectBuilder; -import org.apache.ignite.igniteobject.IgniteObjectException; -import org.apache.ignite.igniteobject.IgniteObjectMarshalAware; -import org.apache.ignite.igniteobject.IgniteObjectReader; -import org.apache.ignite.igniteobject.IgniteObjectConfiguration; -import org.apache.ignite.igniteobject.IgniteObjectWriter; +import org.apache.ignite.binary.BinaryObjectBuilder; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.Binarylizable; +import org.apache.ignite.binary.BinaryReader; +import org.apache.ignite.binary.BinaryTypeConfiguration; +import org.apache.ignite.binary.BinaryWriter; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; /** @@ -74,7 +74,7 @@ public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest assertEquals(0, portables().metadata(TestObject1.class).fields().size()); assertEquals(0, portables().metadata(TestObject2.class).fields().size()); - IgniteObjectBuilder bldr = portables().builder("FakeType"); + BinaryObjectBuilder bldr = portables().builder("FakeType"); bldr.setField("field1", 0).setField("field2", "value").build(); @@ -92,12 +92,12 @@ public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest public void testDisableGlobalSimpleClass() throws Exception { marsh = new PortableMarshaller(); - IgniteObjectConfiguration typeCfg = new IgniteObjectConfiguration(TestObject2.class.getName()); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(TestObject2.class.getName()); typeCfg.setMetaDataEnabled(true); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(TestObject1.class.getName()), + new BinaryTypeConfiguration(TestObject1.class.getName()), typeCfg )); @@ -123,12 +123,12 @@ public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest public void testDisableGlobalMarshalAwareClass() throws Exception { marsh = new PortableMarshaller(); - IgniteObjectConfiguration typeCfg = new IgniteObjectConfiguration(TestObject1.class.getName()); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(TestObject1.class.getName()); typeCfg.setMetaDataEnabled(true); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(TestObject2.class.getName()), + new BinaryTypeConfiguration(TestObject2.class.getName()), typeCfg )); @@ -154,12 +154,12 @@ public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest public void testDisableSimpleClass() throws Exception { marsh = new PortableMarshaller(); - IgniteObjectConfiguration typeCfg = new IgniteObjectConfiguration(TestObject1.class.getName()); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(TestObject1.class.getName()); typeCfg.setMetaDataEnabled(false); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(TestObject2.class.getName()), + new BinaryTypeConfiguration(TestObject2.class.getName()), typeCfg )); @@ -183,12 +183,12 @@ public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest public void testDisableMarshalAwareClass() throws Exception { marsh = new PortableMarshaller(); - IgniteObjectConfiguration typeCfg = new IgniteObjectConfiguration(TestObject2.class.getName()); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(TestObject2.class.getName()); typeCfg.setMetaDataEnabled(false); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration(TestObject1.class.getName()), + new BinaryTypeConfiguration(TestObject1.class.getName()), typeCfg )); @@ -216,14 +216,14 @@ public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest /** */ - private static class TestObject2 implements IgniteObjectMarshalAware { + private static class TestObject2 implements Binarylizable { /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { writer.writeInt("field", 1); } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { // No-op. } } http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/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 ac9645b..5b54fb0 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 @@ -26,13 +26,13 @@ import org.apache.ignite.IgniteObjects; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.marshaller.portable.PortableMarshaller; -import org.apache.ignite.igniteobject.IgniteObjectException; -import org.apache.ignite.igniteobject.IgniteObjectMarshalAware; -import org.apache.ignite.igniteobject.IgniteObjectMetadata; -import org.apache.ignite.igniteobject.IgniteObject; -import org.apache.ignite.igniteobject.IgniteObjectRawWriter; -import org.apache.ignite.igniteobject.IgniteObjectReader; -import org.apache.ignite.igniteobject.IgniteObjectWriter; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.Binarylizable; +import org.apache.ignite.binary.BinaryTypeMetadata; +import org.apache.ignite.binary.BinaryObject; +import org.apache.ignite.binary.BinaryRawWriter; +import org.apache.ignite.binary.BinaryReader; +import org.apache.ignite.binary.BinaryWriter; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; /** @@ -84,11 +84,11 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { public void testGetAll() throws Exception { portables().toPortable(new TestObject2()); - Collection<IgniteObjectMetadata> metas = portables().metadata(); + Collection<BinaryTypeMetadata> metas = portables().metadata(); assertEquals(2, metas.size()); - for (IgniteObjectMetadata meta : metas) { + for (BinaryTypeMetadata meta : metas) { Collection<String> fields; switch (meta.typeName()) { @@ -159,7 +159,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testReflection() throws Exception { - IgniteObjectMetadata meta = portables().metadata(TestObject1.class); + BinaryTypeMetadata meta = portables().metadata(TestObject1.class); assertNotNull(meta); @@ -192,7 +192,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { public void testPortableMarshalAware() throws Exception { portables().toPortable(new TestObject2()); - IgniteObjectMetadata meta = portables().metadata(TestObject2.class); + BinaryTypeMetadata meta = portables().metadata(TestObject2.class); assertNotNull(meta); @@ -229,7 +229,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { portables().toPortable(new TestObject2()); - IgniteObjectMetadata meta = portables().metadata(TestObject2.class); + BinaryTypeMetadata meta = portables().metadata(TestObject2.class); assertNotNull(meta); @@ -274,11 +274,11 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { obj.decVal = BigDecimal.ZERO; obj.decArrVal = new BigDecimal[] { BigDecimal.ONE }; - IgniteObject po = portables().toPortable(obj); + BinaryObject po = portables().toPortable(obj); info(po.toString()); - IgniteObjectMetadata meta = po.metaData(); + BinaryTypeMetadata meta = po.metaData(); assertNotNull(meta); @@ -333,9 +333,9 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { /** */ - private static class TestObject2 implements IgniteObjectMarshalAware { + private static class TestObject2 implements Binarylizable { /** {@inheritDoc} */ - @Override public void writePortable(IgniteObjectWriter writer) throws IgniteObjectException { + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { writer.writeBoolean("boolVal", false); writer.writeDate("dateVal", new Date()); writer.writeUuidArray("uuidArrVal", null); @@ -349,14 +349,14 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest { writer.writeCollection("colVal", null); } - IgniteObjectRawWriter raw = writer.rawWriter(); + BinaryRawWriter raw = writer.rawWriter(); raw.writeChar((char)0); raw.writeCollection(null); } /** {@inheritDoc} */ - @Override public void readPortable(IgniteObjectReader reader) throws IgniteObjectException { + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { // No-op. } } http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/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 4629719..fe34fdc 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 @@ -23,9 +23,9 @@ import org.apache.ignite.configuration.IgniteConfiguration; 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.igniteobject.IgniteObjectIdMapper; -import org.apache.ignite.igniteobject.IgniteObjectMetadata; -import org.apache.ignite.igniteobject.IgniteObjectConfiguration; +import org.apache.ignite.binary.BinaryTypeIdMapper; +import org.apache.ignite.binary.BinaryTypeMetadata; +import org.apache.ignite.binary.BinaryTypeConfiguration; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; /** @@ -34,11 +34,11 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { /** */ private static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() { - @Override public void addMeta(int typeId, IgniteObjectMetadata meta) { + @Override public void addMeta(int typeId, BinaryTypeMetadata meta) { // No-op. } - @Override public IgniteObjectMetadata metadata(int typeId) { + @Override public BinaryTypeMetadata metadata(int typeId) { return null; } }; @@ -92,7 +92,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); - marsh.setIdMapper(new IgniteObjectIdMapper() { + marsh.setIdMapper(new BinaryTypeIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -117,7 +117,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { ctx.configure(marsh); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(3, typeMappers.size()); @@ -135,8 +135,8 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration("org.apache.ignite.internal.portable.test.*"), - new IgniteObjectConfiguration("unknown.*") + new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), + new BinaryTypeConfiguration("unknown.*") )); ctx.configure(marsh); @@ -158,7 +158,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); - marsh.setIdMapper(new IgniteObjectIdMapper() { + marsh.setIdMapper(new BinaryTypeIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -177,13 +177,13 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { }); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration("org.apache.ignite.internal.portable.test.*"), - new IgniteObjectConfiguration("unknown.*") + new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), + new BinaryTypeConfiguration("unknown.*") )); ctx.configure(marsh); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(3, typeMappers.size()); @@ -200,7 +200,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); - marsh.setIdMapper(new IgniteObjectIdMapper() { + marsh.setIdMapper(new BinaryTypeIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -219,13 +219,13 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { }); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration("org.apache.ignite.internal.portable.test.*"), - new IgniteObjectConfiguration("unknown.*") + new BinaryTypeConfiguration("org.apache.ignite.internal.portable.test.*"), + new BinaryTypeConfiguration("unknown.*") )); ctx.configure(marsh); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(3, typeMappers.size()); @@ -246,10 +246,10 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { "org.apache.ignite.internal.portable.test.*" )); - IgniteObjectConfiguration typeCfg = new IgniteObjectConfiguration(); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(); typeCfg.setClassName("org.apache.ignite.internal.portable.test.GridPortableTestClass2"); - typeCfg.setIdMapper(new IgniteObjectIdMapper() { + typeCfg.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 100; } @@ -271,7 +271,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { assertTrue(typeIds.containsKey("innerclass".hashCode())); assertFalse(typeIds.containsKey("gridportabletestclass2".hashCode())); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(100, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2")); } @@ -307,7 +307,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); - marsh.setIdMapper(new IgniteObjectIdMapper() { + marsh.setIdMapper(new BinaryTypeIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -330,7 +330,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { ctx.configure(marsh); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(3, typeMappers.size()); @@ -347,8 +347,8 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration("org.apache.ignite.portable.testjar.*"), - new IgniteObjectConfiguration("unknown.*") + new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), + new BinaryTypeConfiguration("unknown.*") )); ctx.configure(marsh); @@ -369,7 +369,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); - marsh.setIdMapper(new IgniteObjectIdMapper() { + marsh.setIdMapper(new BinaryTypeIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -386,13 +386,13 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { }); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration("org.apache.ignite.portable.testjar.*"), - new IgniteObjectConfiguration("unknown.*") + new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), + new BinaryTypeConfiguration("unknown.*") )); ctx.configure(marsh); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(3, typeMappers.size()); @@ -408,7 +408,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { PortableMarshaller marsh = portableMarshaller(); - marsh.setIdMapper(new IgniteObjectIdMapper() { + marsh.setIdMapper(new BinaryTypeIdMapper() { @SuppressWarnings("IfMayBeConditional") @Override public int typeId(String clsName) { if (clsName.endsWith("1")) @@ -425,13 +425,13 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { }); marsh.setTypeConfigurations(Arrays.asList( - new IgniteObjectConfiguration("org.apache.ignite.portable.testjar.*"), - new IgniteObjectConfiguration("unknown.*") + new BinaryTypeConfiguration("org.apache.ignite.portable.testjar.*"), + new BinaryTypeConfiguration("unknown.*") )); ctx.configure(marsh); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(3, typeMappers.size()); @@ -451,10 +451,10 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { "org.apache.ignite.portable.testjar.*" )); - IgniteObjectConfiguration typeCfg = new IgniteObjectConfiguration( + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration( "org.apache.ignite.portable.testjar.GridPortableTestClass2"); - typeCfg.setIdMapper(new IgniteObjectIdMapper() { + typeCfg.setIdMapper(new BinaryTypeIdMapper() { @Override public int typeId(String clsName) { return 100; } @@ -474,7 +474,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode())); - Map<String, IgniteObjectIdMapper> typeMappers = U.field(ctx, "typeMappers"); + Map<String, BinaryTypeIdMapper> typeMappers = U.field(ctx, "typeMappers"); assertEquals(3, typeMappers.size()); http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridBinaryMarshalerAwareTestClass.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridBinaryMarshalerAwareTestClass.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridBinaryMarshalerAwareTestClass.java new file mode 100644 index 0000000..aad0e87 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridBinaryMarshalerAwareTestClass.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.portable.mutabletest; + +import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.Binarylizable; +import org.apache.ignite.binary.BinaryRawReader; +import org.apache.ignite.binary.BinaryRawWriter; +import org.apache.ignite.binary.BinaryReader; +import org.apache.ignite.binary.BinaryWriter; +import org.apache.ignite.testframework.GridTestUtils; + +/** + * + */ +public class GridBinaryMarshalerAwareTestClass implements Binarylizable { + /** */ + public String s; + + /** */ + public String sRaw; + + /** {@inheritDoc} */ + @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { + writer.writeString("s", s); + + BinaryRawWriter raw = writer.rawWriter(); + + raw.writeString(sRaw); + } + + /** {@inheritDoc} */ + @Override public void readBinary(BinaryReader reader) throws BinaryObjectException { + s = reader.readString("s"); + + BinaryRawReader raw = reader.rawReader(); + + sRaw = raw.readString(); + } + + /** {@inheritDoc} */ + @SuppressWarnings("FloatingPointEquality") + @Override public boolean equals(Object other) { + return this == other || GridTestUtils.deepEquals(this, other); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridBinaryMarshalerAwareTestClass.class, this); + } +} \ No newline at end of file
