ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # ignite-648: fix tests (based on primaryKeysForCache)
Date Mon, 29 Jun 2015 17:17:44 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-648 cc48ec5dd -> 1146e4113


# ignite-648: fix tests (based on primaryKeysForCache)


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

Branch: refs/heads/ignite-648
Commit: 1146e41136c2ed76dc948b38b8437d0898fa2985
Parents: cc48ec5
Author: ashutak <ashutak@gridgain.com>
Authored: Mon Jun 29 20:18:31 2015 +0300
Committer: ashutak <ashutak@gridgain.com>
Committed: Mon Jun 29 20:18:31 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAbstractFullApiSelfTest.java | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1146e411/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 2986e02..483fc20 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -4009,10 +4009,31 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @param cnt Keys count.
      * @return Collection of keys for which given cache is primary.
      */
-    protected List<String> primaryKeysForCache(IgniteCache<String, Integer> cache,
int cnt, int startFrom) {
-        List<String> found = new ArrayList<>(cnt);
+    protected List<String> primaryKeysForCache(final IgniteCache<String, Integer>
cache, final int cnt, final int startFrom) {
+        Ignite grid = cache.unwrap(Ignite.class);
+
+        if (!(cache instanceof IgniteCacheProcessProxy))
+            return primaryKeysForCache0(grid.name(), cnt, startFrom);
+        else {
+            final IgniteProcessProxy proxy = (IgniteProcessProxy)grid;
+
+            final String name = proxy.name();
+
+            return proxy.remoteCompute().call(new IgniteCallable<List<String>>()
{
+                @Override public List<String> call() throws Exception {
+                    return primaryKeysForCache0(name, cnt, startFrom);
+                }
+            });
+        }
+    }
+
+    private List<String> primaryKeysForCache0(String name, int cnt, int startFrom)
{
+        List<String> found = new ArrayList<>();
+
+        IgniteEx ignite = grid(name);
+
+        final IgniteCache<String, Integer> cache = ignite.cache(null);
 
-        Ignite ignite = cache.unwrap(Ignite.class);
         Affinity<Object> affinity = ignite.affinity(cache.getName());
 
         for (int i = startFrom; i < startFrom + 100_000; i++) {


Mime
View raw message