IGNITE-6264 .NET: Verify Java API parity with a test
authorPavel Tupitsyn <ptupitsyn@apache.org>
Mon, 4 Dec 2017 16:39:30 +0000 (19:39 +0300)
committerPavel Tupitsyn <ptupitsyn@apache.org>
Mon, 4 Dec 2017 16:39:30 +0000 (19:39 +0300)
13 files changed:
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/BinaryParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheAffinityParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClusterParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ComputeParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/EventsParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/IgniteParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/MessagingParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ServicesParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/StreamerParityTest.cs [new file with mode: 0644]
modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/TransactionsParityTest.cs [new file with mode: 0644]

index 77b2e6e..648df7e 100644 (file)
     <Reference Include="System.Xml.Linq" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ApiParity\BinaryParityTest.cs" />
+    <Compile Include="ApiParity\CacheAffinityParityTest.cs" />
+    <Compile Include="ApiParity\CacheParityTest.cs" />
     <Compile Include="ApiParity\ClientConnectorConfigurationParityTest.cs" />
+    <Compile Include="ApiParity\ClusterParityTest.cs" />
+    <Compile Include="ApiParity\ComputeParityTest.cs" />
     <Compile Include="ApiParity\DataRegionConfigurationParityTest.cs" />
     <Compile Include="ApiParity\DataStorageConfigurationParityTest.cs" />
+    <Compile Include="ApiParity\EventsParityTest.cs" />
     <Compile Include="ApiParity\IgniteConfigurationParityTest.cs" />
+    <Compile Include="ApiParity\IgniteParityTest.cs" />
+    <Compile Include="ApiParity\MessagingParityTest.cs" />
     <Compile Include="ApiParity\ParityTest.cs" />
     <Compile Include="ApiParity\CacheConfigurationParityTest.cs" />
     <Compile Include="ApiParity\QueryEntityConfigurationParityTest.cs" />
