ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [26/50] ignite git commit: Adding tests
Date Wed, 13 Apr 2016 14:53:25 GMT
Adding tests


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/42ec18fb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/42ec18fb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/42ec18fb

Branch: refs/heads/ignite-2977
Commit: 42ec18fbc98a9953cf69cc63604d5268508a7d3a
Parents: a0cbb8d
Author: Pavel Tupitsyn <ptupitsyn@gridgain.com>
Authored: Wed Apr 13 13:18:01 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@gridgain.com>
Committed: Wed Apr 13 13:18:01 2016 +0300

----------------------------------------------------------------------
 .../platform/PlatformCacheEntryEventFilter.java | 12 +++++----
 .../Continuous/ContinuousQueryJavaFilterTest.cs | 27 ++++++++++++++++++--
 2 files changed, 32 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/42ec18fb/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheEntryEventFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheEntryEventFilter.java
b/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheEntryEventFilter.java
index a4fccf1..d1d38de 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheEntryEventFilter.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheEntryEventFilter.java
@@ -27,14 +27,13 @@ import javax.cache.event.CacheEntryListenerException;
 /**
  * Test filter.
  */
+@SuppressWarnings("FieldCanBeLocal")
 public class PlatformCacheEntryEventFilter implements CacheEntryEventSerializableFilter {
     /** Property to be set from platform. */
-    @SuppressWarnings("FieldCanBeLocal")
     private String startsWith = "-";
 
     /** Property to be set from platform. */
-    @SuppressWarnings("FieldCanBeLocal")
-    private int maxKey;
+    private int intField;
 
     /** Injected instance. */
     @IgniteInstanceResource
@@ -42,9 +41,12 @@ public class PlatformCacheEntryEventFilter implements CacheEntryEventSerializabl
 
     /** {@inheritDoc} */
     @Override public boolean evaluate(CacheEntryEvent event) throws CacheEntryListenerException
{
+        // check injection
         assert ignite != null;
 
-        return ((String)event.getValue()).startsWith(startsWith) &&
-            ((int)event.getKey()) < maxKey;
+        // check fields
+        assert intField == 5;
+
+        return ((String)event.getValue()).startsWith(startsWith);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/42ec18fb/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
index 95a3bdf..0fad2f9 100644
--- 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
@@ -95,10 +95,24 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
         [Test]
         public void TestFilter()
         {
-            // TODO: Test all kinds of properties
             var javaObj = new JavaObject("org.apache.ignite.platform.PlatformCacheEntryEventFilter")
             {
-                Properties = {{"startsWith", "valid"}}
+                Properties =
+                {
+                    {"startsWith", "valid"},
+                    {"charField", 'a'},
+                    {"byteField", (byte) 1},
+                    {"sbyteField", (sbyte) 2},
+                    {"shortField", (short) 3},
+                    {"ushortField", (ushort) 4},
+                    {"intField", 5},
+                    {"uintField", (uint) 6},
+                    {"longField", (long) 7},
+                    {"ulongField", (ulong) 8},
+                    {"floatField", (float) 9.99},
+                    {"doubleField", 10.123},
+                    {"boolField", true},
+                }
             };
 
             var filter = javaObj.ToCacheEntryEventFilter<int, string>();
@@ -107,6 +121,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
         }
 
         /// <summary>
+        /// Tests the equality filter.
+        /// </summary>
+        [Test]
+        public void TestEqualsFilter()
+        {
+            // TODO: Binary objects
+        }
+
+        /// <summary>
         /// Tests the factory class.
         /// </summary>
         [Test]


Mime
View raw message