You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2017/04/13 12:41:29 UTC

ignite git commit: IGNITE-3503 .NET: Remove "Default" prefix from BinaryConfiguration properties

Repository: ignite
Updated Branches:
  refs/heads/master 027b2c27c -> dd4a5c423


IGNITE-3503 .NET: Remove "Default" prefix from BinaryConfiguration properties


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dd4a5c42
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dd4a5c42
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dd4a5c42

Branch: refs/heads/master
Commit: dd4a5c423ca8313206db79d241960ca96228b746
Parents: 027b2c2
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Apr 13 15:41:23 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Apr 13 15:41:23 2017 +0300

----------------------------------------------------------------------
 .../Binary/BinaryBuilderSelfTest.cs             |  4 ++--
 .../Binary/BinaryDynamicRegistrationTest.cs     | 11 +++++----
 .../Binary/BinarySelfTest.cs                    |  4 ++--
 .../IgniteConfigurationSerializerTest.cs        | 15 ++++++------
 .../Binary/BinaryConfiguration.cs               | 24 ++++++++++----------
 .../IgniteConfigurationSection.xsd              |  8 +++----
 .../Binary/BinarySurrogateTypeDescriptor.cs     | 10 ++++----
 .../Impl/Binary/BinaryUtils.cs                  |  8 +++----
 .../Impl/Binary/Marshaller.cs                   | 14 ++++++------
 9 files changed, 51 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
index 35c7e47..63faaec 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
@@ -57,8 +57,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                 BinaryConfiguration = new BinaryConfiguration
                 {
                     TypeConfigurations = GetTypeConfigurations(),
-                    DefaultIdMapper = new IdMapper(),
-                    DefaultNameMapper = new NameMapper(),
+                    IdMapper = new IdMapper(),
+                    NameMapper = new NameMapper(),
                     CompactFooter = GetCompactFooter()
                 }
             };

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
index dc5e7df..24f5e7c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
@@ -265,7 +265,10 @@ namespace Apache.Ignite.Core.Tests.Binary
 
                 using (var ignite2 = Ignition.Start(cfg))
                 {
-                    var cache = ignite2.CreateCache<int, Foo>("foos");
+                    var cache = ignite2.CreateCache<int, Foo>(new CacheConfiguration("foos")
+                    {
+                        CacheMode = CacheMode.Replicated
+                    });
 
                     cache[1] = new Foo();
                 }
