diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java index 11f26c1eb9285..223727c2173fe 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java @@ -431,12 +431,13 @@ public void testPutIfAbsentAsyncAvgTime() throws Exception { * @throws Exception If failed. */ public void testGetAndPutIfAbsentAsyncAvgTime() throws Exception { - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); + IgniteCache cacheAsync = cache.withAsync(); Integer key = null; for (int i = 0; i < 1000; i++) { - if (cache.affinity().isPrimary(grid(0).localNode(), i)) { + if (affinity(cache).isPrimary(grid(0).localNode(), i)) { key = i; break; @@ -445,7 +446,9 @@ public void testGetAndPutIfAbsentAsyncAvgTime() throws Exception { assertEquals(0.0f, cache.metrics().getAveragePutTime()); - IgniteInternalFuture fut = cache.putIfAbsentAsync(key, key); + cacheAsync.getAndPutIfAbsent(key, key); + + IgniteFuture fut = cache.future(); fut.get(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java index bc6780cc584ee..ca738367d5f11 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java @@ -114,10 +114,9 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest { // Preloading may happen as nodes leave, so we need to wait. new GridAbsPredicateX() { @Override public boolean applyx() throws IgniteCheckedException { - // to support remove(key) - GridCache cache = grid(fi).cache(null); + jcache(fi).removeAll(); - cache.removeAll(); + GridCache cache = internalCache(fi); // Fix for tests where mapping was removed at primary node // but was not removed at others. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java index a7d8b64ae3953..ead2f3be8b568 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java @@ -23,6 +23,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; @@ -269,7 +270,7 @@ public void checkPutAllFailoverGroupLock(boolean near, int workerCnt, int shutdo for (Ignite g : runningWorkers) { info(">>>>> " + g.jcache(CACHE_NAME).localSize()); - primaryCacheSize += g.cache(CACHE_NAME).primarySize(); + primaryCacheSize += ((IgniteKernal)g).internalCache(CACHE_NAME).primarySize(); } assertTrue(TEST_MAP_SIZE <= primaryCacheSize); 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 4f77b8dc26964..0d707b1050972 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 @@ -21,6 +21,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cache.eviction.fifo.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; @@ -180,7 +181,7 @@ private void performanceTest() throws Exception { Ignite g = startGrid(); try { - GridCache cache = g.cache(null); + GridCache cache = ((IgniteKernal)g).internalCache(null); // int max = 17 * 1024 * 1024; int max = Integer.MAX_VALUE; @@ -210,7 +211,7 @@ private void performanceMultithreadedTest() throws Exception { Ignite g = startGrid(); try { - final GridCache c = g.cache(null); + final GridCache c = ((IgniteKernal)g).internalCache(null); final long start = System.currentTimeMillis(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java index d83bc79555f7b..d5669dcd95f2f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java @@ -122,7 +122,7 @@ private void checkSwap() throws Exception { startGrid(1); - int size = grid(1).cache(null).size(); + int size = grid(1).jcache(null).localSize(); info("New node cache size: " + size); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java index f0ccce4390dce..f433c10f9f1ee 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.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.transactions.*; @@ -206,10 +207,10 @@ public void testPessimisticSerializableRollbacksNoData() throws Exception { */ private void testCommits(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, boolean put) throws Exception { - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); for (int i = 0; i < TX_CNT; i++) { - IgniteTx tx = cache.txStart(concurrency, isolation); + IgniteTx tx = grid(0).transactions().txStart(concurrency, isolation); if (put) for (int j = 0; j < keyCount(); j++) @@ -220,7 +221,7 @@ private void testCommits(IgniteTxConcurrency concurrency, IgniteTxIsolation isol for (int i = 0; i < gridCount(); i++) { IgniteTxMetrics metrics = grid(i).transactions().metrics(); - CacheMetrics cacheMetrics = grid(i).cache(null).metrics(); + CacheMetrics cacheMetrics = grid(i).jcache(null).metrics(); if (i == 0) { assertEquals(TX_CNT, metrics.txCommits()); @@ -248,10 +249,10 @@ private void testCommits(IgniteTxConcurrency concurrency, IgniteTxIsolation isol */ private void testRollbacks(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, boolean put) throws Exception { - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); for (int i = 0; i < TX_CNT; i++) { - IgniteTx tx = cache.txStart(concurrency, isolation); + IgniteTx tx = grid(0).transactions().txStart(concurrency, isolation); if (put) for (int j = 0; j < keyCount(); j++) @@ -262,7 +263,7 @@ private void testRollbacks(IgniteTxConcurrency concurrency, IgniteTxIsolation is for (int i = 0; i < gridCount(); i++) { IgniteTxMetrics metrics = grid(i).transactions().metrics(); - CacheMetrics cacheMetrics = grid(i).cache(null).metrics(); + CacheMetrics cacheMetrics = grid(i).jcache(null).metrics(); assertEquals(0, metrics.txCommits()); assertEquals(0, cacheMetrics.getCacheTxCommits()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java index a25c317173683..ef16c6edd23b5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java @@ -122,26 +122,26 @@ public void checkByteArrays() throws Exception { byte[] val = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; for (int i = 0; i < keyCnt; i++) - grid(0).cache(null).put(String.valueOf(i), val); + grid(0).jcache(null).put(String.valueOf(i), val); for (int i = 0; i < keyCnt; i++) - grid(0).cache(null).get(String.valueOf(i)); + grid(0).jcache(null).get(String.valueOf(i)); startGrid(1); if (memMode == ONHEAP_TIERED) { for (int i = 0; i < keyCnt; i++) - grid(0).cache(null).evict(String.valueOf(i)); + grid(0).jcache(null).evict(String.valueOf(i)); for (int i = 0; i < keyCnt; i++) - grid(0).cache(null).promote(String.valueOf(i)); + grid(0).jcache(null).promote(String.valueOf(i)); } startGrid(2); for (int g = 0; g < 3; g++) { for (int i = 0; i < keyCnt; i++) { - byte[] o = (byte[])grid(g).cache(null).get(String.valueOf(i)); + byte[] o = (byte[])grid(g).jcache(null).get(String.valueOf(i)); assertTrue("Got invalid value [val=" + Arrays.toString(val) + ", actual=" + Arrays.toString(o) + ']', Arrays.equals(val, o)); 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 c7794d31e432e..c9b4fa940a5fd 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 @@ -21,6 +21,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; import java.util.*; import java.util.concurrent.*; @@ -247,7 +248,7 @@ public void testPutRemoveConsistencyMultithreaded() throws Exception { Ignite ignite = grid(g); - GridCache cache = ignite.cache(null); + IgniteCache cache = ignite.jcache(null); int k = rnd.nextInt(range); @@ -273,7 +274,7 @@ public void testPutRemoveConsistencyMultithreaded() throws Exception { Long firstVal = null; for (int g = 0; g < gridCount(); g++) { - Long val = (Long)grid(g).cache(null).peek(i); + Long val = (Long)grid(g).jcache(null).peek(i); if (firstVal == null && val != null) firstVal = val; @@ -300,7 +301,7 @@ public void testPutRemoveConsistencyMultithreaded() throws Exception { * @param g Grid to check. */ private void checkKeySet(Ignite g) { - GridCache cache = g.cache(null); + GridCache cache = ((IgniteKernal)g).internalCache(null); Set keys = cache.keySet(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java index 4fb357ed0eb24..0df39c56ec483 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java @@ -122,14 +122,14 @@ public void testNodeStop() throws Exception { private int cnt; @SuppressWarnings({"BusyWait"}) - @Override public void applyx() throws IgniteCheckedException { + @Override public void applyx() { while (cnt++ < txCnt && !done.get()) { - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); if (cnt % logMod == 0) info("Starting transaction: " + cnt); - try (IgniteTx tx = cache.txStart()) { + try (IgniteTx tx = grid(0).transactions().txStart()) { int kv = RAND.nextInt(keyRange); cache.put(kv, kv); @@ -138,7 +138,7 @@ public void testNodeStop() throws Exception { tx.commit(); } - catch (IgniteTxOptimisticCheckedException e) { + catch (IgniteTxOptimisticException e) { info("Caught cache optimistic exception: " + e); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java index 735fc2ad9fc95..96595bac991ff 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.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.cache.store.*; import org.apache.ignite.configuration.*; @@ -138,7 +139,7 @@ public void testTxWritesOnDhtNode() throws Exception { private void checkSingleWrites() throws Exception { prepare(); - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); for (int i = 0; i < 100; i++) cache.put(i, String.valueOf(i)); @@ -157,7 +158,7 @@ private void checkBatchWrites() throws Exception { for (int i = 0; i < 100; i++) map.put(i, String.valueOf(i)); - grid(0).cache(null).putAll(map); + grid(0).jcache(null).putAll(map); checkWrites(); } @@ -168,9 +169,9 @@ private void checkBatchWrites() throws Exception { private void checkTxWrites() throws Exception { prepare(); - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { for (int i = 0; i < 100; i++) cache.put(i, String.valueOf(i)); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java index 8a956def0086d..3e394be28f9d5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java @@ -95,7 +95,7 @@ public void testPutGet() throws Exception { final Ignite ignite = grid(); - ignite.cache(null).put(key, "val"); + ignite.jcache(null).put(key, "val"); GridCacheEntryEx dhtEntry = dht(ignite).peekEx(key); @@ -122,14 +122,14 @@ public void testPutGet() throws Exception { * @throws Exception If failed. */ private String txGet(Ignite ignite, String key) throws Exception { - try (IgniteTx tx = ignite.cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { GridCacheEntryEx dhtEntry = dht(ignite).peekEx(key); if (DEBUG) info("DHT entry [hash=" + System.identityHashCode(dhtEntry) + ", xid=" + tx.xid() + ", entry=" + dhtEntry + ']'); - String val = ignite.cache(null).get(key); + String val = ignite.jcache(null).get(key); assertNotNull(val); assertEquals("val", val); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java index a071aa107cc7e..8a85688fbdcaa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.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.cluster.*; import org.apache.ignite.configuration.*; @@ -283,14 +284,14 @@ private void checkPutTx(boolean putBefore, IgniteTxConcurrency concurrency, info("Test transaction [concurrency=" + concurrency + ", isolation=" + isolation + ']'); - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); if (putBefore) { idxSpi.forceFail(false); info("Start transaction."); - try (IgniteTx tx = cache.txStart(concurrency, isolation)) { + try (IgniteTx tx = grid(0).transactions().txStart(concurrency, isolation)) { for (Integer key : keys) { info("Put " + key); @@ -306,7 +307,7 @@ private void checkPutTx(boolean putBefore, IgniteTxConcurrency concurrency, // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) { for (Integer key : keys) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); } idxSpi.forceFail(true); @@ -314,7 +315,7 @@ private void checkPutTx(boolean putBefore, IgniteTxConcurrency concurrency, try { info("Start transaction."); - try (IgniteTx tx = cache.txStart(concurrency, isolation)) { + try (IgniteTx tx = grid(0).transactions().txStart(concurrency, isolation)) { for (Integer key : keys) { info("Put " + key); @@ -372,7 +373,7 @@ private void checkEmpty(final Integer key) throws Exception { } for (int i = 0; i < gridCount(); i++) - assertEquals("Unexpected value for grid " + i, null, grid(i).cache(null).get(key)); + assertEquals("Unexpected value for grid " + i, null, grid(i).jcache(null).get(key)); } /** @@ -386,12 +387,12 @@ private void checkPut(boolean putBefore, final Integer key) throws Exception { info("Put key: " + key); - grid(0).cache(null).put(key, 1); + grid(0).jcache(null).put(key, 1); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); idxSpi.forceFail(true); @@ -399,7 +400,7 @@ private void checkPut(boolean putBefore, final Integer key) throws Exception { GridTestUtils.assertThrows(log, new Callable() { @Override public Void call() throws Exception { - grid(0).cache(null).put(key, 2); + grid(0).jcache(null).put(key, 2); return null; } @@ -419,12 +420,12 @@ private void checkTransform(boolean putBefore, final Integer key) throws Excepti info("Put key: " + key); - grid(0).cache(null).put(key, 1); + grid(0).jcache(null).put(key, 1); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); idxSpi.forceFail(true); @@ -467,13 +468,13 @@ private void checkPutAll(boolean putBefore, Integer ... keys) throws Exception { info("Put data: " + m); - grid(0).cache(null).putAll(m); + grid(0).jcache(null).putAll(m); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) { for (Integer key : keys) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); } idxSpi.forceFail(true); @@ -487,7 +488,7 @@ private void checkPutAll(boolean putBefore, Integer ... keys) throws Exception { GridTestUtils.assertThrows(log, new Callable() { @Override public Void call() throws Exception { - grid(0).cache(null).putAll(m); + grid(0).jcache(null).putAll(m); return null; } @@ -508,12 +509,12 @@ private void checkRemove(boolean putBefore, final Integer key) throws Exception info("Put key: " + key); - grid(0).cache(null).put(key, 1); + grid(0).jcache(null).put(key, 1); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); idxSpi.forceFail(true); @@ -521,7 +522,7 @@ private void checkRemove(boolean putBefore, final Integer key) throws Exception GridTestUtils.assertThrows(log, new Callable() { @Override public Void call() throws Exception { - grid(0).cache(null).remove(key); + grid(0).jcache(null).remove(key); return null; } @@ -538,7 +539,7 @@ private void checkRemove(boolean putBefore, final Integer key) throws Exception * @return Key. */ private Integer keyForNode(ClusterNode node, int type) { - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); if (cache.configuration().getCacheMode() == LOCAL) return ++lastKey; @@ -549,7 +550,7 @@ private Integer keyForNode(ClusterNode node, int type) { for (int key = lastKey + 1; key < (lastKey + 10_000); key++) { switch (type) { case NOT_PRIMARY_AND_BACKUP: { - if (!cache.affinity().isPrimaryOrBackup(node, key)) { + if (!affinity(cache).isPrimaryOrBackup(node, key)) { lastKey = key; return key; @@ -559,7 +560,7 @@ private Integer keyForNode(ClusterNode node, int type) { } case PRIMARY: { - if (cache.affinity().isPrimary(node, key)) { + if (affinity(cache).isPrimary(node, key)) { lastKey = key; return key; @@ -569,7 +570,7 @@ private Integer keyForNode(ClusterNode node, int type) { } case BACKUP: { - if (cache.affinity().isBackup(node, key)) { + if (affinity(cache).isBackup(node, key)) { lastKey = key; return key; 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 3f3277ffe939b..708c112d6ba0f 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 @@ -109,7 +109,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe */ @SuppressWarnings("unchecked") private static UUID primaryId(Ignite ignite, Object key) { - CacheAffinity aff = ignite.cache(null).cache().affinity(); + CacheAffinity aff = ignite.affinity(null); Collection affNodes = aff.mapPartitionToPrimaryAndBackups(aff.partition(key)); @@ -157,7 +157,7 @@ private static UUID primaryId(Ignite ignite, Object key) { */ @SuppressWarnings("unchecked") private void onItemNear(boolean putCntr, Ignite ignite, String itemKey, int retry) throws IgniteCheckedException { - GridCache cache = ignite.cache(null); + IgniteCache cache = ignite.jcache(null); UUID locId = ignite.cluster().localNode().id(); UUID itemPrimaryId = primaryId(ignite, itemKey); @@ -165,7 +165,7 @@ private void onItemNear(boolean putCntr, Ignite ignite, String itemKey, int retr boolean isCntrPrimary = cntrPrimaryId.equals(locId); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { if (DEBUG) info("Before near get [retry=" + retry + ", xid=" + tx.xid() + ", node=" + ignite.name() + ", isCntrPrimary=" + isCntrPrimary + ", nearId=" + locId + @@ -182,14 +182,14 @@ private void onItemNear(boolean putCntr, Ignite ignite, String itemKey, int retr ", cur=" + cntr + ", new=" + newVal + ", nearEntry=" + nearEntry(locId, CNTR_KEY) + (isCntrPrimary ? ", dhtEntry=" + dhtEntry(locId, CNTR_KEY) : "") + ']'); - cache.putx(CNTR_KEY, newVal); + cache.put(CNTR_KEY, newVal); } if (DEBUG) info("Before near put item [retry=" + retry + ", key=" + itemKey + ", cur=" + cntr + ", new=" + newVal + ", nearEntry=" + nearEntry(locId, itemKey) + ", dhtEntry=" + dhtEntry(itemPrimaryId, itemKey) + ']'); - cache.putx(itemKey, newVal); + cache.put(itemKey, newVal); if (DEBUG) info("After near put item [retry=" + retry + ", key=" + itemKey + ", old=" + cntr + ", new=" + newVal + @@ -209,7 +209,7 @@ private void onItemNear(boolean putCntr, Ignite ignite, String itemKey, int retr */ @SuppressWarnings("unchecked") private void onItemPrimary(boolean putCntr, Ignite ignite, String itemKey, int retry) throws IgniteCheckedException { - GridCache cache = ignite.cache(null); + IgniteCache cache = ignite.jcache(null); UUID locId = ignite.cluster().localNode().id(); UUID itemPrimaryId = primaryId(ignite, itemKey); @@ -217,7 +217,7 @@ private void onItemPrimary(boolean putCntr, Ignite ignite, String itemKey, int r boolean isCntrPrimary = cntrPrimaryId.equals(locId); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { if (DEBUG) info("Before item primary get [retry=" + retry + ", xid=" + tx.xid() + ", node=" + ignite.name() + ", isCntrPrimary=" + isCntrPrimary + ", nearId=" + locId + @@ -234,7 +234,7 @@ private void onItemPrimary(boolean putCntr, Ignite ignite, String itemKey, int r ", cur=" + cntr + ", new=" + newVal + ", nearEntry=" + nearEntry(locId, CNTR_KEY) + (isCntrPrimary ? ", dhtEntry=" + dhtEntry(locId, CNTR_KEY) : "") + ']'); - cache.putx(CNTR_KEY, newVal); + cache.put(CNTR_KEY, newVal); } if (DEBUG) @@ -242,7 +242,7 @@ private void onItemPrimary(boolean putCntr, Ignite ignite, String itemKey, int r ", new=" + newVal + ", nearEntry=" + nearEntry(locId, itemKey) + ", dhtEntry=" + dhtEntry(itemPrimaryId, itemKey) + ']'); - cache.putx(itemKey, cntr); + cache.put(itemKey, cntr); if (DEBUG) info("After item primary put item [retry=" + retry + ", key=" + itemKey + ", cur=" + cntr + @@ -262,14 +262,14 @@ private void onItemPrimary(boolean putCntr, Ignite ignite, String itemKey, int r */ @SuppressWarnings("unchecked") private void onRemoveItemQueried(boolean putCntr, Ignite ignite, int retry) throws IgniteCheckedException { - GridCache cache = ignite.cache(null); + IgniteCache cache = ignite.jcache(null); UUID locId = ignite.cluster().localNode().id(); UUID cntrPrimaryId = primaryId(ignite, RMVD_CNTR_KEY); boolean isCntrPrimary = cntrPrimaryId.equals(locId); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { if (DEBUG) ignite.log().info("Before item lock [retry=" + retry + ", xid=" + tx.xid() + ", node=" + ignite.name() + ", isCntrPrimary=" + isCntrPrimary + ", nearId=" + locId + @@ -290,12 +290,12 @@ private void onRemoveItemQueried(boolean putCntr, Ignite ignite, int retry) thro ", cur=" + cntr + ", new=" + newVal + ", nearEntry=" + nearEntry(locId, RMVD_CNTR_KEY) + (isCntrPrimary ? ", dhtEntry=" + dhtEntry(locId, RMVD_CNTR_KEY) : "") + ']'); - cache.putx(RMVD_CNTR_KEY, newVal); + cache.put(RMVD_CNTR_KEY, newVal); } while (true) { CacheQuery> qry = - cache.queries().createSqlQuery(Integer.class, "_key != 'RMVD_CNTR_KEY' and _val >= 0"); + ignite.cache(null).queries().createSqlQuery(Integer.class, "_key != 'RMVD_CNTR_KEY' and _val >= 0"); if (DEBUG) ignite.log().info("Before executing query [retry=" + retry + ", locId=" + locId + @@ -320,7 +320,7 @@ private void onRemoveItemQueried(boolean putCntr, Ignite ignite, int retry) thro ", nearEntry=" + nearEntry(locId, itemKey) + ", dhtEntry=" + dhtEntry(itemPrimaryId, itemKey) + ']'); - assert cache.removex(itemKey) : "Failed to remove key [locId=" + locId + + assert cache.remove(itemKey) : "Failed to remove key [locId=" + locId + ", primaryId=" + itemPrimaryId + ", key=" + itemKey + ']'; if (DEBUG) @@ -331,7 +331,7 @@ private void onRemoveItemQueried(boolean putCntr, Ignite ignite, int retry) thro break; } else - cache.removex(itemKey); + cache.remove(itemKey); } tx.commit(); @@ -352,14 +352,14 @@ private void onRemoveItemQueried(boolean putCntr, Ignite ignite, int retry) thro */ @SuppressWarnings("unchecked") private void onRemoveItemSimple(boolean putCntr, Ignite ignite, int retry) throws IgniteCheckedException { - GridCache cache = ignite.cache(null); + IgniteCache cache = ignite.jcache(null); UUID locId = ignite.cluster().localNode().id(); UUID cntrPrimaryId = primaryId(ignite, RMVD_CNTR_KEY); boolean isCntrPrimary = cntrPrimaryId.equals(locId); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { if (DEBUG) ignite.log().info("Before item lock [retry=" + retry + ", xid=" + tx.xid() + ", node=" + ignite.name() + ", isCntrPrimary=" + isCntrPrimary + ", nearId=" + locId + @@ -388,7 +388,7 @@ private void onRemoveItemSimple(boolean putCntr, Ignite ignite, int retry) throw ", cur=" + cntr + ", new=" + newVal + ", nearEntry=" + nearEntry(locId, RMVD_CNTR_KEY) + (isCntrPrimary ? ", dhtEntry=" + dhtEntry(locId, RMVD_CNTR_KEY) : "") + ']'); - cache.putx(RMVD_CNTR_KEY, newVal); + cache.put(RMVD_CNTR_KEY, newVal); } if (DEBUG) @@ -396,7 +396,7 @@ private void onRemoveItemSimple(boolean putCntr, Ignite ignite, int retry) throw ", new=" + newVal + ", nearEntry=" + nearEntry(locId, itemKey) + ", dhtEntry=" + dhtEntry(itemPrimaryId, itemKey) + ']'); - assertTrue(cache.removex(itemKey)); + assertTrue(cache.remove(itemKey)); if (DEBUG) info("After item put item [retry=" + retry + ", key=" + itemKey + ", cur=" + cntr + @@ -496,7 +496,7 @@ public void testPutOneEntryInTx() throws Exception { startGrids(GRID_CNT); try { - grid(0).cache(null).put(CNTR_KEY, 0); + grid(0).jcache(null).put(CNTR_KEY, 0); grid(0).compute().call(new PutOneEntryInTxJob()); } @@ -516,13 +516,13 @@ public void testPutTwoEntriesInTx() throws Exception { startGrids(GRID_CNT); try { - grid(0).cache(null).put(CNTR_KEY, 0); + grid(0).jcache(null).put(CNTR_KEY, 0); grid(0).compute().call(new PutTwoEntriesInTxJob()); printCounter(); - assertEquals(GRID_CNT * RETRIES, grid(0).cache(null).get(CNTR_KEY)); + assertEquals(GRID_CNT * RETRIES, grid(0).jcache(null).get(CNTR_KEY)); } finally { stopAllGrids(); @@ -543,7 +543,7 @@ public void testPutOneEntryInTxMultiThreaded() throws Exception { try { // Initialize. - grid(0).cache(null).put(CNTR_KEY, 0); + grid(0).jcache(null).put(CNTR_KEY, 0); for (int i = 0; i < GRID_CNT; i++) { final int gridId = i; @@ -586,7 +586,7 @@ public void testPutTwoEntryInTxMultiThreaded() throws Exception { Collection threads = new LinkedList<>(); try { - grid(0).cache(null).put(CNTR_KEY, 0); + grid(0).jcache(null).put(CNTR_KEY, 0); for (int i = 0; i < GRID_CNT; i++) { final int gridId = i; @@ -611,7 +611,7 @@ public void testPutTwoEntryInTxMultiThreaded() throws Exception { printCounter(); - assertEquals(GRID_CNT * RETRIES, grid(0).cache(null).get(CNTR_KEY)); + assertEquals(GRID_CNT * RETRIES, grid(0).jcache(null).get(CNTR_KEY)); } finally { stopAllGrids(); @@ -638,7 +638,7 @@ public void testRemoveInTxQueried() throws Exception { for (int i = 0; i < RETRIES; i++) for (int j = 0; j < GRID_CNT; j++) - assertEquals(i, grid(j).cache(null).get(String.valueOf(i))); + assertEquals(i, grid(j).jcache(null).get(String.valueOf(i))); CacheQuery> qry = cache.queries().createSqlQuery(Integer.class, " _val >= 0"); @@ -652,9 +652,9 @@ public void testRemoveInTxQueried() throws Exception { for (int i = 0; i < GRID_CNT * RETRIES; i++) for (int ii = 0; ii < GRID_CNT; ii++) - assertEquals(null, grid(ii).cache(null).get(Integer.toString(i))); + assertEquals(null, grid(ii).jcache(null).get(Integer.toString(i))); - assertEquals(-GRID_CNT * RETRIES, grid(0).cache(null).peek(RMVD_CNTR_KEY)); + assertEquals(-GRID_CNT * RETRIES, grid(0).jcache(null).peek(RMVD_CNTR_KEY)); } finally { stopAllGrids(); @@ -679,7 +679,7 @@ public void testRemoveInTxSimple() throws Exception { for (int i = 0; i < RETRIES; i++) for (int j = 0; j < GRID_CNT; j++) - assertEquals(i, grid(j).cache(null).get(Integer.toString(i))); + assertEquals(i, grid(j).jcache(null).get(Integer.toString(i))); CacheQuery> qry = cache.queries().createSqlQuery(Integer.class, " _val >= 0"); @@ -694,14 +694,14 @@ public void testRemoveInTxSimple() throws Exception { // Check using cache. for (int i = 0; i < GRID_CNT * RETRIES; i++) for (int ii = 0; ii < GRID_CNT; ii++) - assertEquals(null, grid(ii).cache(null).get(Integer.toString(i))); + assertEquals(null, grid(ii).jcache(null).get(Integer.toString(i))); // Check using query. entries = qry.execute().get(); assertTrue(entries.isEmpty()); - assertEquals(-GRID_CNT * RETRIES, grid(0).cache(null).peek(RMVD_CNTR_KEY)); + assertEquals(-GRID_CNT * RETRIES, grid(0).jcache(null).peek(RMVD_CNTR_KEY)); } finally { stopAllGrids(); @@ -731,11 +731,11 @@ public void testRemoveInTxQueriedMultiThreaded() throws Exception { cache.put(String.valueOf(i), i); for (int j = 0; j < GRID_CNT; j++) - assertEquals(0, grid(j).cache(null).get(RMVD_CNTR_KEY)); + assertEquals(0, grid(j).jcache(null).get(RMVD_CNTR_KEY)); for (int i = 1; i <= RETRIES; i++) for (int j = 0; j < GRID_CNT; j++) - assertEquals(i, grid(j).cache(null).get(String.valueOf(i))); + assertEquals(i, grid(j).jcache(null).get(String.valueOf(i))); CacheQuery> qry = cache.queries().createSqlQuery(Integer.class, "_val >= 0"); @@ -797,9 +797,9 @@ public void testRemoveInTxQueriedMultiThreaded() throws Exception { for (int i = 0; i < GRID_CNT * RETRIES; i++) for (int ii = 0; ii < GRID_CNT; ii++) assertEquals("Got invalid value from cache [gridIdx=" + ii + ", key=" + i + ']', - null, grid(ii).cache(null).get(Integer.toString(i))); + null, grid(ii).jcache(null).get(Integer.toString(i))); - assertEquals(-GRID_CNT * RETRIES, grid(0).cache(null).peek(RMVD_CNTR_KEY)); + assertEquals(-GRID_CNT * RETRIES, grid(0).jcache(null).peek(RMVD_CNTR_KEY)); } finally { stopAllGrids(); @@ -811,8 +811,8 @@ public void testRemoveInTxQueriedMultiThreaded() throws Exception { */ private void printCounter() throws IgniteCheckedException { info("***"); - info("*** Peeked counter: " + grid(0).cache(null).peek(CNTR_KEY)); - info("*** Got counter: " + grid(0).cache(null).get(CNTR_KEY)); + info("*** Peeked counter: " + grid(0).jcache(null).peek(CNTR_KEY)); + info("*** Got counter: " + grid(0).jcache(null).get(CNTR_KEY)); info("***"); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java index be3a89162e555..b60acd406ed5a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.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.internal.*; import org.apache.ignite.internal.transactions.*; @@ -209,7 +210,7 @@ public void testOptimisticSerializableRollbackMultithreaded() throws Exception { */ // TODO: GG-8063, enabled when fixed. public void _testOptimisticSerializableConsistency() throws Exception { - final GridCache cache = grid(0).cache(null); + final IgniteCache cache = grid(0).jcache(null); final int THREADS = 2; @@ -228,7 +229,7 @@ public void _testOptimisticSerializableConsistency() throws Exception { for (int i = 0; i < ITERATIONS; i++) { while (true) { - try (IgniteTx tx = cache.txStart(OPTIMISTIC, SERIALIZABLE)) { + try (IgniteTx tx = grid(0).transactions().txStart(OPTIMISTIC, SERIALIZABLE)) { long val = cache.get(key); cache.put(key, val + 1); @@ -239,7 +240,7 @@ public void _testOptimisticSerializableConsistency() throws Exception { break; } - catch(IgniteTxOptimisticCheckedException e) { + catch(IgniteTxOptimisticException e) { log.info("Got error, will retry: " + e); } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java index 254cf5aac1225..e1650eee1f67e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.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.cluster.*; import org.apache.ignite.configuration.*; @@ -96,12 +97,12 @@ public void testLockReentry() throws Exception { startGrids(gridCount()); try { - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); // Find test key. int key = testKey(); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { // One near lock request. cache.get(key); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java index 02e00ebb6a17d..dd78536785373 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; -import org.apache.ignite.cache.*; import org.apache.ignite.cache.store.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; @@ -286,14 +285,14 @@ private void checkPutTx(boolean putBefore, IgniteTxConcurrency concurrency, info("Test transaction [concurrency=" + concurrency + ", isolation=" + isolation + ']'); - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); if (putBefore) { store.forceFail(false); info("Start transaction."); - try (IgniteTx tx = cache.txStart(concurrency, isolation)) { + try (IgniteTx tx = grid(0).transactions().txStart(concurrency, isolation)) { for (Integer key : keys) { info("Put " + key); @@ -309,7 +308,7 @@ private void checkPutTx(boolean putBefore, IgniteTxConcurrency concurrency, // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) { for (Integer key : keys) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); } store.forceFail(true); @@ -317,7 +316,7 @@ private void checkPutTx(boolean putBefore, IgniteTxConcurrency concurrency, try { info("Start transaction."); - try (IgniteTx tx = cache.txStart(concurrency, isolation)) { + try (IgniteTx tx = grid(0).transactions().txStart(concurrency, isolation)) { for (Integer key : keys) { info("Put " + key); @@ -381,7 +380,7 @@ private void checkValue(final Integer key, boolean putBefore) throws Exception { } for (int i = 0; i < gridCount(); i++) - assertEquals("Unexpected value for grid " + i, putBefore ? 1 : null, grid(i).cache(null).get(key)); + assertEquals("Unexpected value for grid " + i, putBefore ? 1 : null, grid(i).jcache(null).get(key)); } /** @@ -395,12 +394,12 @@ private void checkPut(boolean putBefore, final Integer key) throws Exception { info("Put key: " + key); - grid(0).cache(null).put(key, 1); + grid(0).jcache(null).put(key, 1); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); store.forceFail(true); @@ -408,7 +407,7 @@ private void checkPut(boolean putBefore, final Integer key) throws Exception { GridTestUtils.assertThrows(log, new Callable() { @Override public Void call() throws Exception { - grid(0).cache(null).put(key, 2); + grid(0).jcache(null).put(key, 2); return null; } @@ -428,12 +427,12 @@ private void checkTransform(boolean putBefore, final Integer key) throws Excepti info("Put key: " + key); - grid(0).cache(null).put(key, 1); + grid(0).jcache(null).put(key, 1); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); store.forceFail(true); @@ -476,13 +475,13 @@ private void checkPutAll(boolean putBefore, Integer ... keys) throws Exception { info("Put data: " + m); - grid(0).cache(null).putAll(m); + grid(0).jcache(null).putAll(m); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) { for (Integer key : keys) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); } store.forceFail(true); @@ -496,7 +495,7 @@ private void checkPutAll(boolean putBefore, Integer ... keys) throws Exception { GridTestUtils.assertThrows(log, new Callable() { @Override public Void call() throws Exception { - grid(0).cache(null).putAll(m); + grid(0).jcache(null).putAll(m); return null; } @@ -517,12 +516,12 @@ private void checkRemove(boolean putBefore, final Integer key) throws Exception info("Put key: " + key); - grid(0).cache(null).put(key, 1); + grid(0).jcache(null).put(key, 1); } // Execute get from all nodes to create readers for near cache. for (int i = 0; i < gridCount(); i++) - grid(i).cache(null).get(key); + grid(i).jcache(null).get(key); store.forceFail(true); @@ -530,7 +529,7 @@ private void checkRemove(boolean putBefore, final Integer key) throws Exception GridTestUtils.assertThrows(log, new Callable() { @Override public Void call() throws Exception { - grid(0).cache(null).remove(key); + grid(0).jcache(null).remove(key); return null; } @@ -547,7 +546,7 @@ private void checkRemove(boolean putBefore, final Integer key) throws Exception * @return Key. */ private Integer keyForNode(ClusterNode node, int type) { - GridCache cache = grid(0).cache(null); + IgniteCache cache = grid(0).jcache(null); if (cache.configuration().getCacheMode() == LOCAL) return ++lastKey; @@ -558,7 +557,7 @@ private Integer keyForNode(ClusterNode node, int type) { for (int key = lastKey + 1; key < (lastKey + 10_000); key++) { switch (type) { case NOT_PRIMARY_AND_BACKUP: { - if (!cache.affinity().isPrimaryOrBackup(node, key)) { + if (!affinity(cache).isPrimaryOrBackup(node, key)) { lastKey = key; return key; @@ -568,7 +567,7 @@ private Integer keyForNode(ClusterNode node, int type) { } case PRIMARY: { - if (cache.affinity().isPrimary(node, key)) { + if (affinity(cache).isPrimary(node, key)) { lastKey = key; return key; @@ -578,7 +577,7 @@ private Integer keyForNode(ClusterNode node, int type) { } case BACKUP: { - if (cache.affinity().isBackup(node, key)) { + if (affinity(cache).isBackup(node, key)) { lastKey = key; return key; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java index a6ba7296fff2d..0155ee2e6e447 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java @@ -244,7 +244,7 @@ public void testGetAndAdd() throws Exception { * @throws Exception If failed. */ public void testGetAndAddInTx() throws Exception { - try (IgniteTx tx = grid().cache(TRANSACTIONAL_CACHE_NAME).txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { for (int i = 1; i < MAX_LOOPS_NUM; i++) { for (IgniteAtomicSequence seq : seqArr) getAndAdd(seq, i); @@ -369,16 +369,13 @@ public void testCacheSets() throws Exception { }, IllegalStateException.class, null); for (Object o : cache.keySet()) - assert !(o instanceof GridCacheInternal) : "Wrong keys [key=" + o + ", keySet=" + grid().cache(null).keySet() + - ']'; + assert !(o instanceof GridCacheInternal) : "Wrong keys [key=" + o + ']'; for (Object o : cache.values()) - assert !(o instanceof GridCacheInternal) : "Wrong values [value=" + o + ", values=" + - grid().cache(null).values() + ']'; + assert !(o instanceof GridCacheInternal) : "Wrong values [value=" + o + ']'; for (Object o : cache.entrySet()) - assert !(o instanceof GridCacheInternal) : "Wrong entries [entry=" + o + ", entries=" + - grid().cache(null).values() + ']'; + assert !(o instanceof GridCacheInternal) : "Wrong entries [entry=" + o + ']'; assert cache.keySet().isEmpty(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java index 9e5d49ba8b947..35cc85f05e709 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java @@ -159,14 +159,14 @@ private void checkSimple(String key) throws Exception { for (int i = INIT_GRID_NUM; i < MAX_GRID_NUM; i++) { startGrid(i); - assert PARTITIONED == grid(i).cache(null).configuration().getCacheMode(); + assert PARTITIONED == grid(i).jcache(null).configuration().getCacheMode(); - try (IgniteTx tx = grid(i).cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer val = (Integer) grid(i).cache(null).get(key); + try (IgniteTx tx = grid(i).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + Integer val = (Integer) grid(i).jcache(null).get(key); assertEquals("Simple check failed for node: " + i, (Integer) i, val); - grid(i).cache(null).put(key, i + 1); + grid(i).jcache(null).put(key, i + 1); tx.commit(); } @@ -184,12 +184,12 @@ private void checkCustom(String name) throws Exception { for (int i = INIT_GRID_NUM; i < 20; i++) { startGrid(i); - assert PARTITIONED == grid(i).cache(null).configuration().getCacheMode(); + assert PARTITIONED == grid(i).jcache(null).configuration().getCacheMode(); - try (IgniteTx tx = grid(i).cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = grid(i).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); - GridCacheAtomicLongValue atomicVal = ((GridCacheAtomicLongValue) grid(i).cache(null).get(key)); + GridCacheAtomicLongValue atomicVal = ((GridCacheAtomicLongValue) grid(i).jcache(null).get(key)); assertNotNull(atomicVal); @@ -197,7 +197,7 @@ private void checkCustom(String name) throws Exception { atomicVal.set(i + 1); - grid(i).cache(null).put(key, atomicVal); + grid(i).jcache(null).put(key, atomicVal); tx.commit(); } @@ -215,7 +215,7 @@ private void checkAtomic(String name) throws Exception { for (int i = INIT_GRID_NUM; i < 20; i++) { startGrid(i); - assert PARTITIONED == grid(i).cache(null).configuration().getCacheMode(); + assert PARTITIONED == grid(i).jcache(null).configuration().getCacheMode(); IgniteAtomicLong atomic = grid(i).atomicLong(name, 0, true); @@ -240,11 +240,11 @@ private void prepareSimple(String key) throws Exception { assert startGrid(i) != null; for (int i = 0; i < INIT_GRID_NUM; i++) - assert PARTITIONED == grid(i).cache(null).configuration().getCacheMode(); + assert PARTITIONED == grid(i).jcache(null).configuration().getCacheMode(); // Init cache data. - try (IgniteTx tx = grid(0).cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { // Put simple value. grid(0).cache(null).put(key, INIT_GRID_NUM); @@ -263,13 +263,13 @@ private void prepareCustom(String key) throws Exception { assert startGrid(i) != null; for (int i = 0; i < INIT_GRID_NUM; i++) - assert PARTITIONED == grid(i).cache(null).configuration().getCacheMode(); + assert PARTITIONED == grid(i).jcache(null).configuration().getCacheMode(); // Init cache data. - try (IgniteTx tx = grid(0).cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { // Put custom data - grid(0).cache(null).put(new GridCacheInternalKeyImpl(key), new GridCacheAtomicLongValue(INIT_GRID_NUM)); + grid(0).jcache(null).put(new GridCacheInternalKeyImpl(key), new GridCacheAtomicLongValue(INIT_GRID_NUM)); tx.commit(); } @@ -288,7 +288,7 @@ private void prepareAtomic(String key) throws Exception { assert startGrid(i) != null; for (int i = 0; i < INIT_GRID_NUM; i++) - assert PARTITIONED == grid(i).cache(null).configuration().getCacheMode(); + assert PARTITIONED == grid(i).jcache(null).configuration().getCacheMode(); // Init cache data. grid(0).atomicLong(key, 0, true).getAndSet(INIT_GRID_NUM); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java index d31c69dd9d0b8..8d6b80f0a06e7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java @@ -169,11 +169,11 @@ public void testTx() throws Exception { // If output presents, test passes with greater probability. // info("Start puts."); - GridCache cache = ignite.cache(null); + IgniteCache cache = ignite.jcache(null); - info("Partition: " + cache.affinity().partition(1)); + info("Partition: " + ignite.affinity(null).partition(1)); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { // info("Getting value for key 1"); String s = cache.get(1); @@ -185,7 +185,7 @@ public void testTx() throws Exception { // info("Putting value."); - cache.putx(1, "val"); + cache.put(1, "val"); // info("Done putting value");