# ignite-51

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

Branch: refs/heads/ignite-368
Commit: 52c610656c9a8400d269c1aa1835e0dce46ba6b2
Parents: 1e4ce34
Author: sboikov <semen.boi...@inria.fr>
Authored: Mon Mar 9 20:18:11 2015 +0300
Committer: sboikov <semen.boi...@inria.fr>
Committed: Mon Mar 9 20:18:11 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheProjection.java       |  44 ----
 .../processors/cache/GridCacheAdapter.java      | 219 +------------------
 .../cache/GridCacheProjectionImpl.java          |  20 --
 .../processors/cache/GridCacheProxyImpl.java    |  48 ----
 .../distributed/near/GridNearCacheAdapter.java  |  41 ----
 ...chePartitionedReloadAllAbstractSelfTest.java |  60 ++---
 .../cache/GridCacheQueryLoadSelfTest.java       |  51 +----
 7 files changed, 24 insertions(+), 459 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c61065/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
index 24fd33f..d4a13ac 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
@@ -381,50 +381,6 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
     public IgniteInternalFuture<V> reloadAsync(K key);
 
     /**
-     * Reloads all currently cached keys form persistent storage.
-     * <h2 class="header">Transactions</h2>
-     * This method does not participate in transactions, however it does not 
violate
-     * cache integrity and can be used safely with or without transactions.
-     *
-     * @throws IgniteCheckedException If reloading failed.
-     */
-    public void reloadAll() throws IgniteCheckedException;
-
-    /**
-     * Asynchronously reloads all specified entries from underlying
-     * persistent storage.
-     * <h2 class="header">Transactions</h2>
-     * This method does not participate in transactions, however it does not 
violate
-     * cache integrity and can be used safely with or without transactions.
-     *
-     * @return Future which will complete whenever {@code reload} completes.
-     */
-    public IgniteInternalFuture<?> reloadAllAsync();
-
-    /**
-     * Reloads specified entries from underlying persistent storage.
-     * <h2 class="header">Transactions</h2>
-     * This method does not participate in transactions, however it does not 
violate
-     * cache integrity and can be used safely with or without transactions.
-     *
-     * @param keys Keys to reload.
-     * @throws IgniteCheckedException if reloading failed.
-     */
-    public void reloadAll(@Nullable Collection<? extends K> keys) throws 
IgniteCheckedException;
-
-    /**
-     * Asynchronously reloads all specified entries from underlying
-     * persistent storage.
-     * <h2 class="header">Transactions</h2>
-     * This method does not participate in transactions, however it does not 
violate
-     * cache integrity and can be used safely with or without transactions.
-     *
-     * @param keys Keys to reload.
-     * @return Future which will complete whenever {@code reload} completes.
-     */
-    public IgniteInternalFuture<?> reloadAllAsync(@Nullable Collection<? 
extends K> keys);
-
-    /**
      * Peeks at in-memory cached value using default {@link 
GridCachePeekMode#SMART}
      * peek mode.
      * <p>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c61065/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index f598b35..ef7ec51 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -1022,7 +1022,7 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
                 }
 
                 if (val != null)
-                    return F.t((V)val.get().value(ctx.cacheObjectContext(), 
true));
+                    return F.t(CU.<V>value(val.get(), ctx, true));
             }
         }
         catch (GridCacheEntryRemovedException ignore) {
@@ -1567,25 +1567,6 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
         return getAllAsync(keys, !ctx.config().isReadFromBackup(), /*skip 
tx*/true, null, null, taskName, true, false);
     }
 
