IGNITE-7390 .NET: Use InternalsVisibleTo for Core projects
authorPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 11 Jan 2018 14:56:36 +0000 (17:56 +0300)
committerPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 11 Jan 2018 14:56:36 +0000 (17:56 +0300)
Remove unnecessary compiler directives, add more tests to Core project

modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CreateCacheTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.Common.cs

index 3786928..8278365 100644 (file)
     <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" />
     <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" />
     <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" />
index 5837ab1..f03a77a 100644 (file)
@@ -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
index fcce021..afe0a9a 100644 (file)
@@ -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()
index 92804be..047fc2b 100644 (file)
@@ -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.
index 0bf3c37..1da60b1 100644 (file)
@@ -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.
index 6c4c00a..cf0ad40 100644 (file)
@@ -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.
index 50d2dbf..543287e 100644 (file)
@@ -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.
index 17cf923..b8f4cdf 100644 (file)
@@ -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);
             }
         }
index 2d735e9..c00ca49 100644 (file)
@@ -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
         }
     }
 }