http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs index 2313f92..150110f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs @@ -26,10 +26,10 @@ namespace Apache.Ignite.Core.Tests.Portable using System.Collections; using System.Collections.Generic; using System.Linq; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Common; - using Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Impl.Portable.IO; - using Apache.Ignite.Core.Portable; + using Apache.Ignite.Core.Impl.Binary; + using Apache.Ignite.Core.Impl.Binary.IO; using NUnit.Framework; /// <summary> @@ -38,7 +38,7 @@ namespace Apache.Ignite.Core.Tests.Portable [TestFixture] public class PortableSelfTest { /** */ - private PortableMarshaller _marsh; + private Marshaller _marsh; /// <summary> /// @@ -46,7 +46,7 @@ namespace Apache.Ignite.Core.Tests.Portable [TestFixtureSetUp] public void BeforeTest() { - _marsh = new PortableMarshaller(null); + _marsh = new Marshaller(null); } /** @@ -504,14 +504,14 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestDateObject() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(DateTimeType))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(DateTimeType))); - PortableConfiguration cfg = new PortableConfiguration {TypeConfigurations = typeCfgs}; + BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs}; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); DateTime now = DateTime.Now; @@ -541,7 +541,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<DateTime>(_marsh.Marshal(timeUtc)), timeUtc); // Check exception with non-UTC date - var stream = new PortableHeapStream(128); + var stream = new BinaryHeapStream(128); var writer = _marsh.StartMarshal(stream); Assert.Throws<InvalidOperationException>(() => writer.WriteTimestamp(DateTime.Now)); } @@ -567,12 +567,12 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestGenericCollectionsType() { - var marsh = new PortableMarshaller(new PortableConfiguration + var marsh = new Marshaller(new BinaryConfiguration { - TypeConfigurations = new List<PortableTypeConfiguration> + TypeConfigurations = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof (PrimitiveFieldType)), - new PortableTypeConfiguration(typeof (GenericCollectionsType<PrimitiveFieldType, SerializableObject>)) + new BinaryTypeConfiguration(typeof (PrimitiveFieldType)), + new BinaryTypeConfiguration(typeof (GenericCollectionsType<PrimitiveFieldType, SerializableObject>)) } }); @@ -609,14 +609,14 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestProperty() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(PropertyType))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(PropertyType))); - PortableConfiguration cfg = new PortableConfiguration {TypeConfigurations = typeCfgs}; + BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs}; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); PropertyType obj = new PropertyType { @@ -631,7 +631,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(obj.Field1, newObj.Field1); Assert.AreEqual(obj.Field2, newObj.Field2); - IPortableObject portNewObj = marsh.Unmarshal<IPortableObject>(data, PortableMode.ForcePortable); + IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary); Assert.AreEqual(obj.Field1, portNewObj.GetField<int>("field1")); Assert.AreEqual(obj.Field2, portNewObj.GetField<int>("Field2")); @@ -643,14 +643,14 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestPrimitiveFieldsReflective() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(PrimitiveFieldType))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldType))); - PortableConfiguration cfg = new PortableConfiguration {TypeConfigurations = typeCfgs}; + BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs}; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); PrimitiveFieldType obj = new PrimitiveFieldType(); @@ -663,16 +663,16 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestPrimitiveFieldsPortable() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(PrimitiveFieldPortableType))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldPortableType))); - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.TypeConfigurations = typeCfgs; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); PrimitiveFieldPortableType obj = new PrimitiveFieldPortableType(); @@ -685,16 +685,16 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestPrimitiveFieldsRawPortable() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(PrimitiveFieldRawPortableType))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldRawPortableType))); - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.TypeConfigurations = typeCfgs; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); PrimitiveFieldRawPortableType obj = new PrimitiveFieldRawPortableType(); @@ -707,17 +707,17 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestPrimitiveFieldsSerializer() { - var typeCfgs = new List<PortableTypeConfiguration> + var typeCfgs = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof (PrimitiveFieldType)) + new BinaryTypeConfiguration(typeof (PrimitiveFieldType)) { Serializer = new PrimitiveFieldsSerializer() } }; - PortableConfiguration cfg = new PortableConfiguration {TypeConfigurations = typeCfgs}; + BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs}; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); PrimitiveFieldType obj = new PrimitiveFieldType(); @@ -730,16 +730,16 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestDecimalFields() { - PortableConfiguration cfg = new PortableConfiguration + BinaryConfiguration cfg = new BinaryConfiguration { - TypeConfigurations = new List<PortableTypeConfiguration> + TypeConfigurations = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof (DecimalReflective)), - new PortableTypeConfiguration(typeof (DecimalMarshalAware)) + new BinaryTypeConfiguration(typeof (DecimalReflective)), + new BinaryTypeConfiguration(typeof (DecimalMarshalAware)) } }; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); // 1. Test reflective stuff. DecimalReflective obj1 = new DecimalReflective @@ -748,7 +748,7 @@ namespace Apache.Ignite.Core.Tests.Portable ValArr = new decimal?[] {decimal.One, decimal.MinusOne} }; - IPortableObject portObj = marsh.Unmarshal<IPortableObject>(marsh.Marshal(obj1), PortableMode.ForcePortable); + IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(marsh.Marshal(obj1), BinaryMode.ForceBinary); Assert.AreEqual(obj1.Val, portObj.GetField<decimal>("val")); Assert.AreEqual(obj1.ValArr, portObj.GetField<decimal?[]>("valArr")); @@ -764,7 +764,7 @@ namespace Apache.Ignite.Core.Tests.Portable obj2.RawVal = decimal.MaxValue; obj2.RawValArr = new decimal?[] { decimal.MinusOne, decimal.One} ; - portObj = marsh.Unmarshal<IPortableObject>(marsh.Marshal(obj2), PortableMode.ForcePortable); + portObj = marsh.Unmarshal<IBinaryObject>(marsh.Marshal(obj2), BinaryMode.ForceBinary); Assert.AreEqual(obj2.Val, portObj.GetField<decimal>("val")); Assert.AreEqual(obj2.ValArr, portObj.GetField<decimal?[]>("valArr")); @@ -781,28 +781,28 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestPrimitiveFieldsRawSerializer() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - PortableTypeConfiguration typeCfg = - new PortableTypeConfiguration(typeof(PrimitiveFieldType)); + BinaryTypeConfiguration typeCfg = + new BinaryTypeConfiguration(typeof(PrimitiveFieldType)); typeCfg.Serializer = new PrimitiveFieldsRawSerializer(); typeCfgs.Add(typeCfg); - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.TypeConfigurations = typeCfgs; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); PrimitiveFieldType obj = new PrimitiveFieldType(); CheckPrimitiveFields(marsh, obj); } - private void CheckPrimitiveFields(PortableMarshaller marsh, PrimitiveFieldType obj) + private void CheckPrimitiveFields(Marshaller marsh, PrimitiveFieldType obj) { obj.PBool = true; obj.PByte = 2; @@ -824,11 +824,11 @@ namespace Apache.Ignite.Core.Tests.Portable CheckPrimitiveFieldsSerialization(marsh, obj); } - private void CheckPrimitiveFieldsSerialization(PortableMarshaller marsh, PrimitiveFieldType obj) + private void CheckPrimitiveFieldsSerialization(Marshaller marsh, PrimitiveFieldType obj) { byte[] bytes = marsh.Marshal(obj); - IPortableObject portObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode()); @@ -843,11 +843,11 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestEnumsReflective() { - PortableMarshaller marsh = - new PortableMarshaller(new PortableConfiguration + Marshaller marsh = + new Marshaller(new BinaryConfiguration { TypeConfigurations = - new List<PortableTypeConfiguration> {new PortableTypeConfiguration(typeof (EnumType))} + new List<BinaryTypeConfiguration> {new BinaryTypeConfiguration(typeof (EnumType))} }); EnumType obj = new EnumType @@ -858,7 +858,7 @@ namespace Apache.Ignite.Core.Tests.Portable byte[] bytes = marsh.Marshal(obj); - IPortableObject portObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode()); @@ -874,12 +874,12 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestCollectionsReflective() { - var marsh = new PortableMarshaller(new PortableConfiguration + var marsh = new Marshaller(new BinaryConfiguration { - TypeConfigurations = new List<PortableTypeConfiguration> + TypeConfigurations = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof (CollectionsType)), - new PortableTypeConfiguration(typeof (InnerObjectType)) + new BinaryTypeConfiguration(typeof (CollectionsType)), + new BinaryTypeConfiguration(typeof (InnerObjectType)) } }); @@ -915,7 +915,7 @@ namespace Apache.Ignite.Core.Tests.Portable byte[] bytes = marsh.Marshal(obj); - IPortableObject portObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode()); @@ -943,17 +943,17 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestObjectReflective() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(OuterObjectType))); - typeCfgs.Add(new PortableTypeConfiguration(typeof(InnerObjectType))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(OuterObjectType))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(InnerObjectType))); - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.TypeConfigurations = typeCfgs; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); CheckObject(marsh, new OuterObjectType(), new InnerObjectType()); } @@ -964,17 +964,17 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestHandles() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(HandleInner))); - typeCfgs.Add(new PortableTypeConfiguration(typeof(HandleOuter))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(HandleInner))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(HandleOuter))); - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.TypeConfigurations = typeCfgs; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); HandleOuter outer = new HandleOuter(); @@ -998,7 +998,7 @@ namespace Apache.Ignite.Core.Tests.Portable byte[] bytes = marsh.Marshal(outer); - IPortableObject outerObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + IBinaryObject outerObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); HandleOuter newOuter = outerObj.Deserialize<HandleOuter>(); HandleInner newInner = newOuter.Inner; @@ -1006,7 +1006,7 @@ namespace Apache.Ignite.Core.Tests.Portable CheckHandlesConsistency(outer, inner, newOuter, newInner); // Get inner object by field. - IPortableObject innerObj = outerObj.GetField<IPortableObject>("inner"); + IBinaryObject innerObj = outerObj.GetField<IBinaryObject>("inner"); newInner = innerObj.Deserialize<HandleInner>(); newOuter = newInner.Outer; @@ -1014,7 +1014,7 @@ namespace Apache.Ignite.Core.Tests.Portable CheckHandlesConsistency(outer, inner, newOuter, newInner); // Get outer object from inner object by handle. - outerObj = innerObj.GetField<IPortableObject>("outer"); + outerObj = innerObj.GetField<IBinaryObject>("outer"); newOuter = outerObj.Deserialize<HandleOuter>(); newInner = newOuter.Inner; @@ -1028,12 +1028,12 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestHandlesExclusive([Values(true, false)] bool detached, [Values(true, false)] bool asPortable) { - var marsh = new PortableMarshaller(new PortableConfiguration + var marsh = new Marshaller(new BinaryConfiguration { - TypeConfigurations = new List<PortableTypeConfiguration> + TypeConfigurations = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof (HandleInner)), - new PortableTypeConfiguration(typeof (HandleOuterExclusive)) + new BinaryTypeConfiguration(typeof (HandleInner)), + new BinaryTypeConfiguration(typeof (HandleOuterExclusive)) } }); @@ -1059,22 +1059,22 @@ namespace Apache.Ignite.Core.Tests.Portable inner.RawOuter = outer; var bytes = asPortable - ? marsh.Marshal(new PortablesImpl(marsh).ToPortable<IPortableObject>(outer)) + ? marsh.Marshal(new IgniteBinary(marsh).ToBinary<IBinaryObject>(outer)) : marsh.Marshal(outer); - IPortableObject outerObj; + IBinaryObject outerObj; if (detached) { - var reader = new PortableReaderImpl(marsh, new Dictionary<long, IPortableTypeDescriptor>(), - new PortableHeapStream(bytes), PortableMode.ForcePortable, null); + var reader = new BinaryReader(marsh, new Dictionary<long, IBinaryTypeDescriptor>(), + new BinaryHeapStream(bytes), BinaryMode.ForceBinary, null); reader.DetachNext(); - outerObj = reader.Deserialize<IPortableObject>(); + outerObj = reader.Deserialize<IBinaryObject>(); } else - outerObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + outerObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); HandleOuter newOuter = outerObj.Deserialize<HandleOuter>(); @@ -1100,7 +1100,7 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestKeepSerializedDefault() { - CheckKeepSerialized(new PortableConfiguration(), true); + CheckKeepSerialized(new BinaryConfiguration(), true); } /// @@ -1109,7 +1109,7 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestKeepSerializedDefaultFalse() { - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.DefaultKeepDeserialized = false; @@ -1122,13 +1122,13 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestKeepSerializedTypeCfgFalse() { - PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(typeof(PropertyType)); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(PropertyType)); typeCfg.KeepDeserialized = false; - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); - cfg.TypeConfigurations = new List<PortableTypeConfiguration> { typeCfg }; + cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg }; CheckKeepSerialized(cfg, false); } @@ -1139,13 +1139,13 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestKeepSerializedTypeCfgTrue() { - PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(typeof(PropertyType)); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(PropertyType)); typeCfg.KeepDeserialized = true; - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.DefaultKeepDeserialized = false; - cfg.TypeConfigurations = new List<PortableTypeConfiguration> { typeCfg }; + cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg }; CheckKeepSerialized(cfg, true); } @@ -1156,17 +1156,17 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestSpecialArrays() { - ICollection<PortableTypeConfiguration> typeCfgs = - new List<PortableTypeConfiguration>(); + ICollection<BinaryTypeConfiguration> typeCfgs = + new List<BinaryTypeConfiguration>(); - typeCfgs.Add(new PortableTypeConfiguration(typeof(SpecialArray))); - typeCfgs.Add(new PortableTypeConfiguration(typeof(SpecialArrayMarshalAware))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(SpecialArray))); + typeCfgs.Add(new BinaryTypeConfiguration(typeof(SpecialArrayMarshalAware))); - PortableConfiguration cfg = new PortableConfiguration(); + BinaryConfiguration cfg = new BinaryConfiguration(); cfg.TypeConfigurations = typeCfgs; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); Guid[] guidArr = { Guid.NewGuid() }; Guid?[] nGuidArr = { Guid.NewGuid() }; @@ -1184,7 +1184,7 @@ namespace Apache.Ignite.Core.Tests.Portable byte[] bytes = marsh.Marshal(obj1); - IPortableObject portObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); Assert.IsNotNull(portObj.Deserialize<SpecialArray>()); @@ -1210,7 +1210,7 @@ namespace Apache.Ignite.Core.Tests.Portable bytes = marsh.Marshal(obj2); - portObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); Assert.AreEqual(guidArr, portObj.GetField<Guid[]>("a")); Assert.AreEqual(nGuidArr, portObj.GetField<Guid?[]>("b")); @@ -1232,12 +1232,12 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestCompactSchema() { - var marsh = new PortableMarshaller(new PortableConfiguration + var marsh = new Marshaller(new BinaryConfiguration { - TypeConfigurations = new List<PortableTypeConfiguration> + TypeConfigurations = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof (SpecialArray)), - new PortableTypeConfiguration(typeof (SpecialArrayMarshalAware)) + new BinaryTypeConfiguration(typeof (SpecialArray)), + new BinaryTypeConfiguration(typeof (SpecialArrayMarshalAware)) } }); @@ -1257,21 +1257,21 @@ namespace Apache.Ignite.Core.Tests.Portable } } - private static void CheckKeepSerialized(PortableConfiguration cfg, bool expKeep) + private static void CheckKeepSerialized(BinaryConfiguration cfg, bool expKeep) { if (cfg.TypeConfigurations == null) { - cfg.TypeConfigurations = new List<PortableTypeConfiguration> + cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof(PropertyType)) + new BinaryTypeConfiguration(typeof(PropertyType)) }; } - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); byte[] data = marsh.Marshal(new PropertyType()); - IPortableObject portNewObj = marsh.Unmarshal<IPortableObject>(data, PortableMode.ForcePortable); + IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary); PropertyType deserialized1 = portNewObj.Deserialize<PropertyType>(); PropertyType deserialized2 = portNewObj.Deserialize<PropertyType>(); @@ -1301,7 +1301,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(inner.RawAfter, newInner.RawAfter); } - private static void CheckObject(PortableMarshaller marsh, OuterObjectType outObj, InnerObjectType inObj) + private static void CheckObject(Marshaller marsh, OuterObjectType outObj, InnerObjectType inObj) { inObj.PInt1 = 1; inObj.PInt2 = 2; @@ -1310,7 +1310,7 @@ namespace Apache.Ignite.Core.Tests.Portable byte[] bytes = marsh.Marshal(outObj); - IPortableObject portOutObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); + IBinaryObject portOutObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary); Assert.AreEqual(outObj.GetHashCode(), portOutObj.GetHashCode()); @@ -1418,7 +1418,7 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public class GenericCollectionsType<TKey, TValue> : IPortableMarshalAware + public class GenericCollectionsType<TKey, TValue> : IBinarizable { public ICollection<TKey> Keys { get; set; } @@ -1428,7 +1428,7 @@ namespace Apache.Ignite.Core.Tests.Portable public ICollection<object> Objects { get; set; } - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteObject("Keys", Keys); writer.WriteObject("Values", Values); @@ -1436,7 +1436,7 @@ namespace Apache.Ignite.Core.Tests.Portable writer.WriteObject("Objects", Objects); } - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { Keys = (ICollection<TKey>) reader.ReadObject<object>("Keys"); Values = (ICollection<TValue>) reader.ReadObject<object>("Values"); @@ -1529,9 +1529,9 @@ namespace Apache.Ignite.Core.Tests.Portable public DateTime?[] NDateArr; } - public class SpecialArrayMarshalAware : SpecialArray, IPortableMarshalAware + public class SpecialArrayMarshalAware : SpecialArray, IBinarizable { - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteObject("a", GuidArr); writer.WriteObject("b", NGuidArr); @@ -1539,7 +1539,7 @@ namespace Apache.Ignite.Core.Tests.Portable writer.WriteObject("d", NDateArr); } - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { GuidArr = reader.ReadObject<Guid[]>("a"); NGuidArr = reader.ReadObject<Guid?[]>("b"); @@ -1627,9 +1627,9 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public class PrimitiveFieldPortableType : PrimitiveFieldType, IPortableMarshalAware + public class PrimitiveFieldPortableType : PrimitiveFieldType, IBinarizable { - public unsafe void WritePortable(IPortableWriter writer) + public unsafe void WriteBinary(IBinaryWriter writer) { writer.WriteBoolean("bool", PBool); writer.WriteByte("byte", PByte); @@ -1657,7 +1657,7 @@ namespace Apache.Ignite.Core.Tests.Portable writer.WriteObject("iguid", IgniteGuid); } - public unsafe void ReadPortable(IPortableReader reader) + public unsafe void ReadBinary(IBinaryReader reader) { PBool = reader.ReadBoolean("bool"); PByte = reader.ReadByte("byte"); @@ -1687,11 +1687,11 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public class PrimitiveFieldRawPortableType : PrimitiveFieldType, IPortableMarshalAware + public class PrimitiveFieldRawPortableType : PrimitiveFieldType, IBinarizable { - public unsafe void WritePortable(IPortableWriter writer) + public unsafe void WriteBinary(IBinaryWriter writer) { - IPortableRawWriter rawWriter = writer.GetRawWriter(); + IBinaryRawWriter rawWriter = writer.GetRawWriter(); rawWriter.WriteBoolean(PBool); rawWriter.WriteByte(PByte); @@ -1719,9 +1719,9 @@ namespace Apache.Ignite.Core.Tests.Portable rawWriter.WriteObject(IgniteGuid); } - public unsafe void ReadPortable(IPortableReader reader) + public unsafe void ReadBinary(IBinaryReader reader) { - IPortableRawReader rawReader = reader.GetRawReader(); + IBinaryRawReader rawReader = reader.GetRawReader(); PBool = rawReader.ReadBoolean(); PByte = rawReader.ReadByte(); @@ -1751,9 +1751,9 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public class PrimitiveFieldsSerializer : IPortableSerializer + public class PrimitiveFieldsSerializer : IBinarySerializer { - public unsafe void WritePortable(object obj, IPortableWriter writer) + public unsafe void WriteBinary(object obj, IBinaryWriter writer) { PrimitiveFieldType obj0 = (PrimitiveFieldType)obj; @@ -1783,7 +1783,7 @@ namespace Apache.Ignite.Core.Tests.Portable writer.WriteObject("iguid", obj0.IgniteGuid); } - public unsafe void ReadPortable(object obj, IPortableReader reader) + public unsafe void ReadBinary(object obj, IBinaryReader reader) { PrimitiveFieldType obj0 = (PrimitiveFieldType)obj; @@ -1815,13 +1815,13 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public class PrimitiveFieldsRawSerializer : IPortableSerializer + public class PrimitiveFieldsRawSerializer : IBinarySerializer { - public unsafe void WritePortable(object obj, IPortableWriter writer) + public unsafe void WriteBinary(object obj, IBinaryWriter writer) { PrimitiveFieldType obj0 = (PrimitiveFieldType)obj; - IPortableRawWriter rawWriter = writer.GetRawWriter(); + IBinaryRawWriter rawWriter = writer.GetRawWriter(); rawWriter.WriteBoolean(obj0.PBool); rawWriter.WriteByte(obj0.PByte); @@ -1849,11 +1849,11 @@ namespace Apache.Ignite.Core.Tests.Portable rawWriter.WriteObject(obj0.IgniteGuid); } - public unsafe void ReadPortable(object obj, IPortableReader reader) + public unsafe void ReadBinary(object obj, IBinaryReader reader) { PrimitiveFieldType obj0 = (PrimitiveFieldType)obj; - IPortableRawReader rawReader = reader.GetRawReader(); + IBinaryRawReader rawReader = reader.GetRawReader(); obj0.PBool = rawReader.ReadBoolean(); obj0.PByte = rawReader.ReadByte(); @@ -1882,7 +1882,7 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public class HandleOuter : IPortableMarshalAware + public class HandleOuter : IBinarizable { public string Before; public HandleInner Inner; @@ -1893,13 +1893,13 @@ namespace Apache.Ignite.Core.Tests.Portable public string RawAfter; /** <inheritdoc /> */ - virtual public void WritePortable(IPortableWriter writer) + virtual public void WriteBinary(IBinaryWriter writer) { writer.WriteString("before", Before); writer.WriteObject("inner", Inner); writer.WriteString("after", After); - IPortableRawWriter rawWriter = writer.GetRawWriter(); + IBinaryRawWriter rawWriter = writer.GetRawWriter(); rawWriter.WriteString(RawBefore); rawWriter.WriteObject(RawInner); @@ -1907,13 +1907,13 @@ namespace Apache.Ignite.Core.Tests.Portable } /** <inheritdoc /> */ - virtual public void ReadPortable(IPortableReader reader) + virtual public void ReadBinary(IBinaryReader reader) { Before = reader.ReadString("before"); Inner = reader.ReadObject<HandleInner>("inner"); After = reader.ReadString("after"); - IPortableRawReader rawReader = reader.GetRawReader(); + IBinaryRawReader rawReader = reader.GetRawReader(); RawBefore = rawReader.ReadString(); RawInner = rawReader.ReadObject<HandleInner>(); @@ -1921,7 +1921,7 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public class HandleInner : IPortableMarshalAware + public class HandleInner : IBinarizable { public string Before; public HandleOuter Outer; @@ -1932,13 +1932,13 @@ namespace Apache.Ignite.Core.Tests.Portable public string RawAfter; /** <inheritdoc /> */ - virtual public void WritePortable(IPortableWriter writer) + virtual public void WriteBinary(IBinaryWriter writer) { writer.WriteString("before", Before); writer.WriteObject("outer", Outer); writer.WriteString("after", After); - IPortableRawWriter rawWriter = writer.GetRawWriter(); + IBinaryRawWriter rawWriter = writer.GetRawWriter(); rawWriter.WriteString(RawBefore); rawWriter.WriteObject(RawOuter); @@ -1946,13 +1946,13 @@ namespace Apache.Ignite.Core.Tests.Portable } /** <inheritdoc /> */ - virtual public void ReadPortable(IPortableReader reader) + virtual public void ReadBinary(IBinaryReader reader) { Before = reader.ReadString("before"); Outer = reader.ReadObject<HandleOuter>("outer"); After = reader.ReadString("after"); - IPortableRawReader rawReader = reader.GetRawReader(); + IBinaryRawReader rawReader = reader.GetRawReader(); RawBefore = rawReader.ReadString(); RawOuter = rawReader.ReadObject<HandleOuter>(); @@ -1964,9 +1964,9 @@ namespace Apache.Ignite.Core.Tests.Portable public class HandleOuterExclusive : HandleOuter { /** <inheritdoc /> */ - override public void WritePortable(IPortableWriter writer) + override public void WriteBinary(IBinaryWriter writer) { - PortableWriterImpl writer0 = (PortableWriterImpl)writer; + BinaryWriter writer0 = (BinaryWriter)writer; writer.WriteString("before", Before); @@ -1974,7 +1974,7 @@ namespace Apache.Ignite.Core.Tests.Portable writer.WriteString("after", After); - IPortableRawWriter rawWriter = writer.GetRawWriter(); + IBinaryRawWriter rawWriter = writer.GetRawWriter(); rawWriter.WriteString(RawBefore); @@ -1984,9 +1984,9 @@ namespace Apache.Ignite.Core.Tests.Portable } /** <inheritdoc /> */ - override public void ReadPortable(IPortableReader reader) + override public void ReadBinary(IBinaryReader reader) { - var reader0 = (PortableReaderImpl) reader; + var reader0 = (BinaryReader) reader; Before = reader0.ReadString("before"); @@ -1995,7 +1995,7 @@ namespace Apache.Ignite.Core.Tests.Portable After = reader0.ReadString("after"); - var rawReader = (PortableReaderImpl) reader.GetRawReader(); + var rawReader = (BinaryReader) reader.GetRawReader(); RawBefore = rawReader.ReadString(); @@ -2031,7 +2031,7 @@ namespace Apache.Ignite.Core.Tests.Portable public decimal?[] ValArr; } - public class DecimalMarshalAware : DecimalReflective, IPortableMarshalAware + public class DecimalMarshalAware : DecimalReflective, IBinarizable { /** */ public decimal? RawVal; @@ -2040,24 +2040,24 @@ namespace Apache.Ignite.Core.Tests.Portable public decimal?[] RawValArr; /** <inheritDoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteDecimal("val", Val); writer.WriteDecimalArray("valArr", ValArr); - IPortableRawWriter rawWriter = writer.GetRawWriter(); + IBinaryRawWriter rawWriter = writer.GetRawWriter(); rawWriter.WriteDecimal(RawVal); rawWriter.WriteDecimalArray(RawValArr); } /** <inheritDoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { Val = reader.ReadDecimal("val"); ValArr = reader.ReadDecimalArray("valArr"); - IPortableRawReader rawReader = reader.GetRawReader(); + IBinaryRawReader rawReader = reader.GetRawReader(); RawVal = rawReader.ReadDecimal(); RawValArr = rawReader.ReadDecimalArray(); @@ -2067,7 +2067,7 @@ namespace Apache.Ignite.Core.Tests.Portable /// <summary> /// Date time type. /// </summary> - public class DateTimeType : IPortableMarshalAware + public class DateTimeType : IBinarizable { public DateTime Utc; @@ -2101,13 +2101,13 @@ namespace Apache.Ignite.Core.Tests.Portable } /** <inheritDoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteTimestamp("utc", Utc); writer.WriteTimestamp("utcNull", UtcNull); writer.WriteTimestampArray("utcArr", UtcArr); - IPortableRawWriter rawWriter = writer.GetRawWriter(); + IBinaryRawWriter rawWriter = writer.GetRawWriter(); rawWriter.WriteTimestamp(UtcRaw); rawWriter.WriteTimestamp(UtcNullRaw); @@ -2115,13 +2115,13 @@ namespace Apache.Ignite.Core.Tests.Portable } /** <inheritDoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { Utc = reader.ReadTimestamp("utc").Value; UtcNull = reader.ReadTimestamp("utc").Value; UtcArr = reader.ReadTimestampArray("utcArr"); - IPortableRawReader rawReader = reader.GetRawReader(); + IBinaryRawReader rawReader = reader.GetRawReader(); UtcRaw = rawReader.ReadTimestamp().Value; UtcNullRaw = rawReader.ReadTimestamp().Value;
http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs index 4baebde..32b659e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs @@ -20,9 +20,9 @@ namespace Apache.Ignite.Core.Tests.Portable using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Impl; - using Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Portable; + using Apache.Ignite.Core.Impl.Binary; using NUnit.Framework; /// <summary> @@ -56,14 +56,14 @@ namespace Apache.Ignite.Core.Tests.Portable objs = IgniteUtils.Shuffle(objs); // 2. Create new marshaller. - PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(typeof(BranchedType)); + BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(BranchedType)); - PortableConfiguration cfg = new PortableConfiguration + BinaryConfiguration cfg = new BinaryConfiguration { - TypeConfigurations = new List<PortableTypeConfiguration> { typeCfg } + TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg } }; - PortableMarshaller marsh = new PortableMarshaller(cfg); + Marshaller marsh = new Marshaller(cfg); // 3. Marshal all data and ensure deserialized object is fine. foreach (BranchedType obj in objs) @@ -89,7 +89,7 @@ namespace Apache.Ignite.Core.Tests.Portable } [SuppressMessage("ReSharper", "InconsistentNaming")] - public class BranchedType : IPortableMarshalAware + public class BranchedType : IBinarizable { public int mode; public int f2; @@ -147,7 +147,7 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("mode", mode); @@ -194,7 +194,7 @@ namespace Apache.Ignite.Core.Tests.Portable } } - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { mode = reader.ReadInt("mode"); http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs index 26c9122..16c68e1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs @@ -20,8 +20,8 @@ namespace Apache.Ignite.Core.Tests using System; using System.Collections.Generic; using System.Linq; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache; - using Apache.Ignite.Core.Portable; using NUnit.Framework; /// <summary> @@ -62,8 +62,8 @@ namespace Apache.Ignite.Core.Tests /// <summary> /// Starts the grid with provided config. /// </summary> - /// <param name="portableConfiguration">The portable configuration.</param> - private void StartGrid(PortableConfiguration portableConfiguration) + /// <param name="binaryConfiguration">The portable configuration.</param> + private void StartGrid(BinaryConfiguration binaryConfiguration) { Ignition.StopAll(true); @@ -72,7 +72,7 @@ namespace Apache.Ignite.Core.Tests SpringConfigUrl = "config\\cache-portables.xml", JvmClasspath = TestUtils.CreateTestClasspath(), JvmOptions = TestUtils.TestJavaOptions(), - PortableConfiguration = portableConfiguration + BinaryConfiguration = binaryConfiguration }); _cache = grid.GetCache<int, TestGenericPortableBase>(null); @@ -84,7 +84,7 @@ namespace Apache.Ignite.Core.Tests [TestFixtureTearDown] public void TestFixtureTearDown() { - TestUtils.KillProcesses(); + Ignition.StopAll(true); } /// <summary> @@ -93,9 +93,9 @@ namespace Apache.Ignite.Core.Tests [Test] public void TestCodeConfiguration() { - StartGrid(new PortableConfiguration + StartGrid(new BinaryConfiguration { - TypeConfigurations = TestTypes.Select(x => new PortableTypeConfiguration(x)).ToList() + TypeConfigurations = TestTypes.Select(x => new BinaryTypeConfiguration(x)).ToList() }); CheckPortableTypes(TestTypes); http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs index 1e11001..08134fd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs @@ -17,12 +17,12 @@ namespace Apache.Ignite.Core.Tests.Query { - using Apache.Ignite.Core.Portable; + using Apache.Ignite.Core.Binary; /// <summary> /// Test person. /// </summary> - internal class PortablePerson : IPortableMarshalAware + internal class PortablePerson : IBinarizable { /// <summary> /// Initializes a new instance of the <see cref="PortablePerson"/> class. @@ -51,7 +51,7 @@ namespace Apache.Ignite.Core.Tests.Query public int Age { get; set; } /** <ineritdoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteString("name", Name); writer.WriteString("address", Address); @@ -59,7 +59,7 @@ namespace Apache.Ignite.Core.Tests.Query } /** <ineritdoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { Name = reader.ReadString("name"); Address = reader.ReadString("address"); http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs index 44e1d71..1fe6a21 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs @@ -22,10 +22,10 @@ namespace Apache.Ignite.Core.Tests.Services using System.IO; using System.Linq; using System.Reflection; + using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Memory; - using Apache.Ignite.Core.Impl.Portable; using Apache.Ignite.Core.Impl.Services; - using Apache.Ignite.Core.Portable; using Apache.Ignite.Core.Services; using NUnit.Framework; @@ -38,17 +38,17 @@ namespace Apache.Ignite.Core.Tests.Services private TestIgniteService _svc; /** */ - private readonly PortableMarshaller _marsh = new PortableMarshaller(new PortableConfiguration + private readonly Marshaller _marsh = new Marshaller(new BinaryConfiguration { TypeConfigurations = new[] { - new PortableTypeConfiguration(typeof (TestPortableClass)), - new PortableTypeConfiguration(typeof (CustomExceptionPortable)) + new BinaryTypeConfiguration(typeof (TestPortableClass)), + new BinaryTypeConfiguration(typeof (CustomExceptionPortable)) } }); /** */ - protected readonly IPortables Portables; + protected readonly IIgniteBinary IgniteBinary; /** */ private readonly PlatformMemoryManager _memory = new PlatformMemoryManager(1024); @@ -64,7 +64,7 @@ namespace Apache.Ignite.Core.Tests.Services /// </summary> public ServiceProxyTest() { - Portables = new PortablesImpl(_marsh); + IgniteBinary = new IgniteBinary(_marsh); } /// <summary> @@ -204,10 +204,10 @@ namespace Apache.Ignite.Core.Tests.Services if (KeepPortable) { - Assert.AreEqual("Proxy method invocation failed with a portable error. " + - "Examine PortableCause for details.", ex.Message); + Assert.AreEqual("Proxy method invocation failed with a binary error. " + + "Examine BinaryCause for details.", ex.Message); - Assert.IsNotNull(ex.PortableCause); + Assert.IsNotNull(ex.BinaryCause); Assert.IsNull(ex.InnerException); } else @@ -215,7 +215,7 @@ namespace Apache.Ignite.Core.Tests.Services Assert.AreEqual("Proxy method invocation failed with an exception. " + "Examine InnerException for details.", ex.Message); - Assert.IsNull(ex.PortableCause); + Assert.IsNull(ex.BinaryCause); Assert.IsNotNull(ex.InnerException); } @@ -243,7 +243,7 @@ namespace Apache.Ignite.Core.Tests.Services /// </summary> protected T GetProxy<T>() { - _svc = new TestIgniteService(Portables); + _svc = new TestIgniteService(IgniteBinary); var prx = new ServiceProxy<T>(InvokeProxyMethod).GetTransparentProxy(); @@ -357,13 +357,13 @@ namespace Apache.Ignite.Core.Tests.Services void CustomExceptionPortableMethod(bool throwOnWrite, bool throwOnRead); /** */ - TestPortableClass PortableArgMethod(int arg1, IPortableObject arg2); + TestPortableClass PortableArgMethod(int arg1, IBinaryObject arg2); /** */ - IPortableObject PortableResultMethod(int arg1, TestPortableClass arg2); + IBinaryObject PortableResultMethod(int arg1, TestPortableClass arg2); /** */ - IPortableObject PortableArgAndResultMethod(int arg1, IPortableObject arg2); + IBinaryObject PortableArgAndResultMethod(int arg1, IBinaryObject arg2); /** */ int AmbiguousMethod(int arg); @@ -417,13 +417,13 @@ namespace Apache.Ignite.Core.Tests.Services void CustomExceptionPortableMethod(bool throwOnWrite, bool throwOnRead); /** */ - TestPortableClass PortableArgMethod(int arg1, IPortableObject arg2); + TestPortableClass PortableArgMethod(int arg1, IBinaryObject arg2); /** */ - IPortableObject PortableResultMethod(int arg1, TestPortableClass arg2); + IBinaryObject PortableResultMethod(int arg1, TestPortableClass arg2); /** */ - IPortableObject PortableArgAndResultMethod(int arg1, IPortableObject arg2); + IBinaryObject PortableArgAndResultMethod(int arg1, IBinaryObject arg2); /** */ void MissingMethod(); @@ -439,15 +439,15 @@ namespace Apache.Ignite.Core.Tests.Services private class TestIgniteService : ITestIgniteService, ITestIgniteServiceAmbiguity { /** */ - private readonly IPortables _portables; + private readonly IIgniteBinary _igniteBinary; /// <summary> /// Initializes a new instance of the <see cref="TestIgniteService"/> class. /// </summary> - /// <param name="portables">The portables.</param> - public TestIgniteService(IPortables portables) + /// <param name="igniteBinary">The portables.</param> + public TestIgniteService(IIgniteBinary igniteBinary) { - _portables = portables; + _igniteBinary = igniteBinary; } /** <inheritdoc /> */ @@ -526,21 +526,21 @@ namespace Apache.Ignite.Core.Tests.Services } /** <inheritdoc /> */ - public TestPortableClass PortableArgMethod(int arg1, IPortableObject arg2) + public TestPortableClass PortableArgMethod(int arg1, IBinaryObject arg2) { return arg2.Deserialize<TestPortableClass>(); } /** <inheritdoc /> */ - public IPortableObject PortableResultMethod(int arg1, TestPortableClass arg2) + public IBinaryObject PortableResultMethod(int arg1, TestPortableClass arg2) { - return _portables.ToPortable<IPortableObject>(arg2); + return _igniteBinary.ToBinary<IBinaryObject>(arg2); } /** <inheritdoc /> */ - public IPortableObject PortableArgAndResultMethod(int arg1, IPortableObject arg2) + public IBinaryObject PortableArgAndResultMethod(int arg1, IBinaryObject arg2) { - return _portables.ToPortable<IPortableObject>(arg2.Deserialize<TestPortableClass>()); + return _igniteBinary.ToBinary<IBinaryObject>(arg2.Deserialize<TestPortableClass>()); } /** <inheritdoc /> */ @@ -595,7 +595,7 @@ namespace Apache.Ignite.Core.Tests.Services /// <summary> /// Custom non-serializable exception. /// </summary> - private class CustomExceptionPortable : Exception, IPortableMarshalAware + private class CustomExceptionPortable : Exception, IBinarizable { /** */ public bool ThrowOnWrite { get; set; } @@ -604,7 +604,7 @@ namespace Apache.Ignite.Core.Tests.Services public bool ThrowOnRead { get; set; } /** <inheritdoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteBoolean("ThrowOnRead", ThrowOnRead); @@ -613,7 +613,7 @@ namespace Apache.Ignite.Core.Tests.Services } /** <inheritdoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { ThrowOnRead = reader.ReadBoolean("ThrowOnRead"); @@ -625,7 +625,7 @@ namespace Apache.Ignite.Core.Tests.Services /// <summary> /// Portable object for method argument/result. /// </summary> - protected class TestPortableClass : IPortableMarshalAware + protected class TestPortableClass : IBinarizable { /** */ public string Prop { get; set; } @@ -637,7 +637,7 @@ namespace Apache.Ignite.Core.Tests.Services public bool ThrowOnRead { get; set; } /** <inheritdoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteString("Prop", Prop); writer.WriteBoolean("ThrowOnRead", ThrowOnRead); @@ -647,7 +647,7 @@ namespace Apache.Ignite.Core.Tests.Services } /** <inheritdoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { Prop = reader.ReadString("Prop"); ThrowOnRead = reader.ReadBoolean("ThrowOnRead"); @@ -703,7 +703,7 @@ namespace Apache.Ignite.Core.Tests.Services var prx = GetProxy(); var obj = new TestPortableClass { Prop = "PropValue" }; - var portObj = Portables.ToPortable<IPortableObject>(obj); + var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj); var result = prx.PortableArgMethod(1, portObj); @@ -731,7 +731,7 @@ namespace Apache.Ignite.Core.Tests.Services var prx = GetProxy(); var obj = new TestPortableClass { Prop = "PropValue" }; - var portObj = Portables.ToPortable<IPortableObject>(obj); + var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj); var result = prx.PortableArgAndResultMethod(1, portObj); http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs index b5ff9c2..f0740e0 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs @@ -168,15 +168,15 @@ namespace Apache.Ignite.Core.Tests.Services } /** <inheritDoc /> */ - public IServices WithKeepPortable() + public IServices WithKeepBinary() { - return new ServicesAsyncWrapper(_services.WithKeepPortable()); + return new ServicesAsyncWrapper(_services.WithKeepBinary()); } /** <inheritDoc /> */ - public IServices WithServerKeepPortable() + public IServices WithServerKeepBinary() { - return new ServicesAsyncWrapper(_services.WithServerKeepPortable()); + return new ServicesAsyncWrapper(_services.WithServerKeepBinary()); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs index 6b2a7ec..c4b5776 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs @@ -21,9 +21,9 @@ namespace Apache.Ignite.Core.Tests.Services using System.Collections.Generic; using System.Linq; using System.Threading; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Common; - using Apache.Ignite.Core.Portable; using Apache.Ignite.Core.Resource; using Apache.Ignite.Core.Services; using NUnit.Framework; @@ -178,7 +178,7 @@ namespace Apache.Ignite.Core.Tests.Services [Test] public void TestDeployKeyAffinitySingletonPortable() { - var services = Services.WithKeepPortable(); + var services = Services.WithKeepBinary(); var svc = new TestIgniteServicePortable(); @@ -366,18 +366,18 @@ namespace Apache.Ignite.Core.Tests.Services var svc = new TestIgniteServicePortable(); // Deploy to grid2 - Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithKeepPortable() + Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithKeepBinary() .DeployNodeSingleton(SvcName, svc); // Get proxy - var prx = Services.WithKeepPortable().GetServiceProxy<ITestIgniteService>(SvcName); + var prx = Services.WithKeepBinary().GetServiceProxy<ITestIgniteService>(SvcName); var obj = new PortableObject {Val = 11}; - var res = (IPortableObject) prx.Method(obj); + var res = (IBinaryObject) prx.Method(obj); Assert.AreEqual(11, res.Deserialize<PortableObject>().Val); - res = (IPortableObject) prx.Method(Grid1.GetPortables().ToPortable<IPortableObject>(obj)); + res = (IBinaryObject) prx.Method(Grid1.GetBinary().ToBinary<IBinaryObject>(obj)); Assert.AreEqual(11, res.Deserialize<PortableObject>().Val); } @@ -390,18 +390,18 @@ namespace Apache.Ignite.Core.Tests.Services var svc = new TestIgniteServicePortable(); // Deploy to grid2 - Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithServerKeepPortable() + Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithServerKeepBinary() .DeployNodeSingleton(SvcName, svc); // Get proxy - var prx = Services.WithServerKeepPortable().GetServiceProxy<ITestIgniteService>(SvcName); + var prx = Services.WithServerKeepBinary().GetServiceProxy<ITestIgniteService>(SvcName); var obj = new PortableObject { Val = 11 }; var res = (PortableObject) prx.Method(obj); Assert.AreEqual(11, res.Val); - res = (PortableObject)prx.Method(Grid1.GetPortables().ToPortable<IPortableObject>(obj)); + res = (PortableObject)prx.Method(Grid1.GetBinary().ToBinary<IBinaryObject>(obj)); Assert.AreEqual(11, res.Val); } @@ -414,18 +414,18 @@ namespace Apache.Ignite.Core.Tests.Services var svc = new TestIgniteServicePortable(); // Deploy to grid2 - Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithKeepPortable().WithServerKeepPortable() + Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithKeepBinary().WithServerKeepBinary() .DeployNodeSingleton(SvcName, svc); // Get proxy - var prx = Services.WithKeepPortable().WithServerKeepPortable().GetServiceProxy<ITestIgniteService>(SvcName); + var prx = Services.WithKeepBinary().WithServerKeepBinary().GetServiceProxy<ITestIgniteService>(SvcName); var obj = new PortableObject { Val = 11 }; - var res = (IPortableObject)prx.Method(obj); + var res = (IBinaryObject)prx.Method(obj); Assert.AreEqual(11, res.Deserialize<PortableObject>().Val); - res = (IPortableObject)prx.Method(Grid1.GetPortables().ToPortable<IPortableObject>(obj)); + res = (IBinaryObject)prx.Method(Grid1.GetBinary().ToBinary<IBinaryObject>(obj)); Assert.AreEqual(11, res.Deserialize<PortableObject>().Val); } @@ -566,13 +566,13 @@ namespace Apache.Ignite.Core.Tests.Services SpringConfigUrl = springConfigUrl, JvmClasspath = TestUtils.CreateTestClasspath(), JvmOptions = TestUtils.TestJavaOptions(), - PortableConfiguration = new PortableConfiguration + BinaryConfiguration = new BinaryConfiguration { - TypeConfigurations = new List<PortableTypeConfiguration> + TypeConfigurations = new List<BinaryTypeConfiguration> { - new PortableTypeConfiguration(typeof(TestIgniteServicePortable)), - new PortableTypeConfiguration(typeof(TestIgniteServicePortableErr)), - new PortableTypeConfiguration(typeof(PortableObject)) + new BinaryTypeConfiguration(typeof(TestIgniteServicePortable)), + new BinaryTypeConfiguration(typeof(TestIgniteServicePortableErr)), + new BinaryTypeConfiguration(typeof(PortableObject)) } } }; @@ -734,7 +734,7 @@ namespace Apache.Ignite.Core.Tests.Services if (context.AffinityKey != null && !(context.AffinityKey is int)) { - var portableObject = context.AffinityKey as IPortableObject; + var portableObject = context.AffinityKey as IBinaryObject; var key = portableObject != null ? portableObject.Deserialize<PortableObject>() @@ -753,16 +753,16 @@ namespace Apache.Ignite.Core.Tests.Services /// <summary> /// Test portable service. /// </summary> - private class TestIgniteServicePortable : TestIgniteServiceSerializable, IPortableMarshalAware + private class TestIgniteServicePortable : TestIgniteServiceSerializable, IBinarizable { /** <inheritdoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("TestProp", TestProperty); } /** <inheritdoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { TestProperty = reader.ReadInt("TestProp"); } @@ -771,13 +771,13 @@ namespace Apache.Ignite.Core.Tests.Services /// <summary> /// Test portable service with exceptions in marshalling. /// </summary> - private class TestIgniteServicePortableErr : TestIgniteServiceSerializable, IPortableMarshalAware + private class TestIgniteServicePortableErr : TestIgniteServiceSerializable, IBinarizable { /** */ public bool ThrowOnWrite { get; set; } /** <inheritdoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("TestProp", TestProperty); @@ -786,7 +786,7 @@ namespace Apache.Ignite.Core.Tests.Services } /** <inheritdoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { TestProperty = reader.ReadInt("TestProp"); http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs index a49ee1b..c75f003 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs @@ -21,7 +21,7 @@ namespace Apache.Ignite.Core.Tests using System.Collections.Generic; using System.Linq; using System.Reflection; - using Apache.Ignite.Core.Impl.Portable; + using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Tests.TestDll; using NUnit.Framework; http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj index d782aec..d7db33e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj @@ -235,49 +235,49 @@ <Compile Include="Impl\Messaging\MessageListenerHolder.cs" /> <Compile Include="Impl\Messaging\Messaging.cs" /> <Compile Include="Impl\NativeMethods.cs" /> - <Compile Include="Impl\Portable\DateTimeHolder.cs" /> - <Compile Include="Impl\Portable\IO\IPortableStream.cs" /> - <Compile Include="Impl\Portable\IO\PortableAbstractStream.cs" /> - <Compile Include="Impl\Portable\IO\PortableHeapStream.cs" /> - <Compile Include="Impl\Portable\IO\PortableStreamAdapter.cs" /> - <Compile Include="Impl\Portable\IPortableSystemTypeSerializer.cs" /> - <Compile Include="Impl\Portable\IPortableTypeDescriptor.cs" /> - <Compile Include="Impl\Portable\IPortableWriteAware.cs" /> - <Compile Include="Impl\Portable\Metadata\IPortableMetadataHandler.cs" /> - <Compile Include="Impl\Portable\Metadata\PortableHashsetMetadataHandler.cs" /> - <Compile Include="Impl\Portable\Metadata\PortableMetadataHolder.cs" /> - <Compile Include="Impl\Portable\Metadata\PortableMetadataImpl.cs" /> - <Compile Include="Impl\Portable\PortableBuilderField.cs" /> - <Compile Include="Impl\Portable\PortableBuilderImpl.cs" /> - <Compile Include="Impl\Portable\PortableFullTypeDescriptor.cs" /> - <Compile Include="Impl\Portable\PortableHandleDictionary.cs" /> - <Compile Include="Impl\Portable\PortableMarshalAwareSerializer.cs" /> - <Compile Include="Impl\Portable\PortableMarshaller.cs" /> - <Compile Include="Impl\Portable\PortableMode.cs" /> - <Compile Include="Impl\Portable\PortableObjectHandle.cs" /> - <Compile Include="Impl\Portable\PortableObjectHeader.cs" /> - <Compile Include="Impl\Portable\PortableObjectSchema.cs" /> - <Compile Include="Impl\Portable\PortableObjectSchemaField.cs" /> - <Compile Include="Impl\Portable\PortableObjectSchemaHolder.cs" /> - <Compile Include="Impl\Portable\PortableReaderExtensions.cs" /> - <Compile Include="Impl\Portable\PortableReaderHandleDictionary.cs" /> - <Compile Include="Impl\Portable\PortableReaderImpl.cs" /> - <Compile Include="Impl\Portable\PortableReflectiveRoutines.cs" /> - <Compile Include="Impl\Portable\PortableReflectiveSerializer.cs" /> - <Compile Include="Impl\Portable\PortablesImpl.cs" /> - <Compile Include="Impl\Portable\Structure\PortableStructureTracker.cs" /> - <Compile Include="Impl\Portable\PortableSurrogateTypeDescriptor.cs" /> - <Compile Include="Impl\Portable\PortableSystemHandlers.cs" /> - <Compile Include="Impl\Portable\PortableSystemTypeSerializer.cs" /> - <Compile Include="Impl\Portable\PortableUserObject.cs" /> - <Compile Include="Impl\Portable\PortableUtils.cs" /> - <Compile Include="Impl\Portable\PortableWriterImpl.cs" /> - <Compile Include="Impl\Portable\SerializableObjectHolder.cs" /> - <Compile Include="Impl\Portable\Structure\PortableStructure.cs" /> - <Compile Include="Impl\Portable\Structure\PortableStructureEntry.cs" /> - <Compile Include="Impl\Portable\Structure\PortableStructureJumpTable.cs" /> - <Compile Include="Impl\Portable\Structure\PortableStructureUpdate.cs" /> - <Compile Include="Impl\Portable\TypeResolver.cs" /> + <Compile Include="Impl\Binary\DateTimeHolder.cs" /> + <Compile Include="Impl\Binary\IO\IBinaryStream.cs" /> + <Compile Include="Impl\Binary\IO\BinaryStreamBase.cs" /> + <Compile Include="Impl\Binary\IO\BinaryHeapStream.cs" /> + <Compile Include="Impl\Binary\IO\BinaryStreamAdapter.cs" /> + <Compile Include="Impl\Binary\IBinarySystemTypeSerializer.cs" /> + <Compile Include="Impl\Binary\IBinaryTypeDescriptor.cs" /> + <Compile Include="Impl\Binary\IBinaryWriteAware.cs" /> + <Compile Include="Impl\Binary\Metadata\IBinaryTypeHandler.cs" /> + <Compile Include="Impl\Binary\Metadata\BinaryTypeHashsetHandler.cs" /> + <Compile Include="Impl\Binary\Metadata\BinaryTypeHolder.cs" /> + <Compile Include="Impl\Binary\Metadata\BinaryType.cs" /> + <Compile Include="Impl\Binary\BinaryBuilderField.cs" /> + <Compile Include="Impl\Binary\BinaryObjectBuilder.cs" /> + <Compile Include="Impl\Binary\BinaryFullTypeDescriptor.cs" /> + <Compile Include="Impl\Binary\BinaryHandleDictionary.cs" /> + <Compile Include="Impl\Binary\BinarizableSerializer.cs" /> + <Compile Include="Impl\Binary\Marshaller.cs" /> + <Compile Include="Impl\Binary\BinaryMode.cs" /> + <Compile Include="Impl\Binary\BinaryObjectHandle.cs" /> + <Compile Include="Impl\Binary\BinaryObjectHeader.cs" /> + <Compile Include="Impl\Binary\BinaryObjectSchema.cs" /> + <Compile Include="Impl\Binary\BinaryObjectSchemaField.cs" /> + <Compile Include="Impl\Binary\BinaryObjectSchemaHolder.cs" /> + <Compile Include="Impl\Binary\BinaryReaderExtensions.cs" /> + <Compile Include="Impl\Binary\BinaryReaderHandleDictionary.cs" /> + <Compile Include="Impl\Binary\BinaryReader.cs" /> + <Compile Include="Impl\Binary\BinaryReflectiveActions.cs" /> + <Compile Include="Impl\Binary\BinaryReflectiveSerializer.cs" /> + <Compile Include="Impl\Binary\IgniteBinary.cs" /> + <Compile Include="Impl\Binary\Structure\BinaryStructureTracker.cs" /> + <Compile Include="Impl\Binary\BinarySurrogateTypeDescriptor.cs" /> + <Compile Include="Impl\Binary\BinarySystemHandlers.cs" /> + <Compile Include="Impl\Binary\BinarySystemTypeSerializer.cs" /> + <Compile Include="Impl\Binary\BinaryObject.cs" /> + <Compile Include="Impl\Binary\BinaryUtils.cs" /> + <Compile Include="Impl\Binary\BinaryWriter.cs" /> + <Compile Include="Impl\Binary\SerializableObjectHolder.cs" /> + <Compile Include="Impl\Binary\Structure\BinaryStructure.cs" /> + <Compile Include="Impl\Binary\Structure\BinaryStructureEntry.cs" /> + <Compile Include="Impl\Binary\Structure\BinaryStructureJumpTable.cs" /> + <Compile Include="Impl\Binary\Structure\BinaryStructureUpdate.cs" /> + <Compile Include="Impl\Binary\TypeResolver.cs" /> <Compile Include="Impl\Resource\IResourceInjector.cs" /> <Compile Include="Impl\Resource\ResourceFieldInjector.cs" /> <Compile Include="Impl\Resource\ResourceMethodInjector.cs" /> @@ -305,22 +305,22 @@ <Compile Include="Lifecycle\LifecycleEventType.cs" /> <Compile Include="Messaging\IMessageListener.cs" /> <Compile Include="Messaging\IMessaging.cs" /> - <Compile Include="Portable\IPortableBuilder.cs" /> - <Compile Include="Portable\IPortableIdMapper.cs" /> - <Compile Include="Portable\IPortableMarshalAware.cs" /> - <Compile Include="Portable\IPortableMetadata.cs" /> - <Compile Include="Portable\IPortableNameMapper.cs" /> - <Compile Include="Portable\IPortableObject.cs" /> - <Compile Include="Portable\IPortableRawReader.cs" /> - <Compile Include="Portable\IPortableRawWriter.cs" /> - <Compile Include="Portable\IPortableReader.cs" /> - <Compile Include="Portable\IPortables.cs" /> - <Compile Include="Portable\IPortableSerializer.cs" /> - <Compile Include="Portable\IPortableWriter.cs" /> - <Compile Include="Portable\PortableConfiguration.cs" /> - <Compile Include="Portable\PortableException.cs" /> - <Compile Include="Portable\PortableTypeConfiguration.cs" /> - <Compile Include="Portable\PortableTypeNames.cs" /> + <Compile Include="Binary\IBinaryObjectBuilder.cs" /> + <Compile Include="Binary\IBinaryIdMapper.cs" /> + <Compile Include="Binary\IBinarizable.cs" /> + <Compile Include="Binary\IBinaryType.cs" /> + <Compile Include="Binary\IBinaryNameMapper.cs" /> + <Compile Include="Binary\IBinaryObject.cs" /> + <Compile Include="Binary\IBinaryRawReader.cs" /> + <Compile Include="Binary\IBinaryRawWriter.cs" /> + <Compile Include="Binary\IBinaryReader.cs" /> + <Compile Include="Binary\IIgniteBinary.cs" /> + <Compile Include="Binary\IBinarySerializer.cs" /> + <Compile Include="Binary\IBinaryWriter.cs" /> + <Compile Include="Binary\BinaryConfiguration.cs" /> + <Compile Include="Binary\BinaryObjectException.cs" /> + <Compile Include="Binary\BinaryTypeConfiguration.cs" /> + <Compile Include="Binary\BinaryTypeNames.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Resource\InstanceResourceAttribute.cs" /> <Compile Include="Resource\StoreSessionResourceAttribute.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs new file mode 100644 index 0000000..5041a84 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs @@ -0,0 +1,90 @@ +/* + * 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. + */ + +namespace Apache.Ignite.Core.Binary +{ + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + + /// <summary> + /// Binary type configuration. + /// </summary> + public class BinaryConfiguration + { + /// <summary> + /// Constructor. + /// </summary> + public BinaryConfiguration() + { + DefaultKeepDeserialized = true; + } + + /// <summary> + /// Copying constructor. + /// </summary> + /// <param name="cfg">Configuration to copy.</param> + public BinaryConfiguration(BinaryConfiguration cfg) + { + DefaultIdMapper = cfg.DefaultIdMapper; + DefaultNameMapper = cfg.DefaultNameMapper; + DefaultKeepDeserialized = cfg.DefaultKeepDeserialized; + DefaultSerializer = cfg.DefaultSerializer; + + Types = cfg.Types != null ? new List<string>(cfg.Types) : null; + + if (cfg.TypeConfigurations != null) + { + TypeConfigurations = new List<BinaryTypeConfiguration>(cfg.TypeConfigurations.Count); + + foreach (BinaryTypeConfiguration typeCfg in cfg.TypeConfigurations) + TypeConfigurations.Add(new BinaryTypeConfiguration(typeCfg)); + } + } + + /// <summary> + /// Type configurations. + /// </summary> + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public ICollection<BinaryTypeConfiguration> TypeConfigurations { get; set; } + + /// <summary> + /// Binarizable types. Shorthand for creating <see cref="BinaryTypeConfiguration"/>. + /// </summary> + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public ICollection<string> Types { get; set; } + + /// <summary> + /// Default name mapper. + /// </summary> + public IBinaryNameMapper DefaultNameMapper { get; set; } + + /// <summary> + /// Default ID mapper. + /// </summary> + public IBinaryIdMapper DefaultIdMapper { get; set; } + + /// <summary> + /// Default serializer. + /// </summary> + public IBinarySerializer DefaultSerializer { get; set; } + + /// <summary> + /// Default keep deserialized flag. + /// </summary> + public bool DefaultKeepDeserialized { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryObjectException.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryObjectException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryObjectException.cs new file mode 100644 index 0000000..12695b0 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryObjectException.cs @@ -0,0 +1,64 @@ +/* + * 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. + */ + +namespace Apache.Ignite.Core.Binary +{ + using System; + using System.Runtime.Serialization; + using Apache.Ignite.Core.Common; + + /// <summary> + /// Indicates an error during binarization. + /// </summary> + [Serializable] + public class BinaryObjectException : IgniteException + { + /// <summary> + /// Constructs an exception. + /// </summary> + public BinaryObjectException() + { + // No-op. + } + + /// <summary> + /// Initializes a new instance of the <see cref="BinaryObjectException"/> class. + /// </summary> + /// <param name="message">The message that describes the error.</param> + public BinaryObjectException(string message) + : base(message) { + } + + /// <summary> + /// Initializes a new instance of the <see cref="BinaryObjectException"/> class. + /// </summary> + /// <param name="message">The message.</param> + /// <param name="cause">The cause.</param> + public BinaryObjectException(string message, Exception cause) + : base(message, cause) { + } + + /// <summary> + /// Constructs an exception. + /// </summary> + /// <param name="info">Serialization info.</param> + /// <param name="ctx">Streaming context.</param> + protected BinaryObjectException(SerializationInfo info, StreamingContext ctx) + : base(info, ctx) { + } + } +}
