You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/11/09 08:38:22 UTC

[08/50] [abbrv] ignite git commit: IGNITE-3497 .NET: Improve IgniteConfigurationSection.xsd: add missing properties, enums, docs.

IGNITE-3497 .NET: Improve IgniteConfigurationSection.xsd: add missing properties, enums, docs.

# Conflicts:
#	modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs


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

Branch: refs/heads/master
Commit: 9fc3b5095b825b9ca00b45c18f8072f998dd2adf
Parents: 2eee94c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Aug 2 18:37:52 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Oct 24 14:40:49 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.csproj             |    1 +
 .../IgniteConfigurationSerializerTest.cs        |   70 +-
 .../IgniteConfigurationSection.xsd              | 1141 +++++++++++++++---
 3 files changed, 1054 insertions(+), 158 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9fc3b509/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 008229a..11a8a15 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -59,6 +59,7 @@
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.ServiceProcess" />
     <Reference Include="System.XML" />
+    <Reference Include="System.Xml.Linq" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Log\DefaultLoggerTest.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/9fc3b509/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 bb703f5..2486351 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -28,6 +28,7 @@ namespace Apache.Ignite.Core.Tests
     using System.Text;
     using System.Threading;
     using System.Xml;
+    using System.Xml.Linq;
     using System.Xml.Schema;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache.Affinity.Fair;
@@ -217,6 +218,53 @@ namespace Apache.Ignite.Core.Tests
         }
 
         /// <summary>
+        /// Tests that all properties are present in the schema.
+        /// </summary>
+        [Test]
+        public void TestAllPropertiesArePresentInSchema()
+        {
+            // ReSharper disable once PossibleNullReferenceException
+            var schema = XDocument.Load("IgniteConfigurationSection.xsd")
+                    .Root.Elements()
+                    .Single(x => x.Attribute("name").Value == "igniteConfiguration");
+
+            var type = typeof(IgniteConfiguration);
+
+            CheckPropertyIsPresentInSchema(type, schema);
+        }
+
+        /// <summary>
+        /// Checks the property is present in schema.
+        /// </summary>
+        // ReSharper disable once UnusedParameter.Local
+        private static void CheckPropertyIsPresentInSchema(Type type, XElement schema)
+        {
+            Func<string, string> toLowerCamel = x => char.ToLowerInvariant(x[0]) + x.Substring(1);
+
+            foreach (var prop in type.GetProperties())
+            {
+                var propType = prop.PropertyType;
+
+                var isCollection = propType.IsGenericType &&
+                                   propType.GetGenericTypeDefinition() == typeof(ICollection<>);
+
+                if (isCollection)
+                    propType = propType.GetGenericArguments().First();
+
+                var propName = toLowerCamel(prop.Name);
+
+                Assert.IsTrue(schema.Descendants().Select(x => x.Attribute("name"))
+                    .Any(x => x != null && x.Value == propName),
+                    "Property is missing in XML schema: " + propName);
+
+                var isComplexProp = propType.Namespace != null && propType.Namespace.StartsWith("Apache.Ignite.Core");
+
+                if (isComplexProp)
+                    CheckPropertyIsPresentInSchema(propType, schema);
+            }
+        }
+
+        /// <summary>
         /// Tests the schema validation.
         /// </summary>
         [Test]
@@ -395,8 +443,8 @@ namespace Apache.Ignite.Core.Tests
                         Backups = 15,
                         CacheMode = CacheMode.Replicated,
                         CacheStoreFactory = new TestCacheStoreFactory(),
-                        CopyOnRead = true,
-                        EagerTtl = true,
+                        CopyOnRead = false,
+                        EagerTtl = false,
                         EnableSwap = true,
                         EvictSynchronized = true,
                         EvictSynchronizedConcurrencyLevel = 13,
@@ -431,7 +479,7 @@ namespace Apache.Ignite.Core.Tests
                                 ValueType = typeof (long)
                             },
                         },
-                        ReadFromBackup = true,
+                        ReadFromBackup = false,
                         RebalanceBatchSize = 33,
                         RebalanceDelay = TimeSpan.MaxValue,
                         RebalanceMode = CacheRebalanceMode.Sync,
@@ -442,7 +490,7 @@ namespace Apache.Ignite.Core.Tests
                         StartSize = 1023,
                         WriteBehindBatchSize = 45,
                         WriteBehindEnabled = true,
-                        WriteBehindFlushFrequency = TimeSpan.FromSeconds(5),
+                        WriteBehindFlushFrequency = TimeSpan.FromSeconds(55),
                         WriteBehindFlushSize = 66,
                         WriteBehindFlushThreadCount = 2,
                         WriteSynchronizationMode = CacheWriteSynchronizationMode.FullAsync,
@@ -462,7 +510,7 @@ namespace Apache.Ignite.Core.Tests
                         {
                             ExcludeNeighbors = true,
                             Partitions = 48
-                        }
+                        },
                     }
                 },
                 ClientMode = true,
@@ -651,21 +699,13 @@ namespace Apache.Ignite.Core.Tests
         /// </summary>
         public class TestSerializer : IBinarySerializer
         {
-            /// <summary>
-            /// Write portalbe object.
-            /// </summary>
-            /// <param name="obj">Object.</param>
-            /// <param name="writer">Poratble writer.</param>
+            /** <inheritdoc /> */
             public void WriteBinary(object obj, IBinaryWriter writer)
             {
                 // No-op.
             }
 
-            /// <summary>
-            /// Read binary object.
-            /// </summary>
-            /// <param name="obj">Instantiated empty object.</param>
-            /// <param name="reader">Poratble reader.</param>
+            /** <inheritdoc /> */
             public void ReadBinary(object obj, IBinaryReader reader)
             {
                 // No-op.