IGNITE-7123 .NET: Verify metrics API parity with tests
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4717570c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4717570c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4717570c Branch: refs/heads/ignite-zk Commit: 4717570cfc6263ca3beb2ef6df53f5edef365fdc Parents: 280acbf Author: Pavel Tupitsyn <[email protected]> Authored: Wed Dec 6 19:44:12 2017 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Wed Dec 6 19:44:12 2017 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.csproj | 5 ++ .../ApiParity/CacheMetricsParityTest.cs | 64 ++++++++++++++++++++ .../ApiParity/ClusterMetricsParityTest.cs | 47 ++++++++++++++ .../ApiParity/DataRegionMetricsParityTest.cs | 54 +++++++++++++++++ .../ApiParity/DataStorageMetricsParityTest.cs | 38 ++++++++++++ .../ApiParity/ParityTest.cs | 4 +- .../ApiParity/TransactionMetricsParityTest.cs | 39 ++++++++++++ 7 files changed, 250 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4717570c/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 648df7e..a53b0de 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 @@ -71,12 +71,16 @@ <ItemGroup> <Compile Include="ApiParity\BinaryParityTest.cs" /> <Compile Include="ApiParity\CacheAffinityParityTest.cs" /> + <Compile Include="ApiParity\CacheMetricsParityTest.cs" /> <Compile Include="ApiParity\CacheParityTest.cs" /> <Compile Include="ApiParity\ClientConnectorConfigurationParityTest.cs" /> + <Compile Include="ApiParity\ClusterMetricsParityTest.cs" /> <Compile Include="ApiParity\ClusterParityTest.cs" /> <Compile Include="ApiParity\ComputeParityTest.cs" /> <Compile Include="ApiParity\DataRegionConfigurationParityTest.cs" /> + <Compile Include="ApiParity\DataRegionMetricsParityTest.cs" /> <Compile Include="ApiParity\DataStorageConfigurationParityTest.cs" /> + <Compile Include="ApiParity\DataStorageMetricsParityTest.cs" /> <Compile Include="ApiParity\EventsParityTest.cs" /> <Compile Include="ApiParity\IgniteConfigurationParityTest.cs" /> <Compile Include="ApiParity\IgniteParityTest.cs" /> @@ -86,6 +90,7 @@ <Compile Include="ApiParity\QueryEntityConfigurationParityTest.cs" /> <Compile Include="ApiParity\ServicesParityTest.cs" /> <Compile Include="ApiParity\StreamerParityTest.cs" /> + <Compile Include="ApiParity\TransactionMetricsParityTest.cs" /> <Compile Include="ApiParity\TransactionsParityTest.cs" /> <Compile Include="AssertExtensions.cs" /> <Compile Include="Binary\BinaryBuilderSelfTestSimpleName.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/4717570c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheMetricsParityTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheMetricsParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheMetricsParityTest.cs new file mode 100644 index 0000000..7e8be1e --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheMetricsParityTest.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.Tests.ApiParity +{ + using System.Collections.Generic; + using Apache.Ignite.Core.Cache; + using NUnit.Framework; + + /// <summary> + /// Tests that <see cref="ICacheMetrics"/> has all APIs from Java Ignite interface. + /// </summary> + public class CacheMetricsParityTest + { + /** Known name mappings. */ + private static readonly Dictionary<string, string> KnownMappings = new Dictionary<string, string> + { + {"name", "CacheName"} + }; + + /** Properties that are missing on .NET side. */ + private static readonly string[] MissingProperties = + { + // IGNITE-7126 + "HeapEntriesCount", + "TotalPartitionsCount", + "RebalancingPartitionsCount", + "KeysToRebalanceLeft", + "RebalancingKeysRate", + "RebalancingBytesRate", + "isValidForReading", + "isValidForWriting", + "EstimatedRebalancingFinishTime", + "RebalancingStartTime" + }; + + /// <summary> + /// Tests the API parity. + /// </summary> + [Test] + public void TestCacheMetrics() + { + ParityTest.CheckInterfaceParity( + @"modules\core\src\main\java\org\apache\ignite\cache\CacheMetrics.java", + typeof(ICacheMetrics), + knownMappings: KnownMappings, + knownMissingMembers: MissingProperties); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/4717570c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClusterMetricsParityTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClusterMetricsParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClusterMetricsParityTest.cs new file mode 100644 index 0000000..bb0b3cb --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClusterMetricsParityTest.cs @@ -0,0 +1,47 @@ +/* + * 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="IClusterMetrics"/> has all APIs from Java Ignite interface. + /// </summary> + public class ClusterMetricsParityTest + { + /** Properties that are missing on .NET side. */ + private static readonly string[] MissingProperties = + { + // IGNITE-7127 + "TotalJobsExecutionTime" + }; + + /// <summary> + /// Tests the API parity. + /// </summary> + [Test] + public void TestClusterMetrics() + { + ParityTest.CheckInterfaceParity( + @"modules\core\src\main\java\org\apache\ignite\cluster\ClusterMetrics.java", + typeof(IClusterMetrics), + knownMissingMembers: MissingProperties); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/4717570c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionMetricsParityTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionMetricsParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionMetricsParityTest.cs new file mode 100644 index 0000000..d85d391 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionMetricsParityTest.cs @@ -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 NUnit.Framework; + + /// <summary> + /// Tests that <see cref="IDataRegionMetrics"/> has all APIs from Java Ignite interface. + /// </summary> + public class DataRegionMetricsParityTest + { + /** Known name mappings. */ + private static readonly Dictionary<string, string> KnownMappings = new Dictionary<string, string> + { + {"PagesFillFactor", "PageFillFactor"} + }; + + /** Properties that are missing on .NET side. */ + private static readonly string[] MissingProperties = + { + // IGNITE-7128 + "DirtyPages", "PagesReplaceRate", "PagesReplaceAge", "PhysicalMemoryPages" + }; + + /// <summary> + /// Tests the API parity. + /// </summary> + [Test] + public void TestDataRegionMetrics() + { + ParityTest.CheckInterfaceParity( + @"modules\core\src\main\java\org\apache\ignite\DataRegionMetrics.java", + typeof(IDataRegionMetrics), + knownMappings: KnownMappings, + knownMissingMembers: MissingProperties); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/4717570c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageMetricsParityTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageMetricsParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageMetricsParityTest.cs new file mode 100644 index 0000000..a8fe87d --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageMetricsParityTest.cs @@ -0,0 +1,38 @@ +/* + * 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 NUnit.Framework; + + /// <summary> + /// Tests that <see cref="IDataStorageMetrics"/> has all APIs from Java Ignite interface. + /// </summary> + public class DataStorageMetricsParityTest + { + /// <summary> + /// Tests the API parity. + /// </summary> + [Test] + public void TestDataStorageMetrics() + { + ParityTest.CheckInterfaceParity( + @"modules\core\src\main\java\org\apache\ignite\DataStorageMetrics.java", + typeof(IDataStorageMetrics)); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/4717570c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs index 63aa96f..d52ef14 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs @@ -116,12 +116,14 @@ namespace Apache.Ignite.Core.Tests.ApiParity .ToDictionary(x => x, x => x, StringComparer.OrdinalIgnoreCase); var sb = new StringBuilder(); + var codeSb = new StringBuilder(); foreach (var javaMissingProp in missingMembers) { if (!knownMissing.ContainsKey(javaMissingProp.Key)) { sb.AppendFormat("{0}.{1} member is missing in .NET.\n", type.Name, javaMissingProp.Key); + codeSb.AppendFormat("\"{0}\", ", javaMissingProp.Key); } } @@ -136,7 +138,7 @@ namespace Apache.Ignite.Core.Tests.ApiParity if (sb.Length > 0) { - Assert.Fail(sb.ToString()); + Assert.Fail(sb + "\nQuoted list: " + codeSb); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/4717570c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/TransactionMetricsParityTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/TransactionMetricsParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/TransactionMetricsParityTest.cs new file mode 100644 index 0000000..0327e3a --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/TransactionMetricsParityTest.cs @@ -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="ITransactionMetrics"/> has all APIs from Java Ignite interface. + /// </summary> + public class TransactionMetricsParityTest + { + /// <summary> + /// Tests the API parity. + /// </summary> + [Test] + public void TestTransactionMetrics() + { + ParityTest.CheckInterfaceParity( + @"modules\core\src\main\java\org\apache\ignite\transactions\TransactionMetrics.java", + typeof(ITransactionMetrics)); + } + } +} \ No newline at end of file
