IGNITE-4625 .NET: Fix java-only node stop Solves "Ignite instance with this name has already been started" test failures
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7696dd24 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7696dd24 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7696dd24 Branch: refs/heads/ignite-1192 Commit: 7696dd24e15c4dd387db430bd7b1679eceb843fb Parents: 889594f Author: Pavel Tupitsyn <ptupit...@apache.org> Authored: Tue Apr 4 11:03:40 2017 +0300 Committer: Pavel Tupitsyn <ptupit...@apache.org> Committed: Tue Apr 4 11:03:40 2017 +0300 ---------------------------------------------------------------------- .../ignite/platform/PlatformStopIgniteTask.java | 11 ++++++- .../Compute/AbstractTaskTest.cs | 28 ++---------------- .../Compute/MixedClusterTest.cs | 31 +++----------------- .../Apache.Ignite.Core.Tests/DeploymentTest.cs | 10 +++++++ 4 files changed, 26 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7696dd24/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java index be23ed6..b79aa52 100644 --- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java +++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java @@ -38,7 +38,16 @@ public class PlatformStopIgniteTask extends ComputeTaskAdapter<String, Boolean> /** {@inheritDoc} */ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable String arg) throws IgniteException { - return Collections.singletonMap(new PlatformStopIgniteJob(arg), F.first(subgrid)); + ClusterNode node = subgrid.get(0); + + for (ClusterNode n : subgrid) { + if (n.isLocal()) { + node = n; + break; + } + } + + return Collections.singletonMap(new PlatformStopIgniteJob(arg), node); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/7696dd24/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs index 6bcd010..65bb369 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs @@ -129,32 +129,8 @@ namespace Apache.Ignite.Core.Tests.Compute [TestFixtureTearDown] public void StopClient() { - if (Grid1 != null) - Ignition.Stop(Grid1.Name, true); - - if (_fork) - { - if (_proc2 != null) { - _proc2.Kill(); - - _proc2.Join(); - } - - if (_proc3 != null) - { - _proc3.Kill(); - - _proc3.Join(); - } - } - else - { - if (_grid2 != null) - Ignition.Stop(_grid2.Name, true); - - if (_grid3 != null) - Ignition.Stop(_grid3.Name, true); - } + Ignition.StopAll(true); + IgniteProcess.KillAll(); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/7696dd24/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterTest.cs index ab4e6ab..41817eb 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterTest.cs @@ -21,8 +21,6 @@ namespace Apache.Ignite.Core.Tests.Compute using System.Collections; using System.Linq; using Apache.Ignite.Core.Cache; - using Apache.Ignite.Core.Cache.Query; - using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Compute; using NUnit.Framework; @@ -31,8 +29,12 @@ namespace Apache.Ignite.Core.Tests.Compute /// </summary> public class MixedClusterTest { + /** */ private IIgnite _ignite; + + /** */ private string _javaNodeName; + /** */ private const string SpringConfig = @"Config\Compute\compute-grid1.xml"; @@ -89,18 +91,6 @@ namespace Apache.Ignite.Core.Tests.Compute } /// <summary> - /// Tests the scan query. - /// </summary> - [Test] - public void TestScanQuery() - { - var cache = GetCache(); - - // Scan query does not work in the mixed cluster. - Assert.Throws<IgniteException>(() => cache.Query(new ScanQuery<int, int>(new ScanFilter())).GetAll()); - } - - /// <summary> /// Tests the cache invoke. /// </summary> [Test] @@ -154,19 +144,6 @@ namespace Apache.Ignite.Core.Tests.Compute } /// <summary> - /// Test filter. - /// </summary> - [Serializable] - private class ScanFilter : ICacheEntryFilter<int, int> - { - /** <inheritdoc /> */ - public bool Invoke(ICacheEntry<int, int> entry) - { - return entry.Key < 100; - } - } - - /// <summary> /// Test processor. /// </summary> [Serializable] http://git-wip-us.apache.org/repos/asf/ignite/blob/7696dd24/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs index ece4894..5f2ecfa 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs @@ -111,6 +111,16 @@ namespace Apache.Ignite.Core.Tests } /// <summary> + /// Fixture tear down. + /// </summary> + [TestFixtureTearDown] + public void TestFixtureTearDown() + { + Ignition.StopAll(true); + IgniteProcess.KillAll(); + } + + /// <summary> /// Verifies that custom-deployed node has started. /// </summary> private static void VerifyNodeStarted(string exePath)