@@ -322,15 +325,15 @@ namespace Apache.Ignite.Core.Tests.Binary
         /// </summary>
         private static void Test(IIgnite ignite1, IIgnite ignite2)
         {
-            const string cacheName = "cache";
+            var cfg = new CacheConfiguration("cache") {CacheMode = CacheMode.Partitioned};
 
             // Put on one grid.
-            var cache1 = ignite1.GetOrCreateCache<int, object>(cacheName);
+            var cache1 = ignite1.GetOrCreateCache<int, object>(cfg);
             cache1[1] = new Foo {Int = 1, Str = "1"};
             cache1[2] = ignite1.GetBinary().GetBuilder(typeof (Bar)).SetField("Int", 5).SetField("Str", "s").Build();
 
             // Get on another grid.
-            var cache2 = ignite2.GetOrCreateCache<int, Foo>(cacheName);
+            var cache2 = ignite2.GetOrCreateCache<int, Foo>(cfg);
             var foo = cache2[1];
 
             Assert.AreEqual(1, foo.Int);

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index eb2751e..06fbe48 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -1398,7 +1398,7 @@ namespace Apache.Ignite.Core.Tests.Binary
         {
             BinaryConfiguration cfg = new BinaryConfiguration();
 
-            cfg.DefaultKeepDeserialized = false;
+            cfg.KeepDeserialized = false;
 
             CheckKeepSerialized(cfg, false);
         }
@@ -1430,7 +1430,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             typeCfg.KeepDeserialized = true;
 
             BinaryConfiguration cfg = new BinaryConfiguration();
-            cfg.DefaultKeepDeserialized = false;
+            cfg.KeepDeserialized = false;
 
             cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 1d39e69..8549c84 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -70,8 +70,9 @@ namespace Apache.Ignite.Core.Tests
         {
             var xml = @"<igniteConfig workDirectory='c:' JvmMaxMemoryMb='1024' MetricsLogFrequency='0:0:10' isDaemon='true' isLateAffinityAssignment='false' springConfigUrl='c:\myconfig.xml'>
                             <localhost>127.1.1.1</localhost>
-                            <binaryConfiguration compactFooter='false'>
-                                <defaultNameMapper type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+NameMapper' bar='testBar' />
+                            <binaryConfiguration compactFooter='false' keepDeserialized='true'>
+                                <nameMapper type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+NameMapper' bar='testBar' />
+                                <idMapper type='Apache.Ignite.Core.Tests.Binary.IdMapper' />
                                 <types>
                                     <string>Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+FooClass, Apache.Ignite.Core.Tests</string>
                                 </types>
@@ -155,7 +156,7 @@ namespace Apache.Ignite.Core.Tests
                 ((TcpDiscoveryMulticastIpFinder) ((TcpDiscoverySpi) cfg.DiscoverySpi).IpFinder).AddressRequestAttempts);
             Assert.AreEqual(new[] { "-Xms1g", "-Xmx4g" }, cfg.JvmOptions);
             Assert.AreEqual(15, ((LifecycleBean) cfg.LifecycleBeans.Single()).Foo);
-            Assert.AreEqual("testBar", ((NameMapper) cfg.BinaryConfiguration.DefaultNameMapper).Bar);
+            Assert.AreEqual("testBar", ((NameMapper) cfg.BinaryConfiguration.NameMapper).Bar);
             Assert.AreEqual(
                 "Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+FooClass, Apache.Ignite.Core.Tests",
                 cfg.BinaryConfiguration.Types.Single());
@@ -615,10 +616,10 @@ namespace Apache.Ignite.Core.Tests
                         }
                     },
                     Types = new[] {typeof (string).FullName},