+    <Compile Include="ApiParity\ServicesParityTest.cs" />
+    <Compile Include="ApiParity\StreamerParityTest.cs" />
+    <Compile Include="ApiParity\TransactionsParityTest.cs" />
     <Compile Include="AssertExtensions.cs" />
     <Compile Include="Binary\BinaryBuilderSelfTestSimpleName.cs" />
     <Compile Include="Binary\BinaryDateTimeTest.cs" />
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/BinaryParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/BinaryParityTest.cs
new file mode 100644 (file)
index 0000000..87d1f91
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using System.Collections.Generic;
+    using Apache.Ignite.Core.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="IBinary"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class BinaryParityTest
+    {
+        /** Known name mappings. */
+        private static readonly Dictionary<string, string> KnownMappings = new Dictionary<string, string>
+        {
+            {"type", "GetBinaryType"},
+            {"types", "GetBinaryTypes"}
+        };
+
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestBinary()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteBinary.java",
+                typeof(IBinary),
+                knownMappings: KnownMappings);
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheAffinityParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheAffinityParityTest.cs
new file mode 100644 (file)
index 0000000..f0ae286
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Cache;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="ICacheAffinity"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class CacheAffinityParityTest
+    {
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestCacheAffinity()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\cache\affinity\Affinity.java",
+                typeof(ICacheAffinity));
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs
new file mode 100644 (file)
index 0000000..7b568bd
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Cache;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="ICache{TK,TV}"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class CacheParityTest
+    {
+        /** Members that are not needed on .NET side. */
+        private static readonly string[] UnneededMembers =
+        {
+            // Java-specific.
+            "close",
+            "mxBean",
+            "localMxBean",
+            "indexReadyFuture",
+
+            // No needed, see IIgnite.DestroyCache
+            "destroy",
+
+            // The following look pointless, same as get, getAll, etc:
+            "Entry",
+            "EntryAsync",
+            "Entries",
+            "EntriesAsync",
+
+            // Questionable methods:
+            "AllOutTx",
+            "AllOutTxAsync"
+        };
+
+        /** Members that are missing on .NET side and should be added in future. */
+        private static readonly string[] MissingMembers =
+        {
+            "queryMetrics",  // IGNITE-6681
+            "resetQueryMetrics",  // IGNITE-6681
+            "queryDetailMetrics",  // IGNITE-6680
+            "resetQueryDetailMetrics",  // IGNITE-6680
+            "sizeLong",  //    IGNITE-6563
+            "sizeLongAsync",  // IGNITE-6563
+            "localSizeLong",  // IGNITE-6563
+        };
+
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestCache()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteCache.java",
+                typeof(ICache<,>),
+                UnneededMembers,
+                MissingMembers);
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClusterParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClusterParityTest.cs
new file mode 100644 (file)
index 0000000..59a80c3
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Cluster;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="ICluster"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class ClusterParityTest
+    {
+        /** Members that are not needed on .NET side. */
+        private static readonly string[] UnneededMembers =
+        {
+            "nodeLocalMap",
+            "startNodes",
+            "startNodesAsync",
+            "stopNodes",
+            "restartNodes"
+        };
+        
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestCluster()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteCluster.java",
+                typeof(ICluster),
+                UnneededMembers);
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ComputeParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ComputeParityTest.cs
new file mode 100644 (file)
index 0000000..e3f47ae
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Compute;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="ICompute"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class ComputeParityTest
+    {
+        /** Methods that are not needed on .NET side. */
+        private static readonly string[] UnneededMethods =
+        {
+            "withExecutor",  // Java-specific.
+            "localDeployTask",  // Java-specific (classloaders)
+            "localTasks",  // Java-specific (classloaders)
+            "undeployTask",  // Java-specific (classloaders)
+            "withName",  // Java-specific (classloaders)
+            "activeTaskFutures"
+        };
+
+        /// <summary>
+        /// Tests API parity.
+        /// </summary>
+        [Test]
+        public void TestCompute()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteCompute.java",
+                typeof(ICompute),
+                UnneededMethods);
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/EventsParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/EventsParityTest.cs
new file mode 100644 (file)
index 0000000..98e9e25
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Events;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="IEvents"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class EventsParityTest
+    {
+        /** Members that are missing on .NET side and should be added in future. */
+        private static readonly string[] MissingMembers =
+        {
+            // IGNITE-1683
+            "remoteListen",
+            "remoteListenAsync",
+            "stopRemoteListen",
+            "stopRemoteListenAsync",
+        };
+
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestEvents()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteEvents.java",
+                typeof(IEvents),
+                knownMissingMembers: MissingMembers);
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/IgniteParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/IgniteParityTest.cs
new file mode 100644 (file)
index 0000000..29cfda3
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using System.Collections.Generic;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="IIgnite"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class IgniteParityTest
+    {
+        /** Methods that are not needed on .NET side. */
+        private static readonly string[] UnneededMembers =
+        {
+            "scheduler",
+            "close",
+            "executorService",
+            "fileSystem",
+            "fileSystems"
+        };
+
+        /** Members that are missing on .NET side and should be added in future. */
+        private static readonly string[] MissingMembers =
+        {
+            "version", // IGNITE-7101
+            
+            "createCaches",   // IGNITE-7100
+            "orCreateCaches", // IGNITE-7100
+            "destroyCaches",  // IGNITE-7100
+
+            "addCacheConfiguration", // IGNITE-7102
+
+            // Data structures.
+            "atomicStamped", // IGNITE-7104
+            "countDownLatch", // IGNITE-1418
+            "semaphore", // IGNITE-7103
+            "reentrantLock", // IGNITE-7105
+            "queue", // IGNITE-1417
+            "set" // IGNITE-6834
+        };
+
+        /** Known name mappings. */
+        private static readonly Dictionary<string, string> KnownMappings = new Dictionary<string, string>
+        {
+            {"message", "GetMessaging"},
+            {"log", "Logger"}
+        };
+
+        /// <summary>
+        /// Tests the IIgnite parity.
+        /// </summary>
+        [Test]
+        public void TestIgnite()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\Ignite.java",
+                typeof(IIgnite),
+                UnneededMembers,
+                MissingMembers,
+                KnownMappings);
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/MessagingParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/MessagingParityTest.cs
new file mode 100644 (file)
index 0000000..1d940fc
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Messaging;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="IMessaging"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class MessagingParityTest
+    {
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestMessaging()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteMessaging.java",
+                typeof(IMessaging));
+        }
+    }
+}
\ No newline at end of file
index 068d22e..63aa96f 100644 (file)
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests.ApiParity
     using System.Collections.Generic;
     using System.IO;
     using System.Linq;
