IGNITE-1983: .NET: Fixed continuous query tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/512fe6b0 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/512fe6b0 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/512fe6b0 Branch: refs/heads/ignite-1270 Commit: 512fe6b076331a3d187e1e0277f6bd565d8350bf Parents: dcbfbd2 Author: vozerov-gridgain <[email protected]> Authored: Tue Nov 24 11:52:06 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Tue Nov 24 11:52:06 2015 +0300 ---------------------------------------------------------------------- .../Continuous/ContinuousQueryAbstractTest.cs | 29 ++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/512fe6b0/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs index 720483a..bdca918 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs @@ -308,7 +308,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous // Put from local node. int key1 = PrimaryKey(cache1); cache1.GetAndPut(key1, Entry(key1)); - CheckFilterSingle(key1, null, Entry(key1), !loc); + CheckFilterSingle(key1, null, Entry(key1)); CheckCallbackSingle(key1, null, Entry(key1)); // Put from remote node. @@ -322,7 +322,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous } else { - CheckFilterSingle(key2, null, Entry(key2), true); + CheckFilterSingle(key2, null, Entry(key2)); CheckCallbackSingle(key2, null, Entry(key2)); } @@ -330,7 +330,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous // Ignored put from local node. cache1.GetAndPut(key1, Entry(key1 + 1)); - CheckFilterSingle(key1, Entry(key1), Entry(key1 + 1), !loc); + CheckFilterSingle(key1, Entry(key1), Entry(key1 + 1)); CheckNoCallback(100); // Ignored put from remote node. @@ -339,7 +339,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous if (loc) CheckNoFilter(100); else - CheckFilterSingle(key2, Entry(key2), Entry(key2 + 1), true); + CheckFilterSingle(key2, Entry(key2), Entry(key2 + 1)); CheckNoCallback(100); } @@ -621,6 +621,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous .Deserialize<BinarizableEntry>()); // 2. Remote put. + ClearEvents(); cache1.GetAndPut(PrimaryKey(cache2), Entry(2)); Assert.IsTrue(FILTER_EVTS.TryTake(out filterEvt, 500)); @@ -868,15 +869,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous /// <param name="expKey">Expected key.</param> /// <param name="expOldVal">Expected old value.</param> /// <param name="expVal">Expected value.</param> - /// <param name="hasBackup">Whether there is a backup node to check..</param> - private void CheckFilterSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal, - bool hasBackup = false) + private void CheckFilterSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal) { CheckFilterSingle(expKey, expOldVal, expVal, 1000); - - // Filter is called on each cache node (primary and backup) - if (hasBackup) - CheckFilterSingle(expKey, expOldVal, expVal, 1000); + ClearEvents(); } /// <summary> @@ -895,6 +891,17 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous Assert.AreEqual(expKey, evt.entry.Key); Assert.AreEqual(expOldVal, evt.entry.OldValue); Assert.AreEqual(expVal, evt.entry.Value); + + ClearEvents(); + } + + /// <summary> + /// Clears the events collection. + /// </summary> + private static void ClearEvents() + { + while (FILTER_EVTS.Count > 0) + FILTER_EVTS.Take(); } /// <summary>