-                    DefaultIdMapper = new IdMapper(),
-                    DefaultKeepDeserialized = true,
-                    DefaultNameMapper = new NameMapper(),
-                    DefaultSerializer = new TestSerializer()
+                    IdMapper = new IdMapper(),
+                    KeepDeserialized = true,
+                    NameMapper = new NameMapper(),
+                    Serializer = new TestSerializer()
                 },
                 CacheConfiguration = new[]
                 {

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/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
index c738f28..a67244b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
@@ -35,9 +35,9 @@ namespace Apache.Ignite.Core.Binary
         public const bool DefaultCompactFooter = true;
 
         /// <summary>
-        /// Default <see cref="DefaultKeepDeserialized"/> setting.
+        /// Default <see cref="KeepDeserialized"/> setting.
         /// </summary>
-        public const bool DefaultDefaultKeepDeserialized = true;
+        public const bool DefaultKeepDeserialized = true;
 
         /** Footer setting. */
         private bool? _compactFooter;
@@ -47,7 +47,7 @@ namespace Apache.Ignite.Core.Binary
         /// </summary>
         public BinaryConfiguration()
         {
-            DefaultKeepDeserialized = DefaultDefaultKeepDeserialized;
+            KeepDeserialized = DefaultKeepDeserialized;
         }
 
         /// <summary>
@@ -58,10 +58,10 @@ namespace Apache.Ignite.Core.Binary
         {
             IgniteArgumentCheck.NotNull(cfg, "cfg");
 
-            DefaultIdMapper = cfg.DefaultIdMapper;
-            DefaultNameMapper = cfg.DefaultNameMapper;
-            DefaultKeepDeserialized = cfg.DefaultKeepDeserialized;
-            DefaultSerializer = cfg.DefaultSerializer;
+            IdMapper = cfg.IdMapper;
+            NameMapper = cfg.NameMapper;
+            KeepDeserialized = cfg.KeepDeserialized;
+            Serializer = cfg.Serializer;
 
             TypeConfigurations = cfg.TypeConfigurations == null
                 ? null
@@ -99,23 +99,23 @@ namespace Apache.Ignite.Core.Binary
         /// <summary>
         /// Default name mapper.
         /// </summary>
-        public IBinaryNameMapper DefaultNameMapper { get; set; }
+        public IBinaryNameMapper NameMapper { get; set; }
 
         /// <summary>
         /// Default ID mapper.
         /// </summary>
-        public IBinaryIdMapper DefaultIdMapper { get; set; }
+        public IBinaryIdMapper IdMapper { get; set; }
 
         /// <summary>
         /// Default serializer.
         /// </summary>
-        public IBinarySerializer DefaultSerializer { get; set; }
+        public IBinarySerializer Serializer { get; set; }
 
         /// <summary>
         /// Default keep deserialized flag.
         /// </summary>
-        [DefaultValue(DefaultDefaultKeepDeserialized)]
-        public bool DefaultKeepDeserialized { get; set; }
+        [DefaultValue(DefaultKeepDeserialized)]
+        public bool KeepDeserialized { get; set; }
 
         /// <summary>
         /// Gets or sets a value indicating whether to write footers in compact form.

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 3691aa0..887e068 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -206,7 +206,7 @@
                                     </xs:sequence>
                                 </xs:complexType>
                             </xs:element>
-                            <xs:element name="defaultNameMapper" minOccurs="0">
+                            <xs:element name="nameMapper" minOccurs="0">
                                 <xs:annotation>
                                     <xs:documentation>Default name mapper.</xs:documentation>
                                 </xs:annotation>
@@ -218,7 +218,7 @@
                                     </xs:attribute>
                                 </xs:complexType>
                             </xs:element>
-                            <xs:element name="defaultIdMapper" minOccurs="0">
+                            <xs:element name="idMapper" minOccurs="0">
                                 <xs:annotation>
                                     <xs:documentation>Default ID mapper.</xs:documentation>
                                 </xs:annotation>
@@ -230,7 +230,7 @@
                                     </xs:attribute>
                                 </xs:complexType>
                             </xs:element>
-                            <xs:element name="defaultSerializer" minOccurs="0">
+                            <xs:element name="serializer" minOccurs="0">
                                 <xs:annotation>
                                     <xs:documentation>Default serializer.</xs:documentation>
                                 </xs:annotation>
@@ -243,7 +243,7 @@
                                 </xs:complexType>
                             </xs:element>
                         </xs:all>
-                        <xs:attribute name="defaultKeepDeserialized" type="xs:boolean">
+                        <xs:attribute name="keepDeserialized" type="xs:boolean">
                             <xs:annotation>
                                 <xs:documentation>Default keep deserialized flag.</xs:documentation>
                             </xs:annotation>

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
index 8c7e5e9..0af4910 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
@@ -72,7 +72,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             _cfg = cfg;
             _name = name;
 
-            _id = BinaryUtils.TypeId(name, cfg.DefaultNameMapper, cfg.DefaultIdMapper);
+            _id = BinaryUtils.TypeId(name, cfg.NameMapper, cfg.IdMapper);
         }
 
         /** <inheritDoc /> */
@@ -102,25 +102,25 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritDoc /> */
         public bool KeepDeserialized
         {
-            get { return _cfg.DefaultKeepDeserialized; }
+            get { return _cfg.KeepDeserialized; }
         }
 
         /** <inheritDoc /> */
         public IBinaryNameMapper NameMapper
         {
-            get { return _cfg.DefaultNameMapper; }
+            get { return _cfg.NameMapper; }
         }
 
         /** <inheritDoc /> */
         public IBinaryIdMapper IdMapper
         {
-            get { return _cfg.DefaultIdMapper; }
+            get { return _cfg.IdMapper; }
         }
 
         /** <inheritDoc /> */
         public IBinarySerializerInternal Serializer
         {
-            get { return new UserSerializerProxy(_cfg.DefaultSerializer); }
+            get { return new UserSerializerProxy(_cfg.Serializer); }
         }
 
         /** <inheritDoc /> */

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index bb58ea5..ae11d06 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -1972,10 +1972,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                 }
 
                 // Read the rest.
