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-565: remove GridCache from tests.
Date Tue, 24 Mar 2015 10:35:20 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-565 83fdf7b99 -> f9dcda068


#ignite-565: remove GridCache from tests.


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

Branch: refs/heads/ignite-565
Commit: f9dcda0684137e66ace39b719b9ea82b044cf5bb
Parents: 83fdf7b
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Tue Mar 24 13:35:09 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Tue Mar 24 13:35:09 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteCache.java     |  2 +-
 .../processors/cache/IgniteCacheProxy.java      |  2 +-
 .../cache/GridCacheAbstractSelfTest.java        | 20 ++++++--------------
 .../GridCacheOffHeapTieredAbstractSelfTest.java |  4 ++--
 .../GridCacheOnCopyFlagAbstractSelfTest.java    |  6 +++---
 .../near/GridCacheNearEvictionSelfTest.java     |  4 ++--
 .../near/GridCacheNearMetricsSelfTest.java      |  2 +-
 ...ePartitionedMultiThreadedPutGetSelfTest.java |  4 ++--
 .../GridCacheReplicatedPreloadSelfTest.java     |  2 +-
 .../eviction/GridCacheEvictionAbstractTest.java |  6 +++---
 .../junits/common/GridCommonAbstractTest.java   | 18 +-----------------
 11 files changed, 23 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index f5ce8a6..8358749 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -415,7 +415,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K,
V>, IgniteAsyncS
      *
      * @param keys Keys to clear.
      */
-    public void localClearAll(Set<K> keys);
+    public void localClearAll(Set<? extends K> keys);
 
     /** {@inheritDoc} */
     @IgniteAsyncSupported

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 2b297ef..22bfe39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -1072,7 +1072,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
     }
 
     /** {@inheritDoc} */
-    @Override public void localClearAll(Set<K> keys) {
+    @Override public void localClearAll(Set<? extends K> keys) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index a680423..7d22390 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -119,31 +119,23 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
                                 @Override public boolean applyx() throws IgniteCheckedException
{
                                     jcache(fi).removeAll();
 
-                                    GridCache<Object, Object> cache = internalCache(fi);
+                                    IgniteCache<Object, Object> cache = grid(fi).cache(null);
 
                                     // Fix for tests where mapping was removed at primary
node
                                     // but was not removed at others.
                                     // removeAll() removes mapping only when it presents
at a primary node.
                                     // To remove all mappings used force remove by key.
                                     if (cache.size() > 0) {
-                                        for (Object k : cache.keySet())
-                                            cache.remove(k);
+                                        for (Cache.Entry<Object, Object> k : cache.localEntries())
+                                            cache.remove(k.getKey());
                                     }
 
                                     if (offheapTiered(cache)) {
-                                        Iterator it = cache.offHeapIterator();
-
-                                        while (it.hasNext()) {
-                                            it.next();
-
-                                            it.remove();
-                                        }
-
-                                        if (cache.offHeapIterator().hasNext())
-                                            return false;
+                                        for (Cache.Entry<Object, Object> e : cache.localEntries(CachePeekMode.OFFHEAP))
+                                            cache.remove(e.getKey());
                                     }
 
-                                    return cache.isEmpty();
+                                    return cache.localSize() == 0;
                                 }
                             },
                             getTestTimeout()));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
index 6d4e0e9..609e0b2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
@@ -566,7 +566,7 @@ public abstract class GridCacheOffHeapTieredAbstractSelfTest extends GridCacheAb
         IgniteCache<Integer, Integer> c = grid(0).cache(null);
 
         for (int i = 0; i < gridCount(); i++) {
-            assertEquals("Unexpected entries for grid: " + i, 0, internalCache(i).offHeapEntriesCount());
+            assertEquals("Unexpected entries for grid: " + i, 0, grid(i).cache(null).localSize(CachePeekMode.OFFHEAP));
 
             assertEquals("Unexpected offheap size for grid: " + i, 0, internalCache(i).offHeapAllocatedSize());
         }
@@ -586,7 +586,7 @@ public abstract class GridCacheOffHeapTieredAbstractSelfTest extends GridCacheAb
         assertNull(c.localPeek(key, CachePeekMode.ONHEAP));
 
         for (int i = 0; i < gridCount(); i++) {
-            assertEquals("Unexpected entries for grid: " + i, 0, internalCache(i).offHeapEntriesCount());
+            assertEquals("Unexpected entries for grid: " + i, 0, grid(i).cache(null).localSize(CachePeekMode.OFFHEAP));
 
             assertEquals("Unexpected offheap size for grid: " + i, 0, internalCache(i).offHeapAllocatedSize());
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
index 3ef8dc3..0f25fc1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
@@ -144,7 +144,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
 
             cache.put(key, val);
 
-            Cache.Entry<Object, Object> entry = internalCache(0).entrySet().iterator().next();
+            Cache.Entry<Object, Object> entry = grid(0).cache(null).localEntries().iterator().next();
 
             // Check thar internal entry wasn't changed.
             assertEquals(i, ((TestKey)entry.getKey()).field());
@@ -180,7 +180,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
 
             cache.put(key, newTestVal);
 
-            entry = internalCache(0).entrySet().iterator().next();
+            entry = grid(0).cache(null).localEntries().iterator().next();
 
             // Check thar internal entry wasn't changed.
             assertEquals(i, ((TestKey)entry.getKey()).field());
@@ -252,7 +252,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
             });
 
         // Check that entries weren't changed.
