# IGNITE-56 Migration of tests to IgniteCache
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f138c003 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f138c003 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f138c003 Branch: refs/heads/ignite-96-tests Commit: f138c00364d04a6615fe0c243e2914b4291f45fd Parents: 244e604 Author: sevdokimov <sevdoki...@gridgain.com> Authored: Tue Feb 10 14:17:07 2015 +0300 Committer: sevdokimov <sevdoki...@gridgain.com> Committed: Tue Feb 10 14:17:22 2015 +0300 ---------------------------------------------------------------------- .../IgniteTxTimeoutAbstractTest.java | 2 +- ...tPartitionedOnlyByteArrayValuesSelfTest.java | 25 ++-- .../dht/GridCacheAtomicNearCacheSelfTest.java | 40 +++---- .../dht/GridCacheColocatedDebugTest.java | 120 +++++++++---------- ...eColocatedOptimisticTransactionSelfTest.java | 17 ++- .../dht/GridCacheDhtEntrySelfTest.java | 28 ++--- ...GridCacheDhtEvictionNearReadersSelfTest.java | 4 +- .../dht/GridCacheDhtEvictionSelfTest.java | 11 +- .../GridCacheDhtEvictionsDisabledSelfTest.java | 4 +- .../dht/GridCacheDhtInternalEntrySelfTest.java | 19 ++- .../dht/GridCacheDhtMappingSelfTest.java | 2 +- .../dht/GridCacheDhtMultiBackupTest.java | 4 +- .../dht/GridCacheDhtPreloadBigDataSelfTest.java | 14 +-- .../dht/GridCacheDhtPreloadDelayedSelfTest.java | 32 ++--- .../GridCacheDhtPreloadDisabledSelfTest.java | 4 +- .../GridCacheDhtPreloadMessageCountTest.java | 12 +- .../dht/GridCacheDhtPreloadPutGetSelfTest.java | 4 +- .../dht/GridCacheDhtPreloadUnloadSelfTest.java | 18 +-- ...cheGroupLockPartitionedAbstractSelfTest.java | 8 +- ...ockPartitionedMultiNodeAbstractSelfTest.java | 35 +++--- ...ePartitionedNearDisabledMetricsSelfTest.java | 11 +- ...idCachePartitionedPreloadEventsSelfTest.java | 6 +- ...dCachePartitionedTopologyChangeSelfTest.java | 49 +++++--- ...ridCachePartitionedUnloadEventsSelfTest.java | 8 +- .../dht/IgniteTxReentryColocatedSelfTest.java | 5 +- ...eAtomicInvalidPartitionHandlingSelfTest.java | 7 +- .../atomic/GridCacheAtomicPreloadSelfTest.java | 12 +- ...GridCacheValueConsistencyAtomicSelfTest.java | 2 +- .../junits/common/GridCommonAbstractTest.java | 7 ++ 29 files changed, 264 insertions(+), 246 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java index bda9844..2cccd71 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java @@ -66,7 +66,7 @@ public class IgniteTxTimeoutAbstractTest extends GridCommonAbstractTest { * @return Cache. */ @Override protected <K, V> GridCache<K, V> cache(int i) { - return IGNITEs.get(i).cache(null); + throw new UnsupportedOperationException(); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java index 8dbf81e..79388c9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; +import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.cache.distributed.*; @@ -42,13 +43,13 @@ public abstract class GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest ex protected static final String CACHE_ATOMIC_OFFHEAP_TIERED = "cache_atomic_offheap_tiered"; /** Atomic caches. */ - private static GridCache<Integer, Object>[] cachesAtomic; + private static IgniteCache<Integer, Object>[] cachesAtomic; /** Atomic offheap caches. */ - private static GridCache<Integer, Object>[] cachesAtomicOffheap; + private static IgniteCache<Integer, Object>[] cachesAtomicOffheap; /** Atomic offheap caches. */ - private static GridCache<Integer, Object>[] cachesAtomicOffheapTiered; + private static IgniteCache<Integer, Object>[] cachesAtomicOffheapTiered; /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { @@ -98,14 +99,14 @@ public abstract class GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest ex int gridCnt = gridCount(); - cachesAtomic = new GridCache[gridCnt]; - cachesAtomicOffheap = new GridCache[gridCnt]; - cachesAtomicOffheapTiered = new GridCache[gridCnt]; + cachesAtomic = new IgniteCache[gridCnt]; + cachesAtomicOffheap = new IgniteCache[gridCnt]; + cachesAtomicOffheapTiered = new IgniteCache[gridCnt]; for (int i = 0; i < gridCount(); i++) { - cachesAtomic[i] = ignites[i].cache(CACHE_ATOMIC); - cachesAtomicOffheap[i] = ignites[i].cache(CACHE_ATOMIC_OFFHEAP); - cachesAtomicOffheapTiered[i] = ignites[i].cache(CACHE_ATOMIC_OFFHEAP_TIERED); + cachesAtomic[i] = ignites[i].jcache(CACHE_ATOMIC); + cachesAtomicOffheap[i] = ignites[i].jcache(CACHE_ATOMIC_OFFHEAP); + cachesAtomicOffheapTiered[i] = ignites[i].jcache(CACHE_ATOMIC_OFFHEAP_TIERED); } } @@ -151,13 +152,13 @@ public abstract class GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest ex * @param caches Caches. * @throws Exception If failed. */ - private void testAtomic0(GridCache<Integer, Object>[] caches) throws Exception { + private void testAtomic0(IgniteCache<Integer, Object>[] caches) throws Exception { byte[] val = wrap(1); - for (GridCache<Integer, Object> cache : caches) { + for (IgniteCache<Integer, Object> cache : caches) { cache.put(KEY_1, val); - for (GridCache<Integer, Object> cacheInner : caches) + for (IgniteCache<Integer, Object> cacheInner : caches) assertArrayEquals(val, (byte[])cacheInner.get(KEY_1)); cache.remove(KEY_1); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java index ae1845c..725b3de 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java @@ -161,9 +161,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { Ignite ignite0 = grid(0); - GridCache<Integer, Integer> cache0 = ignite0.cache(null); + IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); - CacheAffinity<Integer> aff = cache0.affinity(); + CacheAffinity<Integer> aff = ignite0.affinity(null); UUID id0 = ignite0.cluster().localNode().id(); @@ -224,7 +224,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { for (int i = 0; i < GRID_CNT; i++) { delay(); - GridCache<Integer, Integer> cache = grid(i).cache(null); + IgniteCache<Integer, Integer> cache = grid(i).jcache(null); for (Integer key : nearKeys.keySet()) nearKeys.put(key, val); @@ -342,7 +342,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); - CacheAffinity<Object> aff = ignite0.cache(null).affinity(); + CacheAffinity<Object> aff = ignite0.affinity(null); UUID id0 = ignite0.cluster().localNode().id(); @@ -439,21 +439,21 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { private void checkPutRemoveGet() throws Exception { Ignite ignite0 = grid(0); - GridCache<Integer, Integer> cache0 = ignite0.cache(null); + IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); Integer key = key(ignite0, NOT_PRIMARY_AND_BACKUP); cache0.put(key, key); for (int i = 0; i < GRID_CNT; i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); cache0.remove(key); cache0.put(key, key); for (int i = 0; i < GRID_CNT; i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); cache0.remove(key); } @@ -477,9 +477,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { Ignite ignite0 = grid(grid); - GridCache<Integer, Integer> cache0 = ignite0.cache(null); + IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); - CacheAffinity<Integer> aff = cache0.affinity(); + CacheAffinity<Integer> aff = ignite0.affinity(null); UUID id0 = ignite0.cluster().localNode().id(); @@ -524,7 +524,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { for (int i = 0; i < GRID_CNT; i++) { delay(); - GridCache<Integer, Integer> cache = grid(i).cache(null); + IgniteCache<Integer, Integer> cache = grid(i).jcache(null); log.info("Put [grid=" + grid(i).name() + ", val=" + val + ']'); @@ -554,7 +554,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { Ignite ignite0 = grid(0); - GridCache<Integer, Integer> cache0 = ignite0.cache(null); + IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); Integer primaryKey = key(ignite0, PRIMARY); @@ -600,9 +600,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { Ignite ignite0 = grid(0); - GridCache<Integer, Integer> cache0 = ignite0.cache(null); + IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); - CacheAffinity<Integer> aff = cache0.affinity(); + CacheAffinity<Integer> aff = ignite0.affinity(null); UUID id0 = ignite0.cluster().localNode().id(); @@ -624,8 +624,8 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { checkEntry(grid(i), nearKey, 1, false, expReaders); } - GridCache<Integer, Integer> primaryCache = G.ignite( - (String) aff.mapKeyToNode(nearKey).attribute(ATTR_GRID_NAME)).cache(null); + IgniteCache<Integer, Integer> primaryCache = G.ignite( + (String) aff.mapKeyToNode(nearKey).attribute(ATTR_GRID_NAME)).jcache(null); delay(); @@ -650,9 +650,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { private void checkReaderRemove() throws Exception { Ignite ignite0 = grid(0); - GridCache<Integer, Integer> cache0 = ignite0.cache(null); + IgniteCache<Integer, Integer> cache0 = ignite0.jcache(null); - CacheAffinity<Integer> aff = cache0.affinity(); + CacheAffinity<Integer> aff = ignite0.affinity(null); UUID id0 = ignite0.cluster().localNode().id(); @@ -675,7 +675,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { delay(); - GridCache<Integer, Integer> primaryCache = primaryNode.cache(null); + IgniteCache<Integer, Integer> primaryCache = primaryNode.jcache(null); primaryCache.put(nearKey, 2); // Put from primary, check there are no readers. @@ -735,9 +735,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest { * @return Key with properties specified by the given mode. */ private Integer key(Ignite ignite, int mode) { - GridCache<Integer, Integer> cache = ignite.cache(null); + IgniteCache<Integer, Integer> cache = ignite.jcache(null); - CacheAffinity<Integer> aff = cache.affinity(); + CacheAffinity<Integer> aff = ignite.affinity(null); Integer key = null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java index 9609cef..9338be9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java @@ -399,8 +399,8 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { assert !lock.tryLock(); - assert g0.cache(null).isLocked(key); - assert !g0.cache(null).isLockedByThread(key) : "Key can not be locked by current thread."; + assert g0.jcache(null).isLocked(key); + assert !g0.jcache(null).isLockedByThread(key) : "Key can not be locked by current thread."; unlockLatch.countDown(); unlockFut.get(); @@ -426,11 +426,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { try { for (int i = 0; i < 100; i++) - g0.cache(null).put(i, i); + g0.jcache(null).put(i, i); for (int i = 0; i < 100; i++) { - try (IgniteTx tx = g0.cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer val = (Integer) g0.cache(null).get(i); + try (IgniteTx tx = g0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + Integer val = (Integer) g0.jcache(null).get(i); assertEquals((Integer) i, val); } @@ -545,16 +545,16 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { Map<Integer, String> map = F.asMap(k0, "val" + k0, k1, "val" + k1, k2, "val" + k2); - IgniteTx tx = explicitTx ? g0.cache(null).txStart(concurrency, isolation) : null; + IgniteTx tx = explicitTx ? g0.transactions().txStart(concurrency, isolation) : null; try { if (separate) { - g0.cache(null).put(k0, "val" + k0); - g0.cache(null).put(k1, "val" + k1); - g0.cache(null).put(k2, "val" + k2); + g0.jcache(null).put(k0, "val" + k0); + g0.jcache(null).put(k1, "val" + k1); + g0.jcache(null).put(k2, "val" + k2); } else - g0.cache(null).putAll(map); + g0.jcache(null).putAll(map); if (tx != null) tx.commit(); @@ -565,26 +565,26 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { } if (separate) { - assertEquals("val" + k0, g0.cache(null).get(k0)); - assertEquals("val" + k1, g0.cache(null).get(k1)); - assertEquals("val" + k2, g0.cache(null).get(k2)); + assertEquals("val" + k0, g0.jcache(null).get(k0)); + assertEquals("val" + k1, g0.jcache(null).get(k1)); + assertEquals("val" + k2, g0.jcache(null).get(k2)); } else { - Map<Object, Object> res = g0.cache(null).getAll(map.keySet()); + Map<Object, Object> res = g0.jcache(null).getAll(map.keySet()); assertEquals(map, res); } - tx = explicitTx ? g0.cache(null).txStart(concurrency, isolation) : null; + tx = explicitTx ? g0.transactions().txStart(concurrency, isolation) : null; try { if (separate) { - g0.cache(null).remove(k0); - g0.cache(null).remove(k1); - g0.cache(null).remove(k2); + g0.jcache(null).remove(k0); + g0.jcache(null).remove(k1); + g0.jcache(null).remove(k2); } else - g0.cache(null).removeAll(map.keySet()); + g0.jcache(null).removeAll(map.keySet()); if (tx != null) tx.commit(); @@ -595,12 +595,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { } if (separate) { - assertEquals(null, g0.cache(null).get(k0)); - assertEquals(null, g0.cache(null).get(k1)); - assertEquals(null, g0.cache(null).get(k2)); + assertEquals(null, g0.jcache(null).get(k0)); + assertEquals(null, g0.jcache(null).get(k1)); + assertEquals(null, g0.jcache(null).get(k2)); } else { - Map<Object, Object> res = g0.cache(null).getAll(map.keySet()); + Map<Object, Object> res = g0.jcache(null).getAll(map.keySet()); assertTrue(res.isEmpty()); } @@ -634,15 +634,15 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { Map<Integer, String> map = F.asMap(k1, "val" + k1, k2, "val" + k2); - IgniteTx tx = explicitTx ? g0.cache(null).txStart(concurrency, isolation) : null; + IgniteTx tx = explicitTx ? g0.transactions().txStart(concurrency, isolation) : null; try { if (separate) { - g0.cache(null).put(k1, "val" + k1); - g0.cache(null).put(k2, "val" + k2); + g0.jcache(null).put(k1, "val" + k1); + g0.jcache(null).put(k2, "val" + k2); } else - g0.cache(null).putAll(map); + g0.jcache(null).putAll(map); if (tx != null) tx.commit(); @@ -653,24 +653,24 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { } if (separate) { - assertEquals("val" + k1, g0.cache(null).get(k1)); - assertEquals("val" + k2, g0.cache(null).get(k2)); + assertEquals("val" + k1, g0.jcache(null).get(k1)); + assertEquals("val" + k2, g0.jcache(null).get(k2)); } else { - Map<Object, Object> res = g0.cache(null).getAll(map.keySet()); + Map<Object, Object> res = g0.jcache(null).getAll(map.keySet()); assertEquals(map, res); } - tx = explicitTx ? g0.cache(null).txStart(concurrency, isolation) : null; + tx = explicitTx ? g0.transactions().txStart(concurrency, isolation) : null; try { if (separate) { - g0.cache(null).remove(k1); - g0.cache(null).remove(k2); + g0.jcache(null).remove(k1); + g0.jcache(null).remove(k2); } else - g0.cache(null).removeAll(map.keySet()); + g0.jcache(null).removeAll(map.keySet()); if (tx != null) tx.commit(); @@ -681,11 +681,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { } if (separate) { - assertEquals(null, g0.cache(null).get(k1)); - assertEquals(null, g0.cache(null).get(k2)); + assertEquals(null, g0.jcache(null).get(k1)); + assertEquals(null, g0.jcache(null).get(k2)); } else { - Map<Object, Object> res = g0.cache(null).getAll(map.keySet()); + Map<Object, Object> res = g0.jcache(null).getAll(map.keySet()); assertTrue(res.isEmpty()); } @@ -739,7 +739,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { Ignite g1 = grid(1); Ignite g2 = grid(2); - g0.cache(null).putAll(map); + g0.jcache(null).putAll(map); checkStore(g0, map); checkStore(g1, Collections.<Integer, String>emptyMap()); @@ -747,8 +747,8 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { clearStores(3); - try (IgniteTx tx = g0.cache(null).txStart(OPTIMISTIC, READ_COMMITTED)) { - g0.cache(null).putAll(map); + try (IgniteTx tx = g0.transactions().txStart(OPTIMISTIC, READ_COMMITTED)) { + g0.jcache(null).putAll(map); tx.commit(); @@ -816,20 +816,20 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { Map<Integer, String> map0 = F.asMap(k0, "val" + k0, k1, "val" + k1, k2, "val" + k2); - g0.cache(null).putAll(map0); + g0.jcache(null).putAll(map0); Map<Integer, String> map = F.asMap(k0, "value" + k0, k1, "value" + k1, k2, "value" + k2); - IgniteTx tx = g0.cache(null).txStart(concurrency, isolation); + IgniteTx tx = g0.transactions().txStart(concurrency, isolation); try { if (separate) { - g0.cache(null).put(k0, "value" + k0); - g0.cache(null).put(k1, "value" + k1); - g0.cache(null).put(k2, "value" + k2); + g0.jcache(null).put(k0, "value" + k0); + g0.jcache(null).put(k1, "value" + k1); + g0.jcache(null).put(k2, "value" + k2); } else - g0.cache(null).putAll(map); + g0.jcache(null).putAll(map); tx.rollback(); } @@ -838,26 +838,26 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { } if (separate) { - assertEquals("val" + k0, g0.cache(null).get(k0)); - assertEquals("val" + k1, g0.cache(null).get(k1)); - assertEquals("val" + k2, g0.cache(null).get(k2)); + assertEquals("val" + k0, g0.jcache(null).get(k0)); + assertEquals("val" + k1, g0.jcache(null).get(k1)); + assertEquals("val" + k2, g0.jcache(null).get(k2)); } else { - Map<Object, Object> res = g0.cache(null).getAll(map.keySet()); + Map<Object, Object> res = g0.jcache(null).getAll(map.keySet()); assertEquals(map0, res); } - tx = g0.cache(null).txStart(concurrency, isolation); + tx = g0.transactions().txStart(concurrency, isolation); try { if (separate) { - g0.cache(null).remove(k0); - g0.cache(null).remove(k1); - g0.cache(null).remove(k2); + g0.jcache(null).remove(k0); + g0.jcache(null).remove(k1); + g0.jcache(null).remove(k2); } else - g0.cache(null).removeAll(map.keySet()); + g0.jcache(null).removeAll(map.keySet()); tx.rollback(); } @@ -866,12 +866,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { } if (separate) { - assertEquals("val" + k0, g0.cache(null).get(k0)); - assertEquals("val" + k1, g0.cache(null).get(k1)); - assertEquals("val" + k2, g0.cache(null).get(k2)); + assertEquals("val" + k0, g0.jcache(null).get(k0)); + assertEquals("val" + k1, g0.jcache(null).get(k1)); + assertEquals("val" + k2, g0.jcache(null).get(k2)); } else { - Map<Object, Object> res = g0.cache(null).getAll(map.keySet()); + Map<Object, Object> res = g0.jcache(null).getAll(map.keySet()); assertEquals(map0, res); } @@ -970,7 +970,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { */ private static Integer forPrimary(Ignite g, int prev) { for (int i = prev + 1; i < 10000; i++) { - if (g.cache(null).affinity().mapKeyToNode(i).id().equals(g.cluster().localNode().id())) + if (g.affinity(null).mapKeyToNode(i).id().equals(g.cluster().localNode().id())) return i; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java index 168a486..5e920f7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.*; -import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -58,7 +57,7 @@ public class GridCacheColocatedOptimisticTransactionSelfTest extends GridCommonA private static Ignite[] ignites; /** Regular caches. */ - private static GridCache<Integer, String>[] caches; + private static IgniteCache<Integer, String>[] caches; /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { @@ -93,12 +92,12 @@ public class GridCacheColocatedOptimisticTransactionSelfTest extends GridCommonA @SuppressWarnings("unchecked") @Override protected void beforeTest() throws Exception { ignites = new Ignite[GRID_CNT]; - caches = new GridCache[GRID_CNT]; + caches = new IgniteCache[GRID_CNT]; for (int i = 0; i < GRID_CNT; i++) { ignites[i] = startGrid(i); - caches[i] = ignites[i].cache(CACHE); + caches[i] = ignites[i].jcache(CACHE); } } @@ -116,8 +115,8 @@ public class GridCacheColocatedOptimisticTransactionSelfTest extends GridCommonA * @throws Exception If failed. */ public void testOptimisticTransaction() throws Exception { - for (GridCache<Integer, String> cache : caches) { - IgniteTx tx = cache.txStart(OPTIMISTIC, REPEATABLE_READ); + for (IgniteCache<Integer, String> cache : caches) { + IgniteTx tx = cache.unwrap(Ignite.class).transactions().txStart(OPTIMISTIC, REPEATABLE_READ); try { cache.put(KEY, VAL); @@ -128,8 +127,8 @@ public class GridCacheColocatedOptimisticTransactionSelfTest extends GridCommonA tx.close(); } - for (GridCache<Integer, String> cacheInner : caches) { - tx = cacheInner.txStart(OPTIMISTIC, REPEATABLE_READ); + for (IgniteCache<Integer, String> cacheInner : caches) { + tx = cacheInner.unwrap(Ignite.class).transactions().txStart(OPTIMISTIC, REPEATABLE_READ); try { assert F.eq(VAL, cacheInner.get(KEY)); @@ -141,7 +140,7 @@ public class GridCacheColocatedOptimisticTransactionSelfTest extends GridCommonA } } - tx = cache.txStart(OPTIMISTIC, REPEATABLE_READ); + tx = cache.unwrap(Ignite.class).transactions().txStart(OPTIMISTIC, REPEATABLE_READ); try { cache.remove(KEY); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java index e36363f..e3c4e20 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java @@ -110,7 +110,7 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { } for (int i = 0; i < GRID_CNT; i++) { - IgniteTx tx = grid(i).cache(null).tx(); + IgniteTx tx = grid(i).transactions().tx(); if (tx != null) tx.close(); @@ -121,8 +121,8 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { * @param g Grid. * @return Near cache. */ - private GridCache<Integer, String> near(Ignite g) { - return g.cache(null); + private IgniteCache<Integer, String> near(Ignite g) { + return g.jcache(null); } /** @@ -151,8 +151,8 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { ClusterNode primary = t.get1(); ClusterNode other = t.get2(); - GridCache<Integer, String> near0 = near(grid(primary.id())); - GridCache<Integer, String> near1 = near(grid(other.id())); + IgniteCache<Integer, String> near0 = near(grid(primary.id())); + IgniteCache<Integer, String> near1 = near(grid(other.id())); assert near0 != near1; @@ -178,12 +178,12 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { assert e0.readers().contains(other.id()); assert e1 == null || e1.readers().isEmpty(); - assert !near0.clearLocally(key); + assert !internalCache(near0).clearLocally(key); - assertEquals(1, near0.size()); + assertEquals(1, near0.localSize()); assertEquals(1, dht0.size()); - assertEquals(1, near1.size()); + assertEquals(1, near1.localSize()); assertEquals(0, dht1.size()); } @@ -196,8 +196,8 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { ClusterNode primary = t.get1(); ClusterNode other = t.get2(); - GridCache<Integer, String> near0 = near(grid(primary.id())); - GridCache<Integer, String> near1 = near(grid(other.id())); + IgniteCache<Integer, String> near0 = near(grid(primary.id())); + IgniteCache<Integer, String> near1 = near(grid(other.id())); assert near0 != near1; @@ -223,7 +223,7 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { assert e0.readers().contains(other.id()); assert e1 == null || e1.readers().isEmpty(); - assert near0.removex(key); + assert near0.remove(key); assertEquals(0, near0.size()); assertEquals(0, dht0.size()); @@ -242,8 +242,8 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { ClusterNode primary = t.get1(); ClusterNode other = t.get2(); - GridCache<Integer, String> near0 = near(grid(primary.id())); - GridCache<Integer, String> near1 = near(grid(other.id())); + IgniteCache<Integer, String> near0 = near(grid(primary.id())); + IgniteCache<Integer, String> near1 = near(grid(other.id())); assert near0 != near1; @@ -291,7 +291,7 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { * @return For the given key pair {primary node, some other node}. */ private IgniteBiTuple<ClusterNode, ClusterNode> getNodes(Integer key) { - CacheAffinity<Integer> aff = grid(0).<Integer, Object>cache(null).affinity(); + CacheAffinity<Integer> aff = grid(0).affinity(null); int part = aff.partition(key); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java index 1a02656..6c276b3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java @@ -168,7 +168,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT * @return Affinity. */ private CacheConsistentHashAffinityFunction affinity(int idx) { - return (CacheConsistentHashAffinityFunction)grid(idx).cache(null).configuration().getAffinity(); + return (CacheConsistentHashAffinityFunction)grid(idx).jcache(null).configuration().getAffinity(); } /** @@ -279,7 +279,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT // Evict on primary node. // It will trigger dht eviction and eviction on backup node. - grid(primary).cache(null).evict(key); + grid(primary).jcache(null).evict(key); futOther.get(3000); futBackup.get(3000); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java index 0154b3b..923515f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java @@ -162,7 +162,7 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest { * @return Affinity. */ private CacheConsistentHashAffinityFunction affinity(int idx) { - return (CacheConsistentHashAffinityFunction)grid(idx).cache(null).configuration().getAffinity(); + return (CacheConsistentHashAffinityFunction)grid(idx).jcache(null).configuration().getAffinity(); } /** @@ -251,7 +251,7 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest { // Evict on primary node. // It should trigger dht eviction and eviction on backup node. - assert grid(primary).cache(null).evict(key); + grid(primary).jcache(null).evict(key); // Give 5 seconds for eviction event to occur on backup and primary node. futBackup.get(3000); @@ -326,11 +326,8 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest { // Evict on primary node. // Eviction of the last key should trigger queue processing. - for (Integer key : keys) { - boolean evicted = primaryIgnite.cache(null).evict(key); - - assert evicted; - } + for (Integer key : keys) + primaryIgnite.jcache(null).evict(key); // Give 5 seconds for eviction events to occur on backup and primary node. futBackup.get(3000); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java index d5c76ea..22fa8d2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java @@ -100,7 +100,7 @@ public class GridCacheDhtEvictionsDisabledSelfTest extends GridCommonAbstractTes * @throws Exception If failed. */ private void checkNodes(Ignite g) throws Exception { - GridCache<String, String> cache = g.cache("test"); + IgniteCache<String, String> cache = g.jcache("test"); for (char c = 'a'; c <= 'z'; c++) { String key = Character.toString(c); @@ -116,7 +116,7 @@ public class GridCacheDhtEvictionsDisabledSelfTest extends GridCommonAbstractTes assertNotNull(v1); assertNotNull(v2); - if (cache.affinity().mapKeyToNode(key).isLocal()) + if (affinity(cache).mapKeyToNode(key).isLocal()) assertSame(v1, v2); else assertEquals(v1, v2); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java index e3d1d12..2eb5f3b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java @@ -96,20 +96,20 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { ClusterNode other = nodes.get2(); // Create on non-primary node. - grid(other).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 1); + grid(other).jcache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 1); check(primary, other, true); // Update on primary. - grid(primary).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 2); + grid(primary).jcache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 2); // Check on non-primary. - assertEquals(2, grid(other).cache(null).get(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME))); + assertEquals(2, grid(other).jcache(null).get(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME))); check(primary, other, true); // Remove. - assert grid(other).cache(null).removex(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME)); + assert grid(other).jcache(null).remove(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME)); check(primary, other, false); } @@ -144,7 +144,7 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { * @return Atomic long value. */ private Object peekGlobal(ClusterNode node) { - return grid(node).cache(null).peek( + return grid(node).jcache(null).peek( new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME)); } @@ -154,8 +154,7 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { * @throws IgniteCheckedException In case of error. */ private Object peekNear(ClusterNode node) throws IgniteCheckedException { - return grid(node).cache(null).peek( - new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), Collections.singleton(NEAR_ONLY)); + return grid(node).jcache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.NEAR); } /** @@ -164,8 +163,8 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { * @throws IgniteCheckedException In case of error. */ private Object peekDht(ClusterNode node) throws IgniteCheckedException { - return grid(node).cache(null).peek( - new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), Collections.singleton(PARTITIONED_ONLY)); + return grid(node).jcache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.BACKUP, + CachePeekMode.PRIMARY); } /** @@ -182,7 +181,7 @@ public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest { * @return Pair {primary node, some other node}. */ private IgniteBiTuple<ClusterNode, ClusterNode> getNodes(String key) { - CacheAffinity<Object> aff = grid(0).cache(null).affinity(); + CacheAffinity<Object> aff = grid(0).affinity(null); ClusterNode primary = aff.mapKeyToNode(key); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java index a9fa59a..49ae9db 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java @@ -78,7 +78,7 @@ public class GridCacheDhtMappingSelfTest extends GridCommonAbstractTest { startGridsMultiThreaded(nodeCnt); - GridCache<Integer, Integer> cache = grid(nodeCnt - 1).cache(null); + IgniteCache<Integer, Integer> cache = grid(nodeCnt - 1).jcache(null); int kv = 1; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMultiBackupTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMultiBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMultiBackupTest.java index 806a1b8..eb26c1f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMultiBackupTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMultiBackupTest.java @@ -55,14 +55,14 @@ public class GridCacheDhtMultiBackupTest extends GridCommonAbstractTest { @Override public void applyx() throws IgniteCheckedException { X.println("Checking whether cache is empty."); - GridCache<SampleKey, SampleValue> cache = g.cache("partitioned"); + IgniteCache<SampleKey, SampleValue> cache = g.jcache("partitioned"); assert cache.isEmpty(); } } ); - GridCache<SampleKey, SampleValue> cache = g.cache("partitioned"); + IgniteCache<SampleKey, SampleValue> cache = g.jcache("partitioned"); int cnt = 0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java index 7a56c8f..36df6bf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java @@ -138,12 +138,12 @@ public class GridCacheDhtPreloadBigDataSelfTest extends GridCommonAbstractTest { Thread.sleep(10000); for (int i = 0; i < gridCnt; i++) { - GridCache<Integer, String> c = grid(i).cache(null); + IgniteCache<Integer, String> c = grid(i).jcache(null); if (backups + 1 <= gridCnt) - assert c.size() < cnt : "Cache size: " + c.size(); + assert c.localSize() < cnt : "Cache size: " + c.localSize(); else - assert c.size() == cnt; + assert c.localSize() == cnt; } } finally { @@ -184,17 +184,17 @@ public class GridCacheDhtPreloadBigDataSelfTest extends GridCommonAbstractTest { startGrid(i); for (int i = 0; i < gridCnt; i++) - info("Grid size [i=" + i + ", size=" + grid(i).cache(null).size() + ']'); + info("Grid size [i=" + i + ", size=" + grid(i).jcache(null).size() + ']'); Thread.sleep(10000); for (int i = 0; i < gridCnt; i++) { - GridCache<Integer, String> c = grid(i).cache(null); + IgniteCache<Integer, String> c = grid(i).jcache(null); if (backups + 1 <= gridCnt) - assert c.size() < cnt; + assert c.localSize() < cnt; else - assert c.size() == cnt; + assert c.localSize() == cnt; } } finally { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java index 67947be..9ca3949 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java @@ -104,7 +104,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { int cnt = KEY_CNT; - GridCache<String, Integer> c0 = g0.cache(null); + IgniteCache<String, Integer> c0 = g0.jcache(null); for (int i = 0; i < cnt; i++) c0.put(Integer.toString(i), i); @@ -112,8 +112,8 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { Ignite g1 = startGrid(1); Ignite g2 = startGrid(2); - GridCache<String, Integer> c1 = g1.cache(null); - GridCache<String, Integer> c2 = g2.cache(null); + IgniteCache<String, Integer> c1 = g1.jcache(null); + IgniteCache<String, Integer> c2 = g2.jcache(null); for (int i = 0; i < cnt; i++) assertNull(c1.peek(Integer.toString(i))); @@ -149,7 +149,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { checkMaps(false, d0, d1, d2); // Force preload. - c1.forceRepartition(); + internalCache(c1).forceRepartition(); l1.await(); @@ -160,7 +160,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { info("Beginning to wait for cache2 repartition."); // Force preload. - c2.forceRepartition(); + internalCache(c2).forceRepartition(); l2.await(); @@ -181,7 +181,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { int cnt = KEY_CNT; - GridCache<String, Integer> c0 = g0.cache(null); + IgniteCache<String, Integer> c0 = g0.jcache(null); for (int i = 0; i < cnt; i++) c0.put(Integer.toString(i), i); @@ -189,8 +189,8 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { Ignite g1 = startGrid(1); Ignite g2 = startGrid(2); - GridCache<String, Integer> c1 = g1.cache(null); - GridCache<String, Integer> c2 = g2.cache(null); + IgniteCache<String, Integer> c1 = g1.jcache(null); + IgniteCache<String, Integer> c2 = g2.jcache(null); for (int i = 0; i < cnt; i++) assertNull(c1.peek(Integer.toString(i))); @@ -251,7 +251,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { int cnt = KEY_CNT; - GridCache<String, Integer> c0 = g0.cache(null); + IgniteCache<String, Integer> c0 = g0.jcache(null); for (int i = 0; i < cnt; i++) c0.put(Integer.toString(i), i); @@ -259,8 +259,8 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { Ignite g1 = startGrid(1); Ignite g2 = startGrid(2); - GridCache<String, Integer> c1 = g1.cache(null); - GridCache<String, Integer> c2 = g2.cache(null); + IgniteCache<String, Integer> c1 = g1.jcache(null); + IgniteCache<String, Integer> c2 = g2.jcache(null); GridDhtCacheAdapter<String, Integer> d0 = dht(0); GridDhtCacheAdapter<String, Integer> d1 = dht(1); @@ -352,7 +352,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { long start = System.currentTimeMillis(); - g.cache(null).forceRepartition().get(); + internalCache(g.jcache(null)).forceRepartition().get(); info(">>> Finished preloading of empty cache in " + (System.currentTimeMillis() - start) + "ms."); } @@ -374,7 +374,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { * @return Affinity. */ private CacheAffinity<Object> affinity(Ignite g) { - return g.cache(null).affinity(); + return g.affinity(null); } /** @@ -392,13 +392,13 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { * @param c Cache. * @param keyCnt Key count. */ - private void checkCache(GridCache<String, Integer> c, int keyCnt) { - Ignite g = c.gridProjection().ignite(); + private void checkCache(IgniteCache<String, Integer> c, int keyCnt) { + Ignite g = c.unwrap(Ignite.class); for (int i = 0; i < keyCnt; i++) { String key = Integer.toString(i); - if (c.affinity().isPrimaryOrBackup(g.cluster().localNode(), key)) + if (affinity(c).isPrimaryOrBackup(g.cluster().localNode(), key)) assertEquals(Integer.valueOf(i), c.peek(key)); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java index 6aa7639..4b7d4b0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java @@ -194,7 +194,7 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest // Check all nodes. for (Ignite g : ignites) { - GridCache<Integer, String> c = g.cache(null); + IgniteCache<Integer, String> c = g.jcache(null); for (int i = 0; i < keyCnt; i++) assertNull(c.peek(i)); @@ -218,7 +218,7 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest // Check all nodes. for (Ignite gg : ignites) { - GridCache<Integer, String> c = gg.cache(null); + IgniteCache<Integer, String> c = gg.jcache(null); for (int i = 0; i < keyCnt; i++) assertNull(c.peek(i)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java index 5398701..0ee8384 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java @@ -92,7 +92,7 @@ public class GridCacheDhtPreloadMessageCountTest extends GridCommonAbstractTest int cnt = KEY_CNT; - GridCache<String, Integer> c0 = g0.cache(null); + IgniteCache<String, Integer> c0 = g0.jcache(null); for (int i = 0; i < cnt; i++) c0.put(Integer.toString(i), i); @@ -102,8 +102,8 @@ public class GridCacheDhtPreloadMessageCountTest extends GridCommonAbstractTest U.sleep(1000); - GridCache<String, Integer> c1 = g1.cache(null); - GridCache<String, Integer> c2 = g2.cache(null); + IgniteCache<String, Integer> c1 = g1.jcache(null); + IgniteCache<String, Integer> c2 = g2.jcache(null); TestCommunicationSpi spi0 = (TestCommunicationSpi)g0.configuration().getCommunicationSpi(); TestCommunicationSpi spi1 = (TestCommunicationSpi)g1.configuration().getCommunicationSpi(); @@ -122,13 +122,13 @@ public class GridCacheDhtPreloadMessageCountTest extends GridCommonAbstractTest * @param c Cache. * @param keyCnt Key count. */ - private void checkCache(GridCache<String, Integer> c, int keyCnt) { - Ignite g = c.gridProjection().ignite(); + private void checkCache(IgniteCache<String, Integer> c, int keyCnt) { + Ignite g = c.unwrap(Ignite.class); for (int i = 0; i < keyCnt; i++) { String key = Integer.toString(i); - if (c.affinity().isPrimaryOrBackup(g.cluster().localNode(), key)) + if (affinity(c).isPrimaryOrBackup(g.cluster().localNode(), key)) assertEquals(Integer.valueOf(i), c.peek(key)); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java index 438ce8c..6ac5f7d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java @@ -223,7 +223,7 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest { Ignite g1 = startGrid(1); - GridCache<Integer, Integer> cache = g1.cache(null); + IgniteCache<Integer, Integer> cache = g1.jcache(null); for (int j = 0; j < KEY_CNT; j++) { cache.put(j, j); @@ -235,7 +235,7 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest { done.set(true); for (int j = 0; j < KEY_CNT; j++) { - Cache.Entry<Integer, Integer> entry = cache.entry(j); + Cache.Entry<Integer, Integer> entry = internalCache(cache).entry(j); assert entry != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java index c411889..9bf5376 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java @@ -167,10 +167,10 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest { Thread.sleep(wait); for (int i = 0; i < gridCnt; i++) - info("Grid size [i=" + i + ", size=" + grid(i).cache(null).size() + ']'); + info("Grid size [i=" + i + ", size=" + grid(i).jcache(null).localSize() + ']'); for (int i = 0; i < gridCnt; i++) { - GridCache<Integer, String> c = grid(i).cache(null); + IgniteCache<Integer, String> c = grid(i).jcache(null); // Nothing should be unloaded since nodes are backing up each other. assert c.size() == cnt; @@ -197,9 +197,9 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest { boolean err = false; for (int i = 0; i < gridCnt; i++) { - GridCache<Integer, String> c = grid(i).cache(null); + IgniteCache<Integer, String> c = grid(i).jcache(null); - if (c.size() >= cnt) + if (c.localSize() >= cnt) err = true; } @@ -210,12 +210,12 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest { } for (int i = 0; i < gridCnt; i++) - info("Grid size [i=" + i + ", size=" + grid(i).cache(null).size() + ']'); + info("Grid size [i=" + i + ", size=" + grid(i).jcache(null).localSize() + ']'); for (int i = 0; i < gridCnt; i++) { - GridCache<Integer, String> c = grid(i).cache(null); + IgniteCache<Integer, String> c = grid(i).jcache(null); - assert c.size() < cnt; + assert c.localSize() < cnt; } } @@ -239,7 +239,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest { startGrid(i); for (int j = 0; j <= i; j++) - info("Grid size [i=" + i + ", size=" + grid(j).cache(null).size() + ']'); + info("Grid size [i=" + i + ", size=" + grid(j).jcache(null).localSize() + ']'); } long wait = 3000; @@ -282,7 +282,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest { startGrid(i); for (int j = 0; j < i; j++) - info("Grid size [i=" + i + ", size=" + grid(j).cache(null).size() + ']'); + info("Grid size [i=" + i + ", size=" + grid(j).jcache(null).localSize() + ']'); } long wait = 3000; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java index ff4b259..a5d7e71 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java @@ -113,10 +113,10 @@ public abstract class GridCacheGroupLockPartitionedAbstractSelfTest extends Grid final UUID affinityKey = primaryKeyForCache(grid(0)); - final GridCache<UUID, String> cache = grid(0).cache(null); + final IgniteCache<UUID, String> cache = grid(0).jcache(null); - try (IgniteTx tx = cache.txStartPartition(cache.affinity().partition(affinityKey), PESSIMISTIC, REPEATABLE_READ, - 0, 2)) { + try (IgniteTx tx = grid(0).transactions().txStartPartition(null, affinity(cache).partition(affinityKey), + PESSIMISTIC, REPEATABLE_READ, 0, 2)) { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { UUID key1; @@ -124,7 +124,7 @@ public abstract class GridCacheGroupLockPartitionedAbstractSelfTest extends Grid do { key1 = UUID.randomUUID(); } - while (cache.affinity().partition(key1) == cache.affinity().partition(affinityKey)); + while (affinity(cache).partition(key1) == affinity(cache).partition(affinityKey)); // Key with affinity key different from enlisted on tx start should raise exception. cache.put(key1, "val1"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java index 04d085f..81f9a1f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java @@ -58,11 +58,11 @@ public abstract class GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest ext private void checkNonLocalKey(IgniteTxConcurrency concurrency) throws Exception { final UUID key = primaryKeyForCache(grid(1)); - GridCache<Object, Object> cache = grid(0).cache(null); + IgniteCache<Object, Object> cache = grid(0).jcache(null); IgniteTx tx = null; try { - tx = cache.txStartAffinity(key, concurrency, READ_COMMITTED, 0, 2); + tx = grid(0).transactions().txStartAffinity(null, key, concurrency, READ_COMMITTED, 0, 2); cache.put(new CacheAffinityKey<>("1", key), "2"); @@ -77,7 +77,7 @@ public abstract class GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest ext if (tx != null) tx.close(); - assertNull(cache.tx()); + assertNull(grid(0).transactions().tx()); } } @@ -119,9 +119,9 @@ public abstract class GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest ext CacheAffinityKey<String> key2 = new CacheAffinityKey<>("key2", affinityKey); CacheAffinityKey<String> key3 = new CacheAffinityKey<>("key3", affinityKey); - grid(0).cache(null).put(affinityKey, "aff"); + grid(0).jcache(null).put(affinityKey, "aff"); - GridCache<CacheAffinityKey<String>, String> cache = grid(0).cache(null); + IgniteCache<CacheAffinityKey<String>, String> cache = grid(0).jcache(null); cache.putAll(F.asMap( key1, "val1", @@ -132,7 +132,7 @@ public abstract class GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest ext Ignite reader = null; for (int i = 0; i < gridCount(); i++) { - if (!grid(i).cache(null).affinity().isPrimaryOrBackup(grid(i).localNode(), affinityKey)) + if (!grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), affinityKey)) reader = grid(i); } @@ -142,19 +142,20 @@ public abstract class GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest ext // Add reader. if (touchAffKey) - assertEquals("aff", reader.cache(null).get(affinityKey)); + assertEquals("aff", reader.jcache(null).get(affinityKey)); - assertEquals("val1", reader.cache(null).get(key1)); - assertEquals("val2", reader.cache(null).get(key2)); - assertEquals("val3", reader.cache(null).get(key3)); + assertEquals("val1", reader.jcache(null).get(key1)); + assertEquals("val2", reader.jcache(null).get(key2)); + assertEquals("val3", reader.jcache(null).get(key3)); if (nearEnabled()) { - assertEquals("val1", reader.cache(null).peek(key1)); - assertEquals("val2", reader.cache(null).peek(key2)); - assertEquals("val3", reader.cache(null).peek(key3)); + assertEquals("val1", reader.jcache(null).peek(key1)); + assertEquals("val2", reader.jcache(null).peek(key2)); + assertEquals("val3", reader.jcache(null).peek(key3)); } - try (IgniteTx tx = cache.txStartAffinity(affinityKey, concurrency, READ_COMMITTED, 0, 3)) { + try (IgniteTx tx = grid(0).transactions() + .txStartAffinity(null, affinityKey, concurrency, READ_COMMITTED, 0, 3)) { cache.putAll(F.asMap( key1, "val01", key2, "val02", @@ -165,9 +166,9 @@ public abstract class GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest ext } if (nearEnabled()) { - assertEquals("val01", reader.cache(null).peek(key1)); - assertEquals("val02", reader.cache(null).peek(key2)); - assertEquals("val03", reader.cache(null).peek(key3)); + assertEquals("val01", reader.jcache(null).peek(key1)); + assertEquals("val02", reader.jcache(null).peek(key2)); + assertEquals("val03", reader.jcache(null).peek(key3)); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java index cbc677b..ddf1b1f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java @@ -34,6 +34,7 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb /** */ private static final int GRID_CNT = 2; + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); @@ -76,7 +77,7 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb * @throws Exception If failed. */ public void _testGettingRemovedKey() throws Exception { - GridCache<Integer, Integer> cache = grid(0).cache(null); + IgniteCache<Integer, Integer> cache = grid(0).jcache(null); cache.put(0, 0); @@ -84,14 +85,14 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb Ignite g = grid(i); // TODO: getting of removed key will produce 3 inner read operations. - g.cache(null).removeAll(); + g.jcache(null).removeAll(); // TODO: getting of removed key will produce inner write and 4 inner read operations. //g.cache(null).remove(0); - assert g.cache(null).isEmpty(); + assert g.jcache(null).isEmpty(); - g.cache(null).mxBean().clear(); + g.jcache(null).mxBean().clear(); } assertNull("Value is not null for key: " + 0, cache.get(0)); @@ -103,7 +104,7 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb long misses = 0; for (int i = 0; i < gridCount(); i++) { - CacheMetrics m = grid(i).cache(null).metrics(); + CacheMetrics m = grid(i).jcache(null).metrics(); removes += m.getCacheRemovals(); reads += m.getCacheGets(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java index affdb58..0408ca3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java @@ -100,7 +100,7 @@ public class GridCachePartitionedPreloadEventsSelfTest extends GridCachePreloadE Collection<Integer> keys = new HashSet<>(); - GridCache<Integer, String> cache = g1.cache(null); + IgniteCache<Integer, String> cache = g1.jcache(null); for (int i = 0; i < 100; i++) { keys.add(i); @@ -109,14 +109,14 @@ public class GridCachePartitionedPreloadEventsSelfTest extends GridCachePreloadE Ignite g2 = startGrid("g2"); - Map<ClusterNode, Collection<Object>> keysMap = g1.cache(null).affinity().mapKeysToNodes(keys); + Map<ClusterNode, Collection<Object>> keysMap = g1.affinity(null).mapKeysToNodes(keys); Collection<Object> g2Keys = keysMap.get(g2.cluster().localNode()); assertNotNull(g2Keys); assertFalse("There are no keys assigned to g2", g2Keys.isEmpty()); for (Object key : g2Keys) - g2.cache(null).put(key, "changed val"); + g2.jcache(null).put(key, "changed val"); Collection<Event> evts = g2.events().localQuery(F.<Event>alwaysTrue(), EVT_CACHE_PRELOAD_OBJECT_LOADED); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java index 6d461d2..42b74c7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java @@ -34,8 +34,10 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; import org.apache.ignite.transactions.*; +import javax.cache.*; import java.util.*; import java.util.concurrent.*; +import java.util.concurrent.locks.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; @@ -149,8 +151,11 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra futs.add(multithreadedAsync(new Runnable() { @Override public void run() { try { + Lock lock = node.jcache(null).lock(key); + + lock.lock(); + try { - node.jcache(null).lock(key).lock(); info(">>> Acquired explicit lock for key: " + key); @@ -158,16 +163,22 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra info(">>> Acquiring explicit lock for key: " + key * 10); - node.jcache(null).lock(key * 10).lock(); + Lock lock10 = node.jcache(null).lock(key * 10); + + lock10.lock(); - info(">>> Releasing locks [key1=" + key + ", key2=" + key * 10 + ']'); + try { + info(">>> Releasing locks [key1=" + key + ", key2=" + key * 10 + ']'); + } + finally { + lock10.unlock(); + } } finally { - node.cache(null).unlock(key * 10); - node.cache(null).unlock(key); + lock.unlock(); } } - catch (IgniteCheckedException e) { + catch (CacheException e) { info(">>> Failed to perform lock [key=" + key + ", e=" + e + ']'); } catch (InterruptedException ignored) { @@ -248,10 +259,10 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra for (final Integer key : keysMap.values()) { futs.add(multithreadedAsync(new Runnable() { @Override public void run() { - GridCache<Integer, Integer> cache = node.cache(null); + IgniteCache<Integer, Integer> cache = node.jcache(null); try { - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.put(key, key); info(">>> Locked key, waiting for latch: " + key); @@ -261,7 +272,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra tx.commit(); } } - catch (IgniteCheckedException e) { + catch (CacheException e) { info("Failed to run tx for key [key=" + key + ", e=" + e + ']'); } catch (InterruptedException ignored) { @@ -317,12 +328,12 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra for (final Ignite g : nodes) { txFuts.add(multithreadedAsync(new Runnable() { @Override public void run() { - GridCache<Integer, Integer> cache = g.cache(null); + IgniteCache<Integer, Integer> cache = g.jcache(null); int key = (int)Thread.currentThread().getId(); try { - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = g.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { // This method should block until all previous transactions are completed. cache.put(key, key); @@ -331,7 +342,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra tx.commit(); } } - catch (IgniteCheckedException e) { + catch (CacheException e) { info(">>> Failed to execute tx on new topology [key=" + key + ", e=" + e + ']'); } } @@ -402,10 +413,10 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra for (final Integer key : keysMap.values()) { futs.add(multithreadedAsync(new Runnable() { @Override public void run() { - GridCache<Integer, Integer> cache = node.cache(null); + IgniteCache<Integer, Integer> cache = node.jcache(null); try { - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.put(key, key); commitLatch.await(); @@ -413,7 +424,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra tx.commit(); } } - catch (IgniteCheckedException e) { + catch (CacheException e) { info("Failed to run tx for key [key=" + key + ", e=" + e + ']'); } catch (InterruptedException ignored) { @@ -453,19 +464,19 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra for (final Ignite g : nodes) { txFuts.add(multithreadedAsync(new Runnable() { @Override public void run() { - GridCache<Integer, Integer> cache = g.cache(null); + IgniteCache<Integer, Integer> cache = g.jcache(null); int key = (int)Thread.currentThread().getId(); try { - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = g.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { // This method should block until all previous transactions are completed. cache.put(key, key); tx.commit(); } } - catch (IgniteCheckedException e) { + catch (CacheException e) { info(">>> Failed to execute tx on new topology [key=" + key + ", e=" + e + ']'); } } @@ -555,7 +566,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra private List<Integer> partitions(Ignite node, int partType) { List<Integer> res = new LinkedList<>(); - CacheAffinity<Object> aff = node.cache(null).affinity(); + CacheAffinity<Object> aff = node.affinity(null); for (int partCnt = aff.partitions(), i = 0; i < partCnt; i++) { ClusterNode locNode = node.cluster().localNode(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java index dd78950..f8c41f0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java @@ -75,7 +75,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract Collection<Integer> allKeys = new ArrayList<>(100); - GridCache<Integer, String> cache = g1.cache(null); + IgniteCache<Integer, String> cache = g1.jcache(null); for (int i = 0; i < 100; i++) { cache.put(i, "val"); @@ -84,7 +84,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract Ignite g2 = startGrid("g2"); - Map<ClusterNode, Collection<Object>> keysMap = g1.cache(null).affinity().mapKeysToNodes(allKeys); + Map<ClusterNode, Collection<Object>> keysMap = g1.affinity(null).mapKeysToNodes(allKeys); Collection<Object> g2Keys = keysMap.get(g2.cluster().localNode()); assertNotNull(g2Keys); @@ -115,7 +115,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract CacheEvent cacheEvt = ((CacheEvent)evt); assertEquals(EVT_CACHE_PRELOAD_OBJECT_UNLOADED, cacheEvt.type()); - assertEquals(g.cache(null).name(), cacheEvt.cacheName()); + assertEquals(g.jcache(null).getName(), cacheEvt.cacheName()); assertEquals(g.cluster().localNode().id(), cacheEvt.node().id()); assertEquals(g.cluster().localNode().id(), cacheEvt.eventNode().id()); assertTrue("Unexpected key: " + cacheEvt.key(), keys.contains(cacheEvt.key())); @@ -144,7 +144,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract } })); - assertEquals(g.cache(null).name(), unloadEvt.cacheName()); + assertEquals(g.jcache(null).getName(), unloadEvt.cacheName()); assertEquals(g.cluster().localNode().id(), unloadEvt.node().id()); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java index 61f8f63..8b49c10 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; +import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.processors.cache.*; @@ -43,10 +44,10 @@ public class IgniteTxReentryColocatedSelfTest extends IgniteTxReentryAbstractSel @Override protected int testKey() { int key = 0; - GridCache<Object, Object> cache = grid(0).cache(null); + IgniteCache<Object, Object> cache = grid(0).jcache(null); while (true) { - Collection<ClusterNode> nodes = cache.affinity().mapKeyToPrimaryAndBackups(key); + Collection<ClusterNode> nodes = affinity(cache).mapKeyToPrimaryAndBackups(key); if (nodes.contains(grid(0).localNode())) key++;