-    /** {@inheritDoc} */
-    @Override public void reloadAll(@Nullable Collection<? extends K> keys) 
throws IgniteCheckedException {
-        reloadAll(keys, false, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void reloadAll() throws IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(LOCAL, READ));
-
-        reloadAll(keySet());
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> reloadAllAsync() {
-        ctx.denyOnFlags(F.asList(LOCAL, READ));
-
-        return reloadAllAsync(keySet());
-    }
-
     /**
      * @param keys Keys.
      * @param reload Reload flag.
@@ -1619,190 +1600,6 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
     /**
      * @param keys Keys.
      * @param ret Return flag.
-     * @return Non-{@code null} map if return flag is {@code true}.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable public Map<K, V> reloadAll(@Nullable Collection<? extends K> 
keys, boolean ret, boolean skipVals)
-        throws IgniteCheckedException {
-        UUID subjId = ctx.subjectIdPerCall(null);
-
-        String taskName = ctx.kernalContext().job().currentTaskName();
-
-        return reloadAllAsync(keys, ret, skipVals, subjId, taskName).get();
-    }
-
-    /**
-     * @param keys Keys.
-     * @param ret Return flag.
-     * @return Future.
-     */
-    public IgniteInternalFuture<Map<K, V>> reloadAllAsync(@Nullable 
Collection<? extends K> keys,
-        boolean ret,
-        boolean skipVals,
-        @Nullable UUID subjId,
-        String taskName)
-    {
-        ctx.denyOnFlag(READ);
-
-        final long topVer = ctx.affinity().affinityTopologyVersion();
-
-        // TODO IGNITE-51.
-        List<KeyCacheObject> cacheKeys = new ArrayList<>(keys.size());
-
-        if (!F.isEmpty(keys)) {
-            final String uid = CU.uuid(); // Get meta UUID for this thread.
-
-            assert keys != null;
-
-            if (keyCheck)
-                validateCacheKeys(keys);
-
-            for (K key : keys) {
-                if (key == null)
-                    continue;
-
-                KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
-
-                cacheKeys.add(cacheKey);
-
-                // Skip primary or backup entries for near cache.
-                if (ctx.isNear() && ctx.affinity().localNode(cacheKey, topVer))
-                    continue;
-
-                while (true) {
-                    try {
-                        GridCacheEntryEx entry = entryExSafe(cacheKey, topVer);
-
-                        if (entry == null)
-                            break;
-
-                        // Get version before checking filer.
-                        GridCacheVersion ver = entry.version();
-
-                        // Tag entry with current version.
-                        entry.addMeta(uid, ver);
-
-                        break;
-                    }
-                    catch (GridCacheEntryRemovedException ignore) {
-                        if (log.isDebugEnabled())
-                            log.debug("Got removed entry for reload (will 
retry): " + key);
-                    }
-                    catch (GridDhtInvalidPartitionException ignore) {
-                        if (log.isDebugEnabled())
-                            log.debug("Got invalid partition for key (will 
skip): " + key);
-
-                        break;
-                    }
-                }
-            }
-
-            final Map<K, V> map = ret ? new HashMap<K, V>(keys.size(), 1.0f) : 
null;
-
-            final Collection<KeyCacheObject> absentKeys = F.view(cacheKeys, 
CU.keyHasMeta(ctx, uid));
-
-            final Collection<KeyCacheObject> loadedKeys = new 
GridConcurrentHashSet<>();
-
-            IgniteInternalFuture<Object> readFut =
-                readThroughAllAsync(absentKeys, true, skipVals, null, subjId, 
taskName, new CI2<KeyCacheObject, Object>() {
-                    /** Version for all loaded entries. */
-                    private GridCacheVersion nextVer = ctx.versions().next();
-
-                    /** {@inheritDoc} */
-                    @Override public void apply(KeyCacheObject key, Object 
val) {
-                        loadedKeys.add(key);
-
-                        GridCacheEntryEx entry = peekEx(key);
-
-                        if (entry != null) {
-                            try {
-                                GridCacheVersion curVer = 
entry.removeMeta(uid);
-
-                                // If entry passed the filter.
-                                if (curVer != null) {
-                                    boolean wasNew = entry.isNewLocked();
-
-                                    entry.unswap();
-
-                                    CacheObject cacheVal = 
ctx.toCacheObject(val);
-
-                                    boolean set = 
entry.versionedValue(cacheVal, curVer, nextVer);
-
-                                    ctx.evicts().touch(entry, topVer);
-
-                                    if (map != null) {
-                                        if (set || wasNew)
-                                            
map.put(key.<K>value(ctx.cacheObjectContext(), false), (V)val);
-                                        else {
-                                            try {
-                                                // TODO IGNITE-51.
-                                                K k = 
key.<K>value(ctx.cacheObjectContext(), false);
-
-                                                GridTuple<V> v = peek0(false, 
k, GLOBAL);
-
-                                                if (v != null)
-                                                    map.put(k, v.get());
-                                            }
-                                            catch 
(GridCacheFilterFailedException ex) {
-                                                ex.printStackTrace();
-
-                                                assert false;
-                                            }
-                                        }
-                                    }
-
-                                    if (log.isDebugEnabled()) {
-                                        log.debug("Set value loaded from store 
into entry [set=" + set + ", " +
-                                            "curVer=" +
-                                            curVer + ", newVer=" + nextVer + 
", entry=" + entry + ']');
-                                    }
-                                }
-                                else {
-                                    if (log.isDebugEnabled()) {
-                                        log.debug("Current version was not 
found (either entry was removed or " +
-                                            "validation was not passed: " + 
entry);
-                                    }
-                                }
-                            }
-                            catch (GridCacheEntryRemovedException ignore) {
-                                if (log.isDebugEnabled()) {
-                                    log.debug("Got removed entry for reload 
(will not store reloaded entry) " +
-                                        "[entry=" + entry + ']');
-                                }
-                            }
-                            catch (IgniteCheckedException e) {
-                                throw new IgniteException(e);
-                            }
-                        }
-                    }
-                });
-
-            return readFut.chain(new CX1<IgniteInternalFuture<Object>, Map<K, 
V>>() {
-                @Override public Map<K, V> applyx(IgniteInternalFuture<Object> 
e) throws IgniteCheckedException {
-                    // Touch all not loaded keys.
-                    for (KeyCacheObject key : absentKeys) {
-                        if (!loadedKeys.contains(key)) {
-                            GridCacheEntryEx entry = peekEx(key);
-
-                            if (entry != null)
-                                ctx.evicts().touch(entry, topVer);
-                        }
-                    }
-
-                    // Make sure there were no exceptions.
-                    e.get();
-
-                    return map;
-                }
-            });
-        }
-
-        return new GridFinishedFuture<>(ctx.kernalContext(), Collections.<K, 
V>emptyMap());
-    }
-
-    /**
-     * @param keys Keys.
-     * @param ret Return flag.
      * @param skipVals Skip values flag.
      * @param subjId Subject ID.
      * @param taskName Task name.
@@ -5208,20 +5005,6 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
     }
 
     /**
-     * @param keys Keys.
-     * @return Reload future.
-     */
-    @Override public IgniteInternalFuture<?> reloadAllAsync(@Nullable 
Collection<? extends K> keys) {
-        UUID subjId = ctx.subjectIdPerCall(null);
-
-        String taskName = ctx.kernalContext().job().currentTaskName();
-
-
-
-        return reloadAllAsync(keys, false, false, subjId, taskName);
-    }
-
-    /**
      * @param key Key.
      * @return Reload future.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c61065/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
index 86ac962..342402c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
@@ -480,26 +480,6 @@ public class GridCacheProjectionImpl<K, V> implements 
GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public void reloadAll() throws IgniteCheckedException {
-        cache.reloadAll();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> reloadAllAsync() {
-        return cache.reloadAllAsync();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void reloadAll(@Nullable Collection<? extends K> keys) 
throws IgniteCheckedException {
-        cache.reloadAll(keys);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> reloadAllAsync(@Nullable 
Collection<? extends K> keys) {
-        return cache.reloadAllAsync(keys);
-    }
-
-    /** {@inheritDoc} */
     @Override public V get(K key) throws IgniteCheckedException {
         return cache.get(key, deserializePortables());
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c61065/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 88af3dd..a922d59 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -414,54 +414,6 @@ public class GridCacheProxyImpl<K, V> implements 
GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public void reloadAll() throws IgniteCheckedException {
-        GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
-
-        try {
-            delegate.reloadAll();
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> reloadAllAsync() {
-        GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
-
-        try {
-            return delegate.reloadAllAsync();
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void reloadAll(@Nullable Collection<? extends K> keys) 
throws IgniteCheckedException {
-        GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
-
-        try {
-            delegate.reloadAll(keys);
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> reloadAllAsync(@Nullable 
Collection<? extends K> keys) {
-        GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
-
-        try {
-            return delegate.reloadAllAsync(keys);
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
     @Nullable @Override public V get(K key) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c61065/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 71dd83c..ce8c995 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -204,27 +204,6 @@ public abstract class GridNearCacheAdapter<K, V> extends 
GridDistributedCacheAda
     }
 
     /** {@inheritDoc} */
-    @Override public void reloadAll(@Nullable Collection<? extends K> keys) 
throws IgniteCheckedException {
-        dht().reloadAll(keys);
-
-        super.reloadAll(keys);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public IgniteInternalFuture<?> reloadAllAsync(@Nullable 
Collection<? extends K> keys) {
-        GridCompoundFuture fut = new GridCompoundFuture(ctx.kernalContext());
-
-        fut.add(super.reloadAllAsync(keys));
-        fut.add(dht().reloadAllAsync(keys));
-
-        fut.markInitialized();
-
-        return fut;
-
-    }
-
-    /** {@inheritDoc} */
     @Override public V reload(K key)
         throws IgniteCheckedException {
         V val;
@@ -241,26 +220,6 @@ public abstract class GridNearCacheAdapter<K, V> extends 
GridDistributedCacheAda
         return val == null ? nearVal : val;
     }
 
-    /** {@inheritDoc} */
-    @Override public void reloadAll() throws IgniteCheckedException {
-        super.reloadAll();
-
-        dht().reloadAll();
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked"})
-    @Override public IgniteInternalFuture<?> reloadAllAsync() {
-        GridCompoundFuture fut = new GridCompoundFuture(ctx.kernalContext());
-
-        fut.add(super.reloadAllAsync());
-        fut.add(dht().reloadAllAsync());
-
-        fut.markInitialized();
-
-        return fut;
-    }
-
     /**
      * @param tx Transaction.
      * @param keys Keys to load.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c61065/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
index 37b5e3a..bce3072 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
@@ -19,6 +19,7 @@ package 
org.apache.ignite.internal.processors.cache.distributed;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cache.store.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
@@ -32,6 +33,7 @@ import org.apache.ignite.testframework.junits.common.*;
 import org.jdk8.backport.*;
 
 import javax.cache.configuration.*;
+import javax.cache.integration.*;
 import java.util.*;
 
 import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*;
@@ -56,7 +58,7 @@ public abstract class 
GridCachePartitionedReloadAllAbstractSelfTest extends Grid
     private final Map<Integer, String> map = new ConcurrentHashMap8<>();
 
     /** Collection of caches, one per grid node. */
-    private List<GridCache<Integer, String>> caches;
+    private List<IgniteCache<Integer, String>> caches;
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
@@ -130,7 +132,7 @@ public abstract class 
GridCachePartitionedReloadAllAbstractSelfTest extends Grid
         caches = new ArrayList<>(GRID_CNT);
 
         for (int i = 0; i < GRID_CNT; i++)
-            caches.add(((IgniteKernal)startGrid(i)).<Integer, 
String>cache(null));
+            caches.add(startGrid(i).<Integer, String>jcache(null));
 
         awaitPartitionMapExchange();
     }
@@ -180,15 +182,12 @@ public abstract class 
GridCachePartitionedReloadAllAbstractSelfTest extends Grid
     }
 
     /**
-     * Ensure that reloadAll() with disabled near cache reloads data only on a 
node
-     * on which reloadAll() has been called.
-     *
      * @throws Exception If test failed.
      */
     public void testReloadAll() throws Exception {
         // Fill caches with values.
-        for (GridCache<Integer, String> cache : caches) {
-            Iterable<Integer> keys = primaryKeysForCache(cache, 100);
+        for (IgniteCache<Integer, String> cache : caches) {
+            Iterable<Integer> keys = primaryKeys(cache, 100);
 
             info("Values [cache=" + caches.indexOf(cache) + ", size=" + 
F.size(keys.iterator()) +  ", keys=" + keys + "]");
 
@@ -196,53 +195,22 @@ public abstract class 
GridCachePartitionedReloadAllAbstractSelfTest extends Grid
                 map.put(key, "val" + key);
         }
 
-        Collection<GridCache<Integer, String>> emptyCaches = new 
ArrayList<>(caches);
+        CompletionListenerFuture fut = new CompletionListenerFuture();
 
-        for (GridCache<Integer, String> cache : caches) {
-            info("Reloading cache: " + caches.indexOf(cache));
+        caches.get(0).loadAll(map.keySet(), false, fut);
 
-            // Check data is reloaded only on the nodes on which reloadAll() 
has been called.
-            if (!nearEnabled()) {
-                for (GridCache<Integer, String> eCache : emptyCaches)
-                    assertEquals("Non-null values found in cache [cache=" + 
caches.indexOf(eCache) +
-                        ", size=" + eCache.size() + ", size=" + eCache.size() +
-                        ", entrySetSize=" + eCache.entrySet().size() + "]",
-                        0, eCache.size());
-            }
+        fut.get();
 
-            cache.reloadAll(map.keySet());
+        CacheAffinity aff = ignite(0).affinity(null);
 
+        for (IgniteCache<Integer, String> cache : caches) {
             for (Integer key : map.keySet()) {
-                if 
(cache.affinity().isPrimaryOrBackup(grid(caches.indexOf(cache)).localNode(), 
key) ||
+                if 
(aff.isPrimaryOrBackup(grid(caches.indexOf(cache)).localNode(), key) ||
                     nearEnabled())
-                    assertEquals(map.get(key), cache.peek(key));
+                    assertEquals(map.get(key), cache.localPeek(key));
                 else
-                    assertNull(cache.peek(key));
+                    assertNull(cache.localPeek(key));
             }
-
-            emptyCaches.remove(cache);
         }
     }
-
-    /**
-     * Create list of keys for which the given cache is primary.
-     *
-     * @param cache Cache.
-     * @param cnt Keys count.
-     * @return Collection of keys for which given cache is primary.
-     */
-    private Iterable<Integer> primaryKeysForCache(GridCache<Integer,String> 
cache, int cnt) {
-        Collection<Integer> found = new ArrayList<>(cnt);
-
-        for (int i = 0; i < 10000; i++) {
-            if 
(cache.affinity().isPrimary(grid(caches.indexOf(cache)).localNode(), i)) {
-                found.add(i);
-
-                if (found.size() == cnt)
-                    return found;
-            }
-        }
-
-        throw new IllegalStateException("Unable to find " + cnt + " keys as 
primary for cache.");
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52c61065/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryLoadSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryLoadSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryLoadSelfTest.java
index 7cd9785..78115e3 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryLoadSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryLoadSelfTest.java
@@ -33,8 +33,8 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.jetbrains.annotations.*;
 
-import javax.cache.*;
 import javax.cache.configuration.*;
+import javax.cache.integration.*;
 import java.io.*;
 import java.util.*;
 
@@ -254,48 +254,11 @@ public class GridCacheQueryLoadSelfTest extends 
GridCommonAbstractTest {
         for (int i = 0; i < PUT_CNT - 5; i++)
             keys[i] = i + 5;
 
-        cache.reloadAll(F.asList(keys));
+        CompletionListenerFuture fut = new CompletionListenerFuture();
 
-        assert cache.size() == PUT_CNT - 5;
-
-        Collection<Map.Entry<Integer, ValueObject>> res =
-            cache.queries().createSqlQuery(ValueObject.class, "val >= 
0").execute().get();
-
-        assert res != null;
-        assert res.size() == PUT_CNT - 5;
-        assert size(ValueObject.class) == PUT_CNT - 5;
-
-        cache.clear();
-
-        assert cache.isEmpty();
-        assertEquals(0, cache.size());
-
-        cache.reloadAll(Arrays.asList(keys));
-
-        assertEquals(PUT_CNT - 5, cache.size());
-
-        res = cache.queries().createSqlQuery(ValueObject.class, "val >= 
0").execute().get();
-
-        assert res != null;
-        assert res.size() == PUT_CNT - 5;
-        assert size(ValueObject.class) == PUT_CNT - 5;
-    }
+        grid().<Integer, Integer>jcache(null).loadAll(F.asSet(keys), true, 
fut);
 
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReloadAllAsync() throws Exception {
-        for (int i = 0; i < PUT_CNT; i++)
-            STORE_MAP.put(i, new ValueObject(i));
-
-        GridCache<Integer, ValueObject> cache = cache();
-
-        Integer[] keys = new Integer[PUT_CNT - 5];
-
-        for (int i = 0; i < PUT_CNT - 5; i++)
-            keys[i] = i + 5;
-
-        cache.reloadAllAsync(F.asList(keys)).get();
+        fut.get();
 
         assert cache.size() == PUT_CNT - 5;
 
@@ -311,7 +274,11 @@ public class GridCacheQueryLoadSelfTest extends 
GridCommonAbstractTest {
         assert cache.isEmpty();
         assertEquals(0, cache.size());
 
-        cache.reloadAllAsync(Arrays.asList(keys)).get();
+        fut = new CompletionListenerFuture();
+
+        grid().<Integer, Integer>jcache(null).loadAll(F.asSet(keys), true, 
fut);
+
+        fut.get();
 
         assertEquals(PUT_CNT - 5, cache.size());
 

Reply via email to