-        for (Cache.Entry<Object, Object> e : internalCache(0).entrySet()) {
+        for (Cache.Entry<Object, Object> e : grid(0).cache(null).localEntries()) {
             assertNotEquals(WRONG_VALUE, ((TestKey)e.getKey()).field());
             assertNotEquals(WRONG_VALUE, ((TestValue)e.getValue()).val());
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
index b8dafc6..11c0427 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
@@ -131,7 +131,7 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest
{
             });
 
             for (int i = 0; i < gridCnt; i++) {
-                assertEquals(cnt, internalCache(i).size());
+                assertEquals(cnt, grid(i).cache(null).size());
                 assertEquals(0, near(i).nearSize());
             }
         }
@@ -164,7 +164,7 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest
{
             });
 
             for (int i = 0; i < gridCnt; i++) {
-                final GridCache cache = internalCache(i);
+                final IgniteCache cache = grid(i).cache(null);
 
                 // Repeatedly check cache sizes because of concurrent cache updates.
                 assertTrue(GridTestUtils.waitForCondition(new PA() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
index f425812..9f1e743 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
@@ -68,7 +68,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest
{
 
             g.cache(null).removeAll();
 
-            assert internalCache(i).isEmpty();
+            assert g.cache(null).localSize() == 0;
 
             g.cache(null).mxBean().clear();
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
index 58c89b6..94e0c2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
@@ -106,9 +106,9 @@ public class GridCachePartitionedMultiThreadedPutGetSelfTest extends GridCommonA
             grid(0).cache(null).removeAll();
 
         for (int i = 0; i < GRID_CNT; i++) {
-            internalCache(i).clearLocally();
+            grid(i).cache(null).clear();
 
-            assert internalCache(i).isEmpty();
+            assert grid(i).cache(null).localSize() == 0;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
index d60d7d2..b6d43a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
@@ -449,7 +449,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
                 grid(0).cache(null).putAll(map);
 
             for (int gridIdx = 0; gridIdx < gridCnt; gridIdx++) {
-                assert internalCache(gridIdx).size() == cnt : "Actual size: " + internalCache(gridIdx).size();
+                assert grid(gridIdx).cache(null).size() == cnt : "Actual size: " + grid(gridIdx).cache(null).size();
 
                 info("Cache size is OK for grid index: " + gridIdx);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
index 7ea3be9..560061e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
@@ -168,7 +168,7 @@ public abstract class GridCacheEvictionAbstractTest<T extends CacheEvictionPolic
     /** @return Policy. */
     @SuppressWarnings({"unchecked"})
     protected T policy() {
-        return (T)internalCache().configuration().getEvictionPolicy();
+        return (T)grid().cache(null).getConfiguration(CacheConfiguration.class).getEvictionPolicy();
     }
 
     /**
@@ -177,7 +177,7 @@ public abstract class GridCacheEvictionAbstractTest<T extends CacheEvictionPolic
      */
     @SuppressWarnings({"unchecked"})
     protected T policy(int i) {
-        return (T)internalCache(i).configuration().getEvictionPolicy();
+        return (T)grid(i).cache(null).getConfiguration(CacheConfiguration.class).getEvictionPolicy();
     }
 
     /**
@@ -186,7 +186,7 @@ public abstract class GridCacheEvictionAbstractTest<T extends CacheEvictionPolic
      */
     @SuppressWarnings({"unchecked"})
     protected T nearPolicy(int i) {
-        CacheConfiguration cfg = internalCache(i).configuration();
+        CacheConfiguration cfg = grid(i).cache(null).getConfiguration(CacheConfiguration.class);
 
         NearCacheConfiguration nearCfg = cfg.getNearConfiguration();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9dcda06/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 9389018..4b53ab9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -104,22 +104,6 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     }
 
     /**
-     * @param idx Grid index.
-     * @param cacheName Cache name.
-     * @return Cache.
-     */
-    protected <K, V> GridCache<K, V> internalCache(int idx, String cacheName)
{
-        return ((IgniteKernal)grid(idx)).getCache(cacheName);
-    }
-
-    /**
-     * @return Cache.
-     */
-    protected <K, V> GridCache<K, V> internalCache() {
-        return ((IgniteKernal)grid()).getCache(null);
-    }
-
-    /**
      * @param cache Cache.
      */
     protected <K, V> GridCacheAdapter<K, V> internalCache(IgniteCache<K, V>
cache) {
@@ -544,7 +528,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @return Cache.
      */
     protected <K, V> IgniteCache<K, V> primaryCache(Object key, @Nullable String
cacheName) {
-        ClusterNode node = internalCache(0, cacheName).affinity().mapKeyToNode(key);
+        ClusterNode node = grid(0).affinity(cacheName).mapKeyToNode(key);
 
         assertNotNull(node);
 


Mime
View raw message