#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/8481dc17 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8481dc17 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8481dc17 Branch: refs/heads/ignite-611 Commit: 8481dc170778250e46a73bfab52e63edf54e9197 Parents: b62a71a Author: ivasilinets <ivasilin...@gridgain.com> Authored: Wed Mar 25 17:29:03 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Wed Mar 25 17:29:03 2015 +0300 ---------------------------------------------------------------------- ...CacheFullTextQueryMultithreadedSelfTest.java | 4 +-- ...achePartitionedPreloadLifecycleSelfTest.java | 2 +- ...CacheReplicatedPreloadLifecycleSelfTest.java | 2 +- .../GridCacheSwapScanQueryAbstractSelfTest.java | 26 ++++++++++---------- .../ignite/testframework/GridTestUtils.java | 14 +++-------- 5 files changed, 20 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8481dc17/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java index c5b6afa..614b05d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java @@ -74,12 +74,12 @@ public class GridCacheFullTextQueryMultithreadedSelfTest extends GridCacheAbstra final int logFreq = 50; final String txt = "Value"; - final GridCache<Integer, H2TextValue> c = ((IgniteKernal)grid(0)).getCache(null); + final GridCacheAdapter<Integer, H2TextValue> c = ((IgniteKernal)grid(0)).internalCache(null); IgniteInternalFuture<?> fut1 = multithreadedAsync(new Callable() { @Override public Object call() throws Exception { for (int i = 0; i < keyCnt; i++) { - c.putx(i, new H2TextValue(txt)); + c.put(i, new H2TextValue(txt)); if (i % logFreq == 0) X.println("Stored values: " + i); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8481dc17/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java index 6c7473a..a794e78 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java @@ -174,7 +174,7 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo info("Checking '" + (i + 1) + "' nodes..."); for (int j = 0; j < G.allGrids().size(); j++) { - GridCache<Object, MyValue> c2 = ((IgniteKernal)grid(j)).getCache("two"); + GridCacheAdapter<Object, MyValue> c2 = ((IgniteKernal)grid(j)).internalCache("two"); CacheQuery<Map.Entry<Object, MyValue>> qry = c2.queries().createScanQuery(null); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8481dc17/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java index 7145d76..e6c5517 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java @@ -176,7 +176,7 @@ public class GridCacheReplicatedPreloadLifecycleSelfTest extends GridCachePreloa info("Checking '" + (i + 1) + "' nodes..."); for (int j = 0; j < G.allGrids().size(); j++) { - GridCache<Object, MyValue> c2 = ((IgniteKernal)grid(j)).getCache("two"); + GridCacheAdapter<Object, MyValue> c2 = ((IgniteKernal)grid(j)).internalCache("two"); CacheQuery<Map.Entry<Object, MyValue>> qry = c2.queries().createScanQuery(null); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8481dc17/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java index fd7e9b0..d9f357c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java @@ -115,9 +115,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA * @throws Exception If failed. */ public void testQuery() throws Exception { - checkQuery(((IgniteKernal)grid(0)).getCache(ATOMIC_CACHE_NAME)); + checkQuery(((IgniteKernal)grid(0)).internalCache(ATOMIC_CACHE_NAME)); - checkQuery(((IgniteKernal)grid(0)).getCache(TRANSACTIONAL_CACHE_NAME)); + checkQuery(((IgniteKernal)grid(0)).internalCache(TRANSACTIONAL_CACHE_NAME)); } /** @@ -125,11 +125,11 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA * @throws Exception If failed. */ @SuppressWarnings("unchecked") - private void checkQuery(GridCache cache) throws Exception { + private void checkQuery(GridCacheAdapter cache) throws Exception { final int ENTRY_CNT = 500; for (int i = 0; i < ENTRY_CNT; i++) - assertTrue(cache.putx(new Key(i), new Person("p-" + i, i))); + cache.put(new Key(i), new Person("p-" + i, i)); try { CacheQuery<Map.Entry<Key, Person>> qry = cache.queries().createScanQuery( @@ -173,7 +173,7 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA * @param expCnt Expected entries in query result. * @throws Exception If failed. */ - private void testMultithreaded(final GridCache cache, final int expCnt) throws Exception { + private void testMultithreaded(final GridCacheAdapter cache, final int expCnt) throws Exception { log.info("Starting multithreaded queries."); GridTestUtils.runMultiThreaded(new Callable<Void>() { @@ -207,9 +207,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA * @throws Exception If failed. */ public void testQueryPrimitives() throws Exception { - checkQueryPrimitives(((IgniteKernal)grid(0)).getCache(ATOMIC_CACHE_NAME)); + checkQueryPrimitives(((IgniteKernal)grid(0)).internalCache(ATOMIC_CACHE_NAME)); - checkQueryPrimitives(((IgniteKernal)grid(0)).getCache(TRANSACTIONAL_CACHE_NAME)); + checkQueryPrimitives(((IgniteKernal)grid(0)).internalCache(TRANSACTIONAL_CACHE_NAME)); } /** @@ -217,11 +217,11 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA * @throws Exception If failed. */ @SuppressWarnings("unchecked") - private void checkQueryPrimitives(GridCache cache) throws Exception { + private void checkQueryPrimitives(GridCacheAdapter cache) throws Exception { final int ENTRY_CNT = 500; for (int i = 0; i < ENTRY_CNT; i++) - assertTrue(cache.putx(String.valueOf(i), (long) i)); + cache.put(String.valueOf(i), (long) i); try { CacheQuery<Map.Entry<String, Long>> qry = cache.queries().createScanQuery( @@ -263,9 +263,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA * @throws Exception If failed. */ public void testQueryValueByteArray() throws Exception { - checkQueryValueByteArray(((IgniteKernal)grid(0)).getCache(ATOMIC_CACHE_NAME)); + checkQueryValueByteArray(((IgniteKernal)grid(0)).internalCache(ATOMIC_CACHE_NAME)); - checkQueryValueByteArray(((IgniteKernal)grid(0)).getCache(TRANSACTIONAL_CACHE_NAME)); + checkQueryValueByteArray(((IgniteKernal)grid(0)).internalCache(TRANSACTIONAL_CACHE_NAME)); } /** @@ -273,11 +273,11 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA * @throws Exception If failed. */ @SuppressWarnings("unchecked") - private void checkQueryValueByteArray(GridCache cache) throws Exception { + private void checkQueryValueByteArray(GridCacheAdapter cache) throws Exception { final int ENTRY_CNT = 100; for (int i = 0; i < ENTRY_CNT; i++) - assertTrue(cache.putx(i, new byte[i])); + cache.put(i, new byte[i]); try { CacheQuery<Map.Entry<Integer, byte[]>> qry = cache.queries().createScanQuery( http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8481dc17/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java index 27c6863..e25aaee 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java @@ -837,14 +837,6 @@ public final class GridTestUtils { * @param cache Cache. * @return Cache context. */ - public static <K, V> GridCacheContext<K, V> cacheContext(GridCache<K, V> cache) { - return ((IgniteKernal)cache.gridProjection().ignite()).<K, V>internalCache().context(); - } - - /** - * @param cache Cache. - * @return Cache context. - */ public static <K, V> GridCacheContext<K, V> cacheContext(IgniteCache<K, V> cache) { return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache().context(); } @@ -853,7 +845,7 @@ public final class GridTestUtils { * @param cache Cache. * @return Near cache. */ - public static <K, V> GridNearCacheAdapter<K, V> near(GridCache<K, V> cache) { + public static <K, V> GridNearCacheAdapter<K, V> near(IgniteCache<K, V> cache) { return cacheContext(cache).near(); } @@ -861,7 +853,7 @@ public final class GridTestUtils { * @param cache Cache. * @return DHT cache. */ - public static <K, V> GridDhtCacheAdapter<K, V> dht(GridCache<K, V> cache) { + public static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K, V> cache) { return near(cache).dht(); } @@ -875,7 +867,7 @@ public final class GridTestUtils { public static <K, V> void waitTopologyUpdate(@Nullable String cacheName, int backups, IgniteLogger log) throws Exception { for (Ignite g : Ignition.allGrids()) { - GridCache<K, V> cache = ((IgniteEx)g).cachex(cacheName); + IgniteCache<K, V> cache = ((IgniteEx)g).cache(cacheName); GridDhtPartitionTopology top = dht(cache).topology();