Repository: incubator-ignite Updated Branches: refs/heads/ignite-565 5adc4d336 -> a5be9a537
#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/a5be9a53 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a5be9a53 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a5be9a53 Branch: refs/heads/ignite-565 Commit: a5be9a53798a52f5466602e378154e18921df6ef Parents: 5adc4d3 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Tue Mar 24 18:42:50 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Tue Mar 24 18:42:50 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheOffHeapTest.java | 4 ++-- ...GridCacheValueConsistencyAbstractSelfTest.java | 2 +- .../cache/IgnitePutAllLargeBatchSelfTest.java | 8 ++++---- ...PutAllUpdateNonPreloadedPartitionSelfTest.java | 5 +++-- .../cache/IgniteTxMultiNodeAbstractTest.java | 18 +++++++++--------- .../GridCachePreloadRestartAbstractSelfTest.java | 9 --------- .../near/GridCacheNearOneNodeSelfTest.java | 2 +- .../processors/igfs/IgfsAbstractSelfTest.java | 2 +- .../processors/igfs/IgfsProcessorSelfTest.java | 16 ++++++++-------- .../processors/igfs/IgfsSizeSelfTest.java | 6 +++--- 10 files changed, 32 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java index 52076cd..647481d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java @@ -179,7 +179,7 @@ public class GridCacheOffHeapTest extends GridCommonAbstractTest { Ignite g = startGrid(); try { - GridCache<Integer, Integer> cache = ((IgniteKernal)g).internalCache(null); + GridCacheAdapter<Integer, Integer> cache = ((IgniteKernal)g).internalCache(null); // int max = 17 * 1024 * 1024; int max = Integer.MAX_VALUE; @@ -209,7 +209,7 @@ public class GridCacheOffHeapTest extends GridCommonAbstractTest { Ignite g = startGrid(); try { - final GridCache<Integer, Integer> c = ((IgniteKernal)g).internalCache(null); + final GridCacheAdapter<Integer, Integer> c = ((IgniteKernal)g).internalCache(null); final long start = System.currentTimeMillis(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java index 7877f0b..ac50099 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java @@ -300,7 +300,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach * @param g Grid to check. */ private void checkKeySet(Ignite g) { - GridCache<Object, Object> cache = ((IgniteKernal)g).internalCache(null); + GridCacheAdapter<Object, Object> cache = ((IgniteKernal)g).internalCache(null); Set<Object> keys = cache.keySet(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java index 58d177b..9d51b8d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java @@ -152,7 +152,7 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest { awaitPartitionMapExchange(); try { - GridCache<Object, Object> cache = ((IgniteKernal)grid(0)).getCache(null); + IgniteCache<Object, Object> cache = grid(0).cache(null); int keyCnt = 200; @@ -167,7 +167,7 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest { info(">>> Starting test tx."); - try (Transaction tx = cache.txStart(concurrency, TransactionIsolation.REPEATABLE_READ)) { + try (Transaction tx = grid(0).transactions().txStart(concurrency, TransactionIsolation.REPEATABLE_READ)) { Map<Integer, Integer> map = new LinkedHashMap<>(); for (int i = 0; i < keyCnt; i++) @@ -277,13 +277,13 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest { try { Map<Integer, Integer> checkMap = new HashMap<>(); - GridCache<Integer, Integer> cache = ((IgniteKernal)grid(0)).getCache(null); + IgniteCache<Integer, Integer> cache = grid(0).cache(null); for (int r = 0; r < 3; r++) { for (int i = 0; i < 10; i++) { info("Put: " + i + ", " + r); - Integer cachePrev = cache.put(i, r); + Integer cachePrev = cache.getAndPut(i, r); Integer mapPrev = checkMap.put(i, r); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java index 3b3e5e5..7371335 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; @@ -78,11 +79,11 @@ public class IgnitePutAllUpdateNonPreloadedPartitionSelfTest extends GridCommonA startGrid(GRID_CNT - 1); - GridCache<Object, Object> cache = ((IgniteKernal)grid(0)).getCache(null); + IgniteCache<Object, Object> cache = grid(0).cache(null); final int keyCnt = 100; - try (Transaction tx = cache.txStart(OPTIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { for (int k = 0; k < keyCnt; k++) cache.get(k); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java index 3d743e6..0ecc080 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; @@ -38,6 +39,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; import org.jetbrains.annotations.*; +import javax.cache.*; import java.util.*; import java.util.concurrent.atomic.*; @@ -615,7 +617,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe startGrids(GRID_CNT); try { - GridCache<String, Integer> cache = ((IgniteKernal)grid(0)).getCache(null); + IgniteCache<String, Integer> cache = grid(0).cache(null); cache.put(RMVD_CNTR_KEY, 0); @@ -626,9 +628,8 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe for (int j = 0; j < GRID_CNT; j++) assertEquals(i, grid(j).cache(null).get(String.valueOf(i))); - CacheQuery<Map.Entry<String, Integer>> qry = cache.queries().createSqlQuery(Integer.class, " _val >= 0"); - - Collection<Map.Entry<String, Integer>> entries = qry.execute().get(); + Collection<Cache.Entry<String, Integer>> entries = + cache.query(new SqlQuery<String, Integer>(Integer.class, " _val >= 0")).getAll(); assertFalse(entries.isEmpty()); @@ -656,7 +657,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe startGrids(GRID_CNT); try { - GridCache<String, Integer> cache = ((IgniteKernal)grid(0)).getCache(null); + IgniteCache<String, Integer> cache = grid(0).cache(null); cache.put(RMVD_CNTR_KEY, 0); @@ -667,9 +668,8 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe for (int j = 0; j < GRID_CNT; j++) assertEquals(i, grid(j).cache(null).get(Integer.toString(i))); - CacheQuery<Map.Entry<String, Integer>> qry = cache.queries().createSqlQuery(Integer.class, " _val >= 0"); - - Collection<Map.Entry<String, Integer>> entries = qry.execute().get(); + Collection<Cache.Entry<String, Integer>> entries = + cache.query(new SqlQuery<String, Integer>(Integer.class, " _val >= 0")).getAll(); assertFalse(entries.isEmpty()); @@ -683,7 +683,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe assertEquals(null, grid(ii).cache(null).get(Integer.toString(i))); // Check using query. - entries = qry.execute().get(); + entries = cache.query(new SqlQuery<String, Integer>(Integer.class, " _val >= 0")).getAll(); assertTrue(entries.isEmpty()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java index 22f2347..257f7fa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java @@ -207,15 +207,6 @@ public abstract class GridCachePreloadRestartAbstractSelfTest extends GridCommon } /** - * @param cache Cache. - * @return Affinity. - */ - @SuppressWarnings({"unchecked"}) - private CacheAffinityFunction affinity(GridCache<Integer, ?> cache) { - return cache.configuration().getAffinity(); - } - - /** * @param c Cache projection. */ private void affinityBeforeStop(IgniteCache<Integer, String> c) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java index 8400515..d361d91 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java @@ -122,7 +122,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest { public void testReadThrough() throws Exception { IgniteCache<Integer, String> near = jcache(); - GridCache<Integer, String> dht = dht(); + GridCacheAdapter<Integer, String> dht = dht(); String s = near.get(1); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java index 5915769..81fbce8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java @@ -787,7 +787,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { @SuppressWarnings("ConstantConditions") public void _testFormat() throws Exception { IgniteKernal grid = (IgniteKernal)G.ignite("grid"); - GridCache cache = grid.internalCache("dataCache"); + GridCacheAdapter cache = grid.internalCache("dataCache"); if (dual) create(igfsSecondary, paths(DIR, SUBDIR, DIR_NEW, SUBDIR_NEW), paths(FILE, FILE_NEW)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java index b1177e6..a0d8bfb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java @@ -63,7 +63,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { protected IgniteFileSystem igfs; /** Meta cache. */ - private GridCache<Object, Object> metaCache; + private IgniteCache<Object, Object> metaCache; /** Meta cache name. */ private String metaCacheName; @@ -80,7 +80,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { metaCacheName = cfgs[0].getMetaCacheName(); - metaCache = grid.cachex(metaCacheName); + metaCache = grid.cache(metaCacheName); } /** {@inheritDoc} */ @@ -337,8 +337,8 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { // Create directories. igfs.mkdirs(path("/A/B1/C1")); - for (Object key : metaCache.keySet()) - info("Entry in cache [key=" + key + ", val=" + metaCache.get(key) + ']'); + for (Cache.Entry<Object, Object> e : metaCache.localEntries()) + info("Entry in cache [key=" + e.getKey() + ", val=" + e.getValue() + ']'); igfs.mkdirs(path("/A/B1/C2")); igfs.mkdirs(path("/A/B1/C3")); @@ -351,8 +351,8 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { igfs.mkdirs(path("/A2/B2/C1")); igfs.mkdirs(path("/A2/B2/C2")); - for (Object key : metaCache.keySet()) - info("Entry in cache [key=" + key + ", val=" + metaCache.get(key) + ']'); + for (Cache.Entry<Object, Object> e : metaCache.localEntries()) + info("Entry in cache [key=" + e.getKey() + ", val=" + e.getValue() + ']'); // Check existence. assert igfs.exists(path("/A/B1/C1")); @@ -471,8 +471,8 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { // Create directories. igfs.mkdirs(path("/A/B1/C1")); - for (Object key : metaCache.keySet()) - info("Entry in cache [key=" + key + ", val=" + metaCache.get(key) + ']'); + for (Cache.Entry<Object, Object> e : metaCache.localEntries()) + info("Entry in cache [key=" + e.getKey() + ", val=" + metaCache.get(e.getValue()) + ']'); // Move under itself. GridTestUtils.assertThrowsInherited(log, new Callable<Object>() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a5be9a53/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java index 2087479..3a49e6c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java @@ -489,7 +489,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest { os.write(chunk((int)igfsMaxData)); os.close(); - final GridCache<IgniteUuid, IgfsFileInfo> metaCache = igfs.context().kernalContext().cache().cache( + final IgniteCache<IgniteUuid, IgfsFileInfo> metaCache = igfs.context().kernalContext().cache().jcache( igfs.configuration().getMetaCacheName()); // Start a transaction in a separate thread which will lock file ID. @@ -503,7 +503,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest { @Override public void run() { try { - try (Transaction tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = metaCache.unwrap(Ignite.class).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { metaCache.get(id); latch.await(); @@ -521,7 +521,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest { // Now add file ID to trash listing so that delete worker could "see" it. - try (Transaction tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = metaCache.unwrap(Ignite.class).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { Map<String, IgfsListingEntry> listing = Collections.singletonMap(path.name(), new IgfsListingEntry(info));