ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [48/50] [abbrv] incubator-ignite git commit: # IGNITE-56 Fix incorrect usage of IgniteCache.loadCache() method.
Date Fri, 06 Feb 2015 14:42:25 GMT
# IGNITE-56 Fix incorrect usage of IgniteCache.loadCache() method.


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

Branch: refs/heads/ignite-145
Commit: d227081202d76126d6aeb6827629ff2938ecbbf6
Parents: fe6b766
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Fri Feb 6 16:38:53 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Fri Feb 6 16:38:53 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheBasicStoreAbstractTest.java  | 63 ++++++++++----------
 .../colocation/GridTestLifecycleBean.java       |  3 +-
 2 files changed, 35 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d2270812/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
index 8771f33..6549e51 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
+import javax.cache.*;
 import javax.cache.configuration.*;
 import java.util.*;
 
@@ -62,7 +63,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        cache().clear();
+        jcache().clear();
 
         store.reset();
     }
@@ -310,7 +311,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
         int cnt = 1;
 
-        cache.loadCache(null, 0, cnt);
+        cache.loadCache(null, cnt);
 
         checkLastMethod("loadAllFull");
 
@@ -345,7 +346,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
                 // Accept only even numbers.
                 return key % 2 == 0;
             }
-        }, 0, cnt);
+        }, cnt);
 
         checkLastMethod("loadAllFull");
 
@@ -373,11 +374,11 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
     /** @throws Exception If test failed. */
     public void testReloadCache() throws Exception {
-        GridCache<Integer, String> cache = cache();
+        IgniteCache<Integer, String> cache = jcache();
 
-        cache.loadCache(null, 0, 0);
+        cache.loadCache(null, 0);
 
-        assert cache.isEmpty();
+        assert cache.size() == 0;
 
         checkLastMethod("loadAllFull");
 
@@ -389,7 +390,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
         assert cache.size() == 10;
 
-        cache.reloadAll();
+        cache.localLoadCache(null);
 
         checkLastMethod("loadAll");
 
@@ -414,7 +415,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
                 // Only accept even numbers.
                 return k % 2 == 0;
             }
-        }, 0, 10);
+        }, 10);
 
         checkLastMethod("loadAllFull");
 
@@ -422,18 +423,16 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
         assertEquals(5, cache.size());
 
-        cache.forEach(new CIX1<CacheEntry<Integer, String>>() {
-            @Override public void applyx(CacheEntry<Integer, String> entry) throws
IgniteCheckedException {
-                String val = entry.get();
+        for (Cache.Entry<Integer, String> entry : cache) {
+            String val = entry.getValue();
 
-                assert val != null;
-                assert val.equals(Integer.toString(entry.getKey()));
-                assert entry.getKey() % 2 == 0;
+            assert val != null;
+            assert val.equals(Integer.toString(entry.getKey()));
+            assert entry.getKey() % 2 == 0;
 
-                // Make sure that value is coming from cache, not from store.
-                checkLastMethod(null);
-            }
-        });
+            // Make sure that value is coming from cache, not from store.
+            checkLastMethod(null);
+        }
 
         // Make sure that value is coming from cache, not from store.
         checkLastMethod(null);
@@ -441,18 +440,18 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
     /** @throws Exception If test failed. */
     public void testReloadAll() throws Exception {
-        GridCache<Integer, String> cache = cache();
+        IgniteCache<Integer, String> cache = jcache();
 
-        assert cache.isEmpty();
+        assert cache.size() == 0;
 
         Map<Integer, String> vals = new HashMap<>();
 
         for (int i = 1; i <= 10; i++)
             vals.put(i, Integer.toString(i));
 
-        cache.reloadAll(vals.keySet());
+        loadAll(cache, vals.keySet(), true);
 
-        assert cache.isEmpty() : "Cache is not empty: " + cache.values();
+        assert cache.size() == 0: "Cache is not empty.";
 
         checkLastMethod("loadAll");
 
@@ -462,7 +461,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
         assert cache.size() == 10;
 
-        cache.reloadAll(vals.keySet());
+        loadAll(cache, vals.keySet(), true);
 
         checkLastMethod("loadAll");
 
@@ -483,7 +482,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
         for (int i = 1; i <= 10; i++)
             store.write(new CacheEntryImpl<>(i, "reloaded-" + i));
 
-        cache.reloadAll(vals.keySet());
+        loadAll(cache, vals.keySet(), true);
 
         checkLastMethod("loadAll");
 
@@ -505,18 +504,18 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
     /** @throws Exception If test failed. */
     @SuppressWarnings("StringEquality")
     public void testReload() throws Exception {
-        GridCache<Integer, String> cache = cache();
+        IgniteCache<Integer, String> cache = jcache();
 
-        assert cache.isEmpty();
+        assert cache.size() == 0;
 
         Map<Integer, String> vals = new HashMap<>();
 
         for (int i = 1; i <= 10; i++)
             vals.put(i, Integer.toString(i));
 
-        cache.reloadAll(vals.keySet());
+        loadAll(cache, vals.keySet(), true);
 
-        assert cache.isEmpty();
+        assert cache.size() == 0;
 
         checkLastMethod("loadAll");
 
@@ -526,7 +525,9 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
         assert cache.size() == 10;
 
-        String val = cache.reload(1);
+        load(cache, 1, true);
+
+        String val = cache.localPeek(1, CachePeekMode.ONHEAP);
 
         assert val != null;
         assert "1".equals(val);
@@ -555,7 +556,9 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
         assert cache.size() == 10;
 
         for (int i = 1; i <= 10; i++) {
-            val = cache.reload(i);
+            load(cache, i, true);
+
+            val = cache.localPeek(i, CachePeekMode.ONHEAP);
 
             checkLastMethod("load");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d2270812/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java
b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java
index 51ac184..20f086f 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java
@@ -29,13 +29,14 @@ public class GridTestLifecycleBean implements LifecycleBean {
     @IgniteInstanceResource
     private Ignite g;
 
+    /** {@inheritDoc} */
     @Override public void onLifecycleEvent(LifecycleEventType type) {
         if (type == LifecycleEventType.AFTER_GRID_START) {
             IgniteCache<GridTestKey, Long> cache = g.jcache("partitioned");
 
             assert cache != null;
 
-            cache.loadCache(null, 0, GridTestConstants.LOAD_THREADS, GridTestConstants.ENTRY_COUNT);
+            cache.loadCache(null, GridTestConstants.LOAD_THREADS, GridTestConstants.ENTRY_COUNT);
         }
     }
 }


Mime
View raw message