-                cfg.DefaultNameMapper = CreateInstance<IBinaryNameMapper>(reader);
-                cfg.DefaultIdMapper = CreateInstance<IBinaryIdMapper>(reader);
-                cfg.DefaultSerializer = CreateInstance<IBinarySerializer>(reader);
-                cfg.DefaultKeepDeserialized = reader.ReadBoolean();
+                cfg.NameMapper = CreateInstance<IBinaryNameMapper>(reader);
+                cfg.IdMapper = CreateInstance<IBinaryIdMapper>(reader);
+                cfg.Serializer = CreateInstance<IBinarySerializer>(reader);
+                cfg.KeepDeserialized = reader.ReadBoolean();
             }
             else
                 cfg = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4a5c42/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 5a4460a..1dae576 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -472,7 +472,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             Debug.Assert(type != null);
 
             var typeName = BinaryUtils.GetTypeName(type);
-            var typeId = BinaryUtils.TypeId(typeName, _cfg.DefaultNameMapper, _cfg.DefaultIdMapper);
+            var typeId = BinaryUtils.TypeId(typeName, _cfg.NameMapper, _cfg.IdMapper);
 
             var registered = _ignite != null && _ignite.BinaryProcessor.RegisterType(typeId, type);
 
@@ -505,8 +505,8 @@ namespace Apache.Ignite.Core.Impl.Binary
             var ser = GetSerializer(_cfg, null, type, typeId, null, null, _log);
 
             desc = desc == null
-                ? new BinaryFullTypeDescriptor(type, typeId, typeName, true, _cfg.DefaultNameMapper,
-                    _cfg.DefaultIdMapper, ser, false, null, type.IsEnum, null, registered)
+                ? new BinaryFullTypeDescriptor(type, typeId, typeName, true, _cfg.NameMapper,
+                    _cfg.IdMapper, ser, false, null, type.IsEnum, null, registered)
                 : new BinaryFullTypeDescriptor(desc, type, ser, registered);
 
             if (RegistrationDisabled)
@@ -546,11 +546,11 @@ namespace Apache.Ignite.Core.Impl.Binary
         private void AddUserType(BinaryConfiguration cfg, BinaryTypeConfiguration typeCfg, TypeResolver typeResolver)
         {
             // Get converter/mapper/serializer.
-            IBinaryNameMapper nameMapper = typeCfg.NameMapper ?? _cfg.DefaultNameMapper;
+            IBinaryNameMapper nameMapper = typeCfg.NameMapper ?? _cfg.NameMapper;
 
-            IBinaryIdMapper idMapper = typeCfg.IdMapper ?? _cfg.DefaultIdMapper;
+            IBinaryIdMapper idMapper = typeCfg.IdMapper ?? _cfg.IdMapper;
 
-            bool keepDeserialized = typeCfg.KeepDeserialized ?? _cfg.DefaultKeepDeserialized;
+            bool keepDeserialized = typeCfg.KeepDeserialized ?? _cfg.KeepDeserialized;
 
             // Try resolving type.
             Type type = typeResolver.ResolveType(typeCfg.TypeName);
@@ -597,7 +597,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             IBinaryIdMapper idMapper, ILogger log)
         {
             var serializer = (typeCfg != null ? typeCfg.Serializer : null) ??
-                             (cfg != null ? cfg.DefaultSerializer : null);
+                             (cfg != null ? cfg.Serializer : null);
 
             if (serializer == null)
             {