+    using System.Reflection;
     using System.Text;
     using System.Text.RegularExpressions;
     using Apache.Ignite.Core.Impl.Common;
@@ -35,8 +36,13 @@ namespace Apache.Ignite.Core.Tests.ApiParity
         private static readonly Regex JavaPropertyRegex = 
             new Regex("(@Deprecated)?\\s+public [^=^\r^\n]+ (\\w+)\\(\\) {", RegexOptions.Compiled);
 
+        /** Interface method regex. */
+        private static readonly Regex JavaInterfaceMethodRegex = 
+            new Regex("(@Deprecated)?\\s+(@Override)?\\s+public [^=^\r^\n]+ (\\w+)\\(.*?\\)",
+                RegexOptions.Compiled | RegexOptions.Singleline);
+
         /** Properties that are not needed on .NET side. */
-        private static readonly string[] UnneededProperties =
+        private static readonly string[] UnneededMethods =
         {
             "toString",
             "hashCode",
@@ -52,38 +58,78 @@ namespace Apache.Ignite.Core.Tests.ApiParity
             IEnumerable<string> knownMissingProperties = null,
             Dictionary<string, string> knownMappings = null)
         {
-            var path = Path.Combine(IgniteHome.Resolve(null), javaFilePath);
-
-            Assert.IsTrue(File.Exists(path));
+            var path = GetFullPath(javaFilePath);
 
             var dotNetProperties = type.GetProperties()
-                .ToDictionary(x => x.Name, x => x, StringComparer.OrdinalIgnoreCase);
+                .ToDictionary(x => x.Name, x => (MemberInfo) x, StringComparer.OrdinalIgnoreCase);
 
             var javaProperties = GetJavaProperties(path)
                 .Except(excludedProperties ?? Enumerable.Empty<string>());
 
-            var missingProperties = javaProperties
-                .Where(jp => !GetNameVariants(jp, knownMappings).Any(dotNetProperties.ContainsKey))
+            CheckParity(type, knownMissingProperties, knownMappings, javaProperties, dotNetProperties);
+        }
+
+        /// <summary>
+        /// Tests the configuration parity.
+        /// </summary>
+        public static void CheckInterfaceParity(string javaFilePath, 
+            Type type, 
+            IEnumerable<string> excludedMembers = null,
+            IEnumerable<string> knownMissingMembers = null,
+            Dictionary<string, string> knownMappings = null)
+        {
+            var path = GetFullPath(javaFilePath);
+
+            var dotNetMembers = type.GetMembers()
+                .GroupBy(x => x.Name)
+                .ToDictionary(x => x.Key, x => x.First(), StringComparer.OrdinalIgnoreCase);
+
+            var javaMethods = GetJavaInterfaceMethods(path)
+                .Except(excludedMembers ?? Enumerable.Empty<string>());
+
+            CheckParity(type, knownMissingMembers, knownMappings, javaMethods, dotNetMembers);
+        }
+
+        /// <summary>
+        /// Gets the full path.
+        /// </summary>
+        private static string GetFullPath(string javaFilePath)
+        {
+            var path = Path.Combine(IgniteHome.Resolve(null), javaFilePath);
+            Assert.IsTrue(File.Exists(path));
+
+            return path;
+        }
+
+        /// <summary>
+        /// Checks the parity.
+        /// </summary>
+        private static void CheckParity(Type type, IEnumerable<string> knownMissingMembers, 
+            IDictionary<string, string> knownMappings, IEnumerable<string> javaMethods, 
+            IDictionary<string, MemberInfo> dotNetMembers)
+        {
+            var missingMembers = javaMethods
+                .Where(jp => !GetNameVariants(jp, knownMappings).Any(dotNetMembers.ContainsKey))
                 .ToDictionary(x => x, x => x, StringComparer.OrdinalIgnoreCase);
 
-            var knownMissing = (knownMissingProperties ?? Enumerable.Empty<string>())
+            var knownMissing = (knownMissingMembers ?? Enumerable.Empty<string>())
                 .ToDictionary(x => x, x => x, StringComparer.OrdinalIgnoreCase);
 
             var sb = new StringBuilder();
 
-            foreach (var javaMissingProp in missingProperties)
+            foreach (var javaMissingProp in missingMembers)
             {
                 if (!knownMissing.ContainsKey(javaMissingProp.Key))
                 {
-                    sb.AppendFormat("{0}.{1} property is missing in .NET.\n", type.Name, javaMissingProp.Key);
+                    sb.AppendFormat("{0}.{1} member is missing in .NET.\n", type.Name, javaMissingProp.Key);
                 }
             }
 
             foreach (var dotnetMissingProp in knownMissing)
             {
-                if (!missingProperties.ContainsKey(dotnetMissingProp.Key))
+                if (!missingMembers.ContainsKey(dotnetMissingProp.Key))
                 {
-                    sb.AppendFormat("{0}.{1} property is missing in Java, but is specified as known in .NET.\n", 
+                    sb.AppendFormat("{0}.{1} member is missing in Java, but is specified as known in .NET.\n",
                         type.Name, dotnetMissingProp.Key);
                 }
             }
@@ -106,7 +152,21 @@ namespace Apache.Ignite.Core.Tests.ApiParity
                 .Where(m => m.Groups[1].Value == string.Empty)
                 .Select(m => m.Groups[2].Value.Replace("get", ""))
                 .Where(x => !x.Contains(" void "))
-                .Except(UnneededProperties);
+                .Except(UnneededMethods);
+        }
+
+        /// <summary>
+        /// Gets the java interface methods from file.
+        /// </summary>
+        private static IEnumerable<string> GetJavaInterfaceMethods(string path)
+        {
+            var text = File.ReadAllText(path);
+
+            return JavaInterfaceMethodRegex.Matches(text)
+                .OfType<Match>()
+                .Where(m => m.Groups[1].Value == string.Empty)
+                .Select(m => m.Groups[3].Value.Replace("get", ""))
+                .Except(UnneededMethods);
         }
 
         /// <summary>
@@ -116,6 +176,10 @@ namespace Apache.Ignite.Core.Tests.ApiParity
             IDictionary<string, string> knownMappings)
         {
             yield return javaPropertyName;
+            
+            yield return "get" + javaPropertyName;
+            
+            yield return "is" + javaPropertyName;
 
             yield return javaPropertyName.Replace("PoolSize", "ThreadPoolSize");
 
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ServicesParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ServicesParityTest.cs
new file mode 100644 (file)
index 0000000..d8c0938
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Services;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="IServices"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class ServicesParityTest
+    {
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestServices()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteServices.java",
+                typeof(IServices));
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/StreamerParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/StreamerParityTest.cs
new file mode 100644 (file)
index 0000000..8e795e5
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using System.Collections.Generic;
+    using Apache.Ignite.Core.Datastream;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="IDataStreamer{TK,TV}"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class StreamerParityTest
+    {
+        /** Members that are not needed on .NET side. */
+        private static readonly string[] UnneededMembers =
+        {
+            "deployClass"
+        };
+
+        /** Known name mappings. */
+        private static readonly Dictionary<string, string> KnownMappings = new Dictionary<string, string>
+        {
+            {"keepBinary", "WithKeepBinary"},
+            {"future", "Task"}
+        };
+
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestStreamer()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteDataStreamer.java",
+                typeof(IDataStreamer<,>),
+                UnneededMembers, knownMappings: KnownMappings);
+        }
+    }
+}
\ No newline at end of file
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/TransactionsParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/TransactionsParityTest.cs
new file mode 100644 (file)
index 0000000..7c19569
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.Tests.ApiParity
+{
+    using Apache.Ignite.Core.Transactions;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="ITransactions"/> has all APIs from Java Ignite interface.
+    /// </summary>
+    public class TransactionsParityTest
+    {
+        /// <summary>
+        /// Tests the API parity.
+        /// </summary>
+        [Test]
+        public void TestTransactions()
+        {
+            ParityTest.CheckInterfaceParity(
+                @"modules\core\src\main\java\org\apache\ignite\IgniteTransactions.java",
+                typeof(ITransactions));
+        }
+    }
+}
\ No newline at end of file