Fix test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bf3b4eab Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bf3b4eab Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bf3b4eab Branch: refs/heads/ignite-2977 Commit: bf3b4eab65612e912a11190fb1ffd9b642062ba4 Parents: 148bd26 Author: Pavel Tupitsyn <[email protected]> Authored: Tue Apr 12 17:48:14 2016 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Tue Apr 12 17:48:14 2016 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.csproj | 2 +- .../Continuous/ContinuousQueryJavaFilterTest.cs | 124 +++++++++++++++++++ .../Compute/MixedClusterQueryTest.cs | 124 ------------------- .../Apache.Ignite.Core.Tests/TestRunner.cs | 2 +- 4 files changed, 126 insertions(+), 126 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/bf3b4eab/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 3134871..f10b478 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 @@ -100,7 +100,7 @@ <Compile Include="Compute\FailoverTaskSelfTest.cs" /> <Compile Include="Compute\BinarizableClosureTaskTest.cs" /> <Compile Include="Compute\BinarizableTaskTest.cs" /> - <Compile Include="Compute\MixedClusterQueryTest.cs" /> + <Compile Include="Cache\Query\Continuous\ContinuousQueryJavaFilterTest.cs" /> <Compile Include="Compute\MixedClusterTest.cs" /> <Compile Include="Compute\ResourceTaskTest.cs" /> <Compile Include="Compute\SerializableClosureTaskTest.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/bf3b4eab/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs new file mode 100644 index 0000000..3106b39 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs @@ -0,0 +1,124 @@ +/* + * 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. + */ + +#pragma warning disable 618 // SpringConfigUrl +namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous +{ + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using System.Linq; + using Apache.Ignite.Core.Cache.Event; + using Apache.Ignite.Core.Cache.Query.Continuous; + using Apache.Ignite.Core.Common; + using NUnit.Framework; + + /// <summary> + /// Tests query in a cluster with Java-only and .NET nodes. + /// </summary> + public class ContinuousQueryJavaFilterTest + { + /** */ + private const string SpringConfig = @"Config\Compute\compute-grid1.xml"; + + /** */ + private const string SpringConfig2 = @"Config\Compute\compute-grid2.xml"; + + /** */ + private const string StartTask = "org.apache.ignite.platform.PlatformStartIgniteTask"; + + /** */ + private const string StopTask = "org.apache.ignite.platform.PlatformStopIgniteTask"; + + /// <summary> + /// Test. + /// </summary> + [Test] + public void Test() + { + var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) {SpringConfigUrl = SpringConfig}; + + var cfg2 = new IgniteConfiguration(TestUtils.GetTestConfiguration()) + { + SpringConfigUrl = SpringConfig2, + GridName = "dotNet2" + }; + + // 3 nodes: check local, remote, Java remote filters. + using (var ignite = Ignition.Start(cfg)) + using (Ignition.Start(cfg2)) + { + var javaNodeName = ignite.GetCompute().ExecuteJavaTask<string>(StartTask, SpringConfig2); + + try + { + Assert.IsTrue(ignite.WaitTopology(3)); + + TestJavaObjects(ignite); + } + finally + { + ignite.GetCompute().ExecuteJavaTask<object>(StopTask, javaNodeName); + } + } + } + + /// <summary> + /// Tests the java objects. + /// </summary> + [SuppressMessage("ReSharper", "PossibleNullReferenceException")] + private static void TestJavaObjects(IIgnite ignite) + { + var cache = ignite.GetOrCreateCache<int, string>("qry"); + + var pred = JavaObjectFactory.CreateCacheEntryEventFilter<int, string>( + "org.apache.ignite.platform.PlatformCacheEntryEventFilter", + new Dictionary<string, object> {{"startsWith", "valid"}}); + + var qry = new ContinuousQuery<int, string>(new QueryListener(), pred); + + using (cache.QueryContinuous(qry)) + { + // Run on many keys to test all nodes + for (var i = 0; i < 200; i++) + { + QueryListener.Event = null; + cache[i] = "validValue"; + Assert.AreEqual(cache[i], QueryListener.Event.Value); + + QueryListener.Event = null; + cache[i] = "invalidValue"; + Assert.IsNull(QueryListener.Event); + } + } + } + + /// <summary> + /// Test listener. + /// </summary> + private class QueryListener : ICacheEntryEventListener<int, string> + { + /** */ + public static volatile ICacheEntryEvent<int, string> Event; + + /** <inheritdoc /> */ + public void OnEvent(IEnumerable<ICacheEntryEvent<int, string>> evts) + { + Event = evts.FirstOrDefault(); + } + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/bf3b4eab/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterQueryTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterQueryTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterQueryTest.cs deleted file mode 100644 index bc424cc..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterQueryTest.cs +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ - -#pragma warning disable 618 // SpringConfigUrl -namespace Apache.Ignite.Core.Tests.Compute -{ - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - using Apache.Ignite.Core.Cache.Event; - using Apache.Ignite.Core.Cache.Query.Continuous; - using Apache.Ignite.Core.Common; - using NUnit.Framework; - - /// <summary> - /// Tests query in a cluster with Java-only and .NET nodes. - /// </summary> - public class MixedClusterQueryTest - { - /** */ - private const string SpringConfig = @"Config\Compute\compute-grid1.xml"; - - /** */ - private const string SpringConfig2 = @"Config\Compute\compute-grid2.xml"; - - /** */ - private const string StartTask = "org.apache.ignite.platform.PlatformStartIgniteTask"; - - /** */ - private const string StopTask = "org.apache.ignite.platform.PlatformStopIgniteTask"; - - /// <summary> - /// Test. - /// </summary> - [Test] - public void Test() - { - var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) {SpringConfigUrl = SpringConfig}; - - var cfg2 = new IgniteConfiguration(TestUtils.GetTestConfiguration()) - { - SpringConfigUrl = SpringConfig2, - GridName = "dotNet2" - }; - - // 3 nodes: check local, remote, Java remote filters. - using (var ignite = Ignition.Start(cfg)) - using (Ignition.Start(cfg2)) - { - var javaNodeName = ignite.GetCompute().ExecuteJavaTask<string>(StartTask, SpringConfig2); - - try - { - Assert.IsTrue(ignite.WaitTopology(3)); - - TestJavaObjects(ignite); - } - finally - { - ignite.GetCompute().ExecuteJavaTask<object>(StopTask, javaNodeName); - } - } - } - - /// <summary> - /// Tests the java objects. - /// </summary> - [SuppressMessage("ReSharper", "PossibleNullReferenceException")] - private static void TestJavaObjects(IIgnite ignite) - { - var cache = ignite.GetOrCreateCache<int, string>("qry"); - - var pred = JavaObjectFactory.CreateCacheEntryEventFilter<int, string>( - "org.apache.ignite.platform.PlatformCacheEntryEventFilter", - new Dictionary<string, object> {{"startsWith", "valid"}}); - - var qry = new ContinuousQuery<int, string>(new QueryListener(), pred); - - using (cache.QueryContinuous(qry)) - { - // Run on many keys to test all nodes - for (var i = 0; i < 200; i++) - { - QueryListener.Event = null; - cache[i] = "validValue"; - Assert.AreEqual(cache[i], QueryListener.Event.Value); - - QueryListener.Event = null; - cache[i] = "invalidValue"; - Assert.IsNull(QueryListener.Event); - } - } - } - - /// <summary> - /// Test listener. - /// </summary> - private class QueryListener : ICacheEntryEventListener<int, string> - { - /** */ - public static volatile ICacheEntryEvent<int, string> Event; - - /** <inheritdoc /> */ - public void OnEvent(IEnumerable<ICacheEntryEvent<int, string>> evts) - { - Event = evts.FirstOrDefault(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/bf3b4eab/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs index b973bf3..dc29ca6 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs @@ -35,7 +35,7 @@ namespace Apache.Ignite.Core.Tests //TestOne(typeof(MixedClusterQueryTest), "TestExcept"); - TestAll(typeof (MixedClusterQueryTest)); + TestAll(typeof (ContinuousQueryJavaFilterTest)); //TestAllInAssembly(); }
