IGNITE-7390 .NET: Use InternalsVisibleTo for Core projects Remove unnecessary compiler directives, add more tests to Core project
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2dce0b89 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2dce0b89 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2dce0b89 Branch: refs/heads/ignite-zk Commit: 2dce0b89d344c5100eabac53f4c1de289c9f24bd Parents: e361cb6 Author: Pavel Tupitsyn <[email protected]> Authored: Thu Jan 11 17:56:36 2018 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Thu Jan 11 17:56:36 2018 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.DotNetCore.csproj | 10 ++++++++++ .../Binary/BinaryBuilderSelfTest.cs | 2 -- .../Cache/CacheAbstractTest.cs | 4 ---- .../Client/Cache/CreateCacheTest.cs | 4 ---- .../Client/ClientConnectionTest.cs | 2 -- .../Compute/ComputeApiTest.cs | 8 -------- .../Log/CustomLoggerTest.cs | 2 -- .../Services/ServicesTest.cs | 2 -- .../Apache.Ignite.Core.Tests/TestUtils.Common.cs | 19 ------------------- 9 files changed, 10 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj index 3786928..8278365 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj @@ -16,6 +16,10 @@ <NoWarn>1701;1702;1705;NU1701</NoWarn> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <ItemGroup> <Compile Include="..\Apache.Ignite.Core.Tests\ApiParity\BinaryParityTest.cs" Link="ApiParity\BinaryParityTest.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\ApiParity\CacheAffinityParityTest.cs" Link="ApiParity\CacheAffinityParityTest.cs" /> @@ -42,7 +46,12 @@ <Compile Include="..\Apache.Ignite.Core.Tests\ApiParity\TransactionsParityTest.cs" Link="ApiParity\TransactionsParityTest.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\AssertExtensions.cs" Link="Common\AssertExtensions.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\BinaryConfigurationTest.cs" Link="Binary\BinaryConfigurationTest.cs" /> + <Compile Include="..\Apache.Ignite.Core.Tests\Binary\BinaryBuilderSelfTest.cs" Link="Binary\BinaryBuilderSelfTest.cs" /> + <Compile Include="..\Apache.Ignite.Core.Tests\Binary\BinaryBuilderSelfTestDynamicRegistration.cs" Link="Binary\BinaryBuilderSelfTestDynamicRegistration.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\Binary\BinaryDateTimeTest.cs" Link="Binary\BinaryDateTimeTest.cs" /> + <Compile Include="..\Apache.Ignite.Core.Tests\Binary\BinarySelfTest.cs" Link="Binary\BinarySelfTest.cs" /> + <Compile Include="..\Apache.Ignite.Core.Tests\Binary\EnumsTest.cs" Link="Binary\EnumsTest.cs" /> + <Compile Include="..\Apache.Ignite.Core.Tests\Binary\EnumsTestOnline.cs" Link="Binary\EnumsTestOnline.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\Binary\JavaBinaryInteropTest.cs" Link="Binary\JavaBinaryInteropTest.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\Binary\Serializable\AdvancedSerializationTest.cs" Link="Binary\Serializable\AdvancedSerializationTest.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\Binary\Serializable\CallbacksTest.cs" Link="Binary\Serializable\CallbacksTest.cs" /> @@ -98,6 +107,7 @@ <Compile Include="..\Apache.Ignite.Core.Tests\Client\ClientTestBase.cs" Link="ThinClient\ClientTestBase.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\Client\IgniteClientConfigurationTest.cs" Link="ThinClient\IgniteClientConfigurationTest.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\Compute\ComputeApiTest.cs" Link="Compute\ComputeApiTest.cs" /> + <Compile Include="..\Apache.Ignite.Core.Tests\Compute\ComputeApiTest.JavaTask.cs" Link="Compute\ComputeApiTest.JavaTask.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\DataStructures\AtomicLongTest.cs" Link="DataStructures\AtomicLongTest.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\DataStructures\AtomicReferenceTest.cs" Link="DataStructures\AtomicReferenceTest.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\DataStructures\AtomicSequenceTest.cs" Link="DataStructures\AtomicSequenceTest.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/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 5837ab1..f03a77a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs @@ -50,8 +50,6 @@ namespace Apache.Ignite.Core.Tests.Binary [TestFixtureSetUp] public void SetUp() { - TestUtils.KillProcesses(); - var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { BinaryConfiguration = new BinaryConfiguration http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs index fcce021..afe0a9a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs @@ -30,9 +30,7 @@ namespace Apache.Ignite.Core.Tests.Cache using Apache.Ignite.Core.Cache.Expiry; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Common; -#if !NETCOREAPP2_0 using Apache.Ignite.Core.Impl.Cache; -#endif using Apache.Ignite.Core.Tests.Query; using Apache.Ignite.Core.Transactions; using NUnit.Framework; @@ -2225,7 +2223,6 @@ namespace Apache.Ignite.Core.Tests.Cache } } -#if !NETCOREAPP2_0 /// <summary> /// Test skip-store semantics. /// </summary> @@ -2252,7 +2249,6 @@ namespace Apache.Ignite.Core.Tests.Cache // Ensure other flags are preserved. Assert.IsTrue(((CacheImpl<int, int>) cache.WithKeepBinary<int, int>().WithSkipStore()).IsKeepBinary); } -#endif [Test] public void TestRebalance() http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CreateCacheTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CreateCacheTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CreateCacheTest.cs index 92804be..047fc2b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CreateCacheTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CreateCacheTest.cs @@ -22,10 +22,8 @@ namespace Apache.Ignite.Core.Tests.Client.Cache using Apache.Ignite.Core.Client; using Apache.Ignite.Core.Client.Cache; using Apache.Ignite.Core.Configuration; -#if !NETCOREAPP2_0 using Apache.Ignite.Core.Impl.Client.Cache; using Apache.Ignite.Core.Impl.Client; -#endif using Apache.Ignite.Core.Tests.Cache; using NUnit.Framework; @@ -152,7 +150,6 @@ namespace Apache.Ignite.Core.Tests.Client.Cache AssertClientConfigsAreEqual(cfg, cache.GetConfiguration()); } -#if !NETCOREAPP2_0 /// <summary> /// Tests cache creation from partial configuration. /// </summary> @@ -184,7 +181,6 @@ namespace Apache.Ignite.Core.Tests.Client.Cache AssertExtensions.ReflectionEqual(cfg, cache.GetConfiguration()); } -#endif /// <summary> /// Tests cache creation from configuration. http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs index 0bf3c37..1da60b1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs @@ -114,7 +114,6 @@ namespace Apache.Ignite.Core.Tests.Client Assert.Throws<ArgumentNullException>(() => Ignition.StartClient(new IgniteClientConfiguration())); } -#if !NETCOREAPP2_0 /// <summary> /// Tests the incorrect protocol version error. /// </summary> @@ -135,7 +134,6 @@ namespace Apache.Ignite.Core.Tests.Client "Client version: -1.-1.-1. Server version: 1.0.0", ex.Message); } } -#endif /// <summary> /// Tests that connector can be disabled. http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs index 6c4c00a..cf0ad40 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs @@ -784,19 +784,12 @@ namespace Apache.Ignite.Core.Tests.Compute _grid1.GetCluster().ForRemotes().GetCompute().Broadcast(new ExceptionalComputeAction())); Assert.IsNotNull(ex.InnerException); -#if NETCOREAPP2_0 - // Exceptions can't be serialized on .NET Core - Assert.AreEqual("Operation is not supported on this platform.", - ex.InnerException.Message); -#else Assert.AreEqual("Compute job has failed on remote node, examine InnerException for details.", ex.InnerException.Message); Assert.IsNotNull(ex.InnerException.InnerException); Assert.AreEqual(ExceptionalComputeAction.ErrorText, ex.InnerException.InnerException.Message); -#endif } -#if !NETCOREAPP2_0 /// <summary> /// Tests the footer setting. /// </summary> @@ -808,7 +801,6 @@ namespace Apache.Ignite.Core.Tests.Compute foreach (var g in new[] {_grid1, _grid2, _grid3}) Assert.AreEqual(CompactFooter, g.GetConfiguration().BinaryConfiguration.CompactFooter); } -#endif /// <summary> /// Create configuration. http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs index 50d2dbf..543287e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs @@ -119,7 +119,6 @@ namespace Apache.Ignite.Core.Tests.Log Assert.IsInstanceOf<ArithmeticException>(err.Exception); } -#if !NETCOREAPP2_0 // Exception serialization is not supported in .NET Core /// <summary> /// Tests that .NET exception propagates through Java to the log. /// </summary> @@ -145,7 +144,6 @@ namespace Apache.Ignite.Core.Tests.Log ((ArithmeticException) errFromJava.Exception.InnerException).Message); } } -#endif /// <summary> /// Tests the <see cref="QueryEntity"/> validation. http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/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 17cf923..b8f4cdf 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs @@ -821,9 +821,7 @@ namespace Apache.Ignite.Core.Tests.Services { foreach (var grid in Grids) { -#if !NETCOREAPP2_0 Assert.AreEqual(CompactFooter, ((Impl.Ignite) grid).Marshaller.CompactFooter); -#endif Assert.AreEqual(CompactFooter, grid.GetConfiguration().BinaryConfiguration.CompactFooter); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/2dce0b89/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.Common.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.Common.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.Common.cs index 2d735e9..c00ca49 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.Common.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.Common.cs @@ -26,10 +26,8 @@ namespace Apache.Ignite.Core.Tests using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Discovery.Tcp; using Apache.Ignite.Core.Discovery.Tcp.Static; -#if !NETCOREAPP2_0 using Apache.Ignite.Core.Impl; using Apache.Ignite.Core.Impl.Binary; -#endif using NUnit.Framework; /// <summary> @@ -320,7 +318,6 @@ namespace Apache.Ignite.Core.Tests /// <param name="timeout">Timeout, in milliseconds.</param> public static void AssertHandleRegistryHasItems(IIgnite grid, int expectedCount, int timeout) { -#if !NETCOREAPP2_0 var handleRegistry = ((Ignite)grid).HandleRegistry; expectedCount++; // Skip default lifecycle bean @@ -336,7 +333,6 @@ namespace Apache.Ignite.Core.Tests grid.Name, expectedCount, handleRegistry.Count, items.Select(x => x.ToString()).Aggregate((x, y) => x + "\n" + y)); } -#endif } /// <summary> @@ -349,24 +345,9 @@ namespace Apache.Ignite.Core.Tests Serializer = raw ? new BinaryReflectiveSerializer {RawMode = true} : null }; -#if NETCOREAPP2_0 - var marshType = typeof(IIgnite).Assembly.GetType("Apache.Ignite.Core.Impl.Binary.Marshaller"); - var marsh = Activator.CreateInstance(marshType, new object[] { cfg, null }); - marshType.GetProperty("CompactFooter").SetValue(marsh, false); - - var bytes = marshType.GetMethod("Marshal").MakeGenericMethod(typeof(object)) - .Invoke(marsh, new object[] { obj }); - - var res = marshType.GetMethods().Single(mi => - mi.Name == "Unmarshal" && mi.GetParameters().First().ParameterType == typeof(byte[])) - .MakeGenericMethod(typeof(object)).Invoke(marsh, new[] { bytes, 0 }); - - return (T)res; -#else var marsh = new Marshaller(cfg) { CompactFooter = false }; return marsh.Unmarshal<T>(marsh.Marshal(obj)); -#endif } } }
