ignite-commits mailing list archives

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


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

Branch: refs/heads/ignite-2977
Commit: 5ac554063921d2b45ab50931adc0c8e8885e8b20
Parents: 7940541
Author: Pavel Tupitsyn <ptupitsyn@gridgain.com>
Authored: Tue Apr 12 17:40:57 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@gridgain.com>
Committed: Tue Apr 12 17:40:57 2016 +0300

----------------------------------------------------------------------
 .../platform/PlatformCacheEntryEventFilter.java |  6 ++++-
 .../Compute/MixedClusterQueryTest.cs            | 23 ++++++++++----------
 .../Common/JavaObjectFactory.cs                 | 23 ++++++++++++++++++--
 .../JavaObjects/JavaCacheEntryEventFilter.cs    |  7 ++++--
 .../Common/PlatformJavaObjectFactoryProxy.cs    | 17 ++++++++++++---
 5 files changed, 57 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5ac55406/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 dc49577..37457b7 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
@@ -26,8 +26,12 @@ import javax.cache.event.CacheEntryListenerException;
  * Test filter.
  */
 public class PlatformCacheEntryEventFilter implements CacheEntryEventSerializableFilter {
+    /** Property to be set from platform. */
+    @SuppressWarnings("FieldCanBeLocal")
+    private String startsWith = "-";
+
     /** {@inheritDoc} */
     @Override public boolean evaluate(CacheEntryEvent event) throws CacheEntryListenerException
{
-        return ((String)event.getValue()).startsWith("valid");
+        return ((String)event.getValue()).startsWith(startsWith);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5ac55406/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
index e888a5d..0ab9d9e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterQueryTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/MixedClusterQueryTest.cs
@@ -77,23 +77,24 @@ namespace Apache.Ignite.Core.Tests.Compute
             var cache = ignite.GetOrCreateCache<int, string>("qry");
 
             var pred = JavaObjectFactory.CreateCacheEntryEventFilter<int, string>(
-                "org.apache.ignite.platform.PlatformCacheEntryEventFilter");
+                "org.apache.ignite.platform.PlatformCacheEntryEventFilter",
+                new Dictionary<string, object> {{"startsWith", "valid"}});
 
             var qry = new ContinuousQuery<int, string>(new QueryListener(), pred);
 
             using (cache.QueryContinuous(qry))
             {
-                QueryListener.Event = null;
-
-                cache[1] = "validValue";
-
-                Assert.AreEqual(cache[1], QueryListener.Event.Value);
-
-                QueryListener.Event = null;
-
-                cache[2] = "invalidValue";
+                // 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);
 
-                Assert.IsNull(QueryListener.Event);
+                    QueryListener.Event = null;
+                    cache[i] = "invalidValue";
+                    Assert.IsNull(QueryListener.Event);
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5ac55406/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaObjectFactory.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaObjectFactory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaObjectFactory.cs
index 0aebda0..84cb32f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaObjectFactory.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaObjectFactory.cs
@@ -17,6 +17,7 @@
 
 namespace Apache.Ignite.Core.Common
 {
+    using System.Collections.Generic;
     using Apache.Ignite.Core.Cache.Event;
     using Apache.Ignite.Core.Impl.Common.JavaObjects;
 
@@ -31,10 +32,28 @@ namespace Apache.Ignite.Core.Common
         /// <typeparam name="TK">Key type.</typeparam>
         /// <typeparam name="TV">Value type.</typeparam>
         /// <param name="className">Name of the class.</param>
-        /// <returns>Cache event filter that delegates to specified Java class.</returns>
+        /// <returns>
+        /// Cache event filter that delegates to specified Java class.
+        /// </returns>
         public static ICacheEntryEventFilter<TK, TV> CreateCacheEntryEventFilter<TK,
TV>(string className)
         {
-            return new JavaCacheEntryEventFilter<TK, TV>(className);
+            return CreateCacheEntryEventFilter<TK, TV>(className, null);
+        }
+
+        /// <summary>
+        /// Creates the cache event filter that delegates to specified Java class.
+        /// </summary>
+        /// <typeparam name="TK">Key type.</typeparam>
+        /// <typeparam name="TV">Value type.</typeparam>
+        /// <param name="className">Name of the class.</param>
+        /// <param name="properties">The properties to set on the Java object.</param>
+        /// <returns>
+        /// Cache event filter that delegates to specified Java class.
+        /// </returns>
+        public static ICacheEntryEventFilter<TK, TV> CreateCacheEntryEventFilter<TK,
TV>(string className, 
+            IDictionary<string, object> properties)
+        {
+            return new JavaCacheEntryEventFilter<TK, TV>(className, properties);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5ac55406/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/JavaObjects/JavaCacheEntryEventFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/JavaObjects/JavaCacheEntryEventFilter.cs
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/JavaObjects/JavaCacheEntryEventFilter.cs
index 13dc14c..a3d3901 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/JavaObjects/JavaCacheEntryEventFilter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/JavaObjects/JavaCacheEntryEventFilter.cs
@@ -18,6 +18,7 @@
 namespace Apache.Ignite.Core.Impl.Common.JavaObjects
 {
     using System;
+    using System.Collections.Generic;
     using Apache.Ignite.Core.Cache.Event;
 
     /// <summary>
@@ -34,10 +35,12 @@ namespace Apache.Ignite.Core.Impl.Common.JavaObjects
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="JavaCacheEntryEventFilter{TK,
TV}"/> class.
+        /// Initializes a new instance of the <see cref="JavaCacheEntryEventFilter{TK,
TV}" /> class.
         /// </summary>
         /// <param name="className">Name of the class.</param>
-        public JavaCacheEntryEventFilter(string className) : base(FactoryType.Default, null,
className)
+        /// <param name="properties">The properties.</param>
+        public JavaCacheEntryEventFilter(string className, IDictionary<string, object>
properties) 
+            : base(FactoryType.Default, null, className, properties)
         {
             // No-op.
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5ac55406/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PlatformJavaObjectFactoryProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PlatformJavaObjectFactoryProxy.cs
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PlatformJavaObjectFactoryProxy.cs
index c0ae298..89b2891 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PlatformJavaObjectFactoryProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PlatformJavaObjectFactoryProxy.cs
@@ -46,7 +46,7 @@ namespace Apache.Ignite.Core.Impl.Common
         private readonly object _payload;
 
         /** Properties to set */
-        private IDictionary<string, object> _properties;
+        private readonly IDictionary<string, object> _properties;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="PlatformJavaObjectFactoryProxy"
/> class.
@@ -81,7 +81,18 @@ namespace Apache.Ignite.Core.Impl.Common
             w.WriteString(_factoryClassName);
             w.WriteObject(_payload);
 
-            w.WriteInt(0);  // TODO: Properties
+            if (_properties != null)
+            {
+                w.WriteInt(_properties.Count);
+
+                foreach (var pair in _properties)
+                {
+                    w.WriteString(pair.Key);
+                    w.WriteObject(pair.Value);
+                }
+            }
+            else
+                w.WriteInt(0);
         }
 
         /// <summary>
@@ -89,7 +100,7 @@ namespace Apache.Ignite.Core.Impl.Common
         /// </summary>
         public PlatformJavaObjectFactoryProxy GetRawProxy()
         {
-            return new PlatformJavaObjectFactoryProxy(_factoryType, _factoryClassName, _payload);
+            return new PlatformJavaObjectFactoryProxy(_factoryType, _factoryClassName, _payload,
_properties);
         }
     }
 }


Mime
View raw message