ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [4/5] ignite git commit: ignite-db-x fix testLocalProxyInvocation
Date Mon, 23 Jan 2017 18:17:24 GMT
ignite-db-x fix testLocalProxyInvocation


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

Branch: refs/heads/ignite-3477
Commit: 3587ac673658fffaadaa19fea16a575dfb077d30
Parents: 742aa94
Author: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Authored: Mon Jan 23 20:35:02 2017 +0300
Committer: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Committed: Mon Jan 23 20:35:02 2017 +0300

----------------------------------------------------------------------
 ...eContinuousQueryAsyncFilterListenerTest.java | 10 ++++----
 .../GridServiceProcessorProxySelfTest.java      | 24 +++++++++++++++++---
 2 files changed, 27 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3587ac67/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
index 0605bc8..47e96b6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
@@ -445,7 +445,8 @@ public class CacheContinuousQueryAsyncFilterListenerTest extends GridCommonAbstr
 
                 int nodeIdx = i % NODES;
 
-                final IgniteCache cache = grid(nodeIdx).cache(ccfg.getName());
+                final String cacheName = ccfg.getName();
+                final IgniteCache cache = grid(nodeIdx).cache(cacheName);
 
                 final QueryTestKey key = NODES - 1 != nodeIdx ? affinityKey(cache) : new
QueryTestKey(1);
 
@@ -473,7 +474,7 @@ public class CacheContinuousQueryAsyncFilterListenerTest extends GridCommonAbstr
                     new IgniteBiInClosure<Ignite, CacheEntryEvent<? extends QueryTestKey,
? extends QueryTestValue>>() {
                         @Override public void apply(Ignite ignite, CacheEntryEvent<? extends
QueryTestKey,
                             ? extends QueryTestValue> e) {
-                            IgniteCache<Object, Object> cache0 = ignite.cache(cache.getName());
+                            IgniteCache<Object, Object> cache0 = ignite.cache(cacheName);
 
                             QueryTestValue val = e.getValue();
 
@@ -600,7 +601,8 @@ public class CacheContinuousQueryAsyncFilterListenerTest extends GridCommonAbstr
 
                 int nodeIdx = i % NODES;
 
-                final IgniteCache cache = grid(nodeIdx).cache(ccfg.getName());
+                final String cacheName = ccfg.getName();
+                final IgniteCache cache = grid(nodeIdx).cache(cacheName);
 
                 final QueryTestKey key = NODES - 1 != nodeIdx ? affinityKey(cache) : new
QueryTestKey(1);
 
@@ -622,7 +624,7 @@ public class CacheContinuousQueryAsyncFilterListenerTest extends GridCommonAbstr
                                     Thread.currentThread().getName().contains("callback-"));
                             }
 
-                            IgniteCache<Object, Object> cache0 = ignite.cache(cache.getName());
+                            IgniteCache<Object, Object> cache0 = ignite.cache(cacheName);
 
                             QueryTestValue val = e.getValue();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3587ac67/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
index 7b5abf5..9fd2d2c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
@@ -19,11 +19,14 @@ package org.apache.ignite.internal.processors.service;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicReference;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.services.Service;
 import org.apache.ignite.services.ServiceContext;
+import org.apache.ignite.testframework.GridTestUtils;
 
 /**
  * Service proxy test.
@@ -212,12 +215,27 @@ public class GridServiceProcessorProxySelfTest extends GridServiceProcessorAbstr
         ignite.services().deployNodeSingleton(name, new MapServiceImpl<String, Integer>());
 
         for (int i = 0; i < nodeCount(); i++) {
-            MapService<Integer, String> svc =  grid(i).services().serviceProxy(name,
MapService.class, false);
+            final int idx = i;
+
+            final AtomicReference< MapService<Integer, String>> ref = new AtomicReference<>();
+
+            //wait because after deployNodeSingleton we don't have guarantees what service
was deploy.
+            boolean wait = GridTestUtils.waitForCondition(new PA() {
+                @Override public boolean apply() {
+                    MapService<Integer, String> svc = grid(idx)
+                        .services()
+                        .serviceProxy(name, MapService.class, false);
+
+                    ref.set(svc);
+
+                    return svc instanceof Service;
+                }
+            }, 2000);
 
             // Make sure service is a local instance.
-            assertTrue("Invalid service instance [srv=" + svc + ", node=" + i + ']', svc
instanceof Service);
+            assertTrue("Invalid service instance [srv=" + ref.get() + ", node=" + i + ']',
wait);
 
-            svc.put(i, Integer.toString(i));
+            ref.get().put(i, Integer.toString(i));
         }
 
         MapService<Integer, String> map = ignite.services().serviceProxy(name, MapService.class,
false);


Mime
View raw message