Repository: incubator-ignite Updated Branches: refs/heads/ignite-565 7e78e03d6 -> 5adc4d336
#ignite-565: remove GridCache from tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5adc4d33 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5adc4d33 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5adc4d33 Branch: refs/heads/ignite-565 Commit: 5adc4d33658da9888e95d8113a85f43141acd2da Parents: 7e78e03 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Tue Mar 24 18:20:15 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Tue Mar 24 18:20:15 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheUtils.java | 4 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 8 +- .../GridCacheConcurrentTxMultiNodeTest.java | 28 ------- .../cache/GridCacheLuceneQueryIndexTest.java | 20 ++--- .../IgniteCacheContainsKeyAbstractSelfTest.java | 15 ++-- ...heAbstractTransformWriteThroughSelfTest.java | 2 +- .../GridCachePartitionedLoadCacheSelfTest.java | 2 +- ...achePartitionedMultiNodeFullApiSelfTest.java | 42 +++-------- .../near/GridPartitionedBackupLoadSelfTest.java | 2 +- .../GridCacheReplicatedEvictionSelfTest.java | 8 +- .../GridCacheReplicatedInvalidateSelfTest.java | 13 +--- .../IgniteCacheExpiryPolicyAbstractTest.java | 8 +- ...ridCacheContinuousQueryAbstractSelfTest.java | 8 +- .../query/h2/GridH2IndexingGeoSelfTest.java | 53 +++++++------ ...idCacheReduceQueryMultithreadedSelfTest.java | 79 -------------------- .../cache/IgniteCacheQueryLoadSelfTest.java | 4 +- .../IgniteCacheQueryMultiThreadedSelfTest.java | 6 +- .../GridCacheReplicatedFieldsQuerySelfTest.java | 38 ---------- 18 files changed, 85 insertions(+), 255 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java index 097e771..eab1472 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java @@ -1682,8 +1682,8 @@ public class GridCacheUtils { * @param key Key. * @return {@code True} if entry was invalidated. */ - public static <K, V> boolean invalidate(CacheProjection<K, V> cache, K key) { - return cache.clearLocally(key); + public static <K, V> void invalidate(IgniteCache<K, V> cache, K key) { + cache.localClear(key); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index 73e8583..79f574c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -268,7 +268,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract for (int i = 0; i < gridCount(); i++) { // Will actually delete entry from map. - CU.invalidate(cache(i), "key0"); + CU.invalidate(jcache(i), "key0"); assertNull("Failed check for grid: " + i, jcache(i).localPeek("key0", CachePeekMode.ONHEAP)); @@ -293,13 +293,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract Collection<String> keysCol = mapped.get(grid(i).localNode()); assertEquals("Failed check for grid: " + i, !F.isEmpty(keysCol) ? keysCol.size() : 0, - cache(i).primarySize()); + jcache(i).localSize(CachePeekMode.PRIMARY)); } int globalPrimarySize = map.size(); for (int i = 0; i < gridCount(); i++) - assertEquals(globalPrimarySize, cache(i).globalPrimarySize()); + assertEquals(globalPrimarySize, jcache(i).size(CachePeekMode.PRIMARY)); int times = 1; @@ -311,7 +311,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract int globalSize = globalPrimarySize * times; for (int i = 0; i < gridCount(); i++) - assertEquals(globalSize, cache(i).globalSize()); + assertEquals(globalSize, jcache(i).size()); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java index 3f94228..e667b1a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java @@ -670,34 +670,6 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest { } /** - * @param msgId Message ID. - * @return Request. - */ - private Request findRequestWithMessageId(Long msgId) { - CacheProjection<Object, Request> cache = ((IgniteKernal)ignite).getCache(null).projection(Object.class, Request.class); - - CacheQuery<Map.Entry<Object, Request>> qry = cache.queries().createSqlQuery( - Request.class, "messageId = ?"); - - try { - // taking out localNode() doesn't change the eviction timeout future - // problem - Map.Entry<Object, Request> entry = - F.first(qry.projection(ignite.cluster().forLocal()).execute(msgId).get()); - - if (entry == null) - return null; - - return entry.getValue(); - } - catch (IgniteCheckedException e) { - e.printStackTrace(); - - return null; - } - } - - /** * @param o Object to put. * @param cacheKey Cache key. * @param terminalId Terminal ID. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java index d31568e..76d1230 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java @@ -101,8 +101,8 @@ public class GridCacheLuceneQueryIndexTest extends GridCommonAbstractTest { public void testLuceneIndex() throws Exception { final Ignite g = startGrid(0); - final GridCache<Integer, ObjectValue> cache1 = ((IgniteKernal)g).getCache("local1"); - final GridCache<Integer, ObjectValue> cache2 = ((IgniteKernal)g).getCache("local2"); + final IgniteCache<Integer, ObjectValue> cache1 = g.cache("local1"); + final IgniteCache<Integer, ObjectValue> cache2 = g.cache("local2"); final AtomicInteger threadIdxGen = new AtomicInteger(); @@ -115,9 +115,9 @@ public class GridCacheLuceneQueryIndexTest extends GridCommonAbstractTest { for (int i = 0; i < keyCnt; i++) { if (threadIdx == 0) - cache1.putx(i, new ObjectValue("test full text more" + i)); + cache1.put(i, new ObjectValue("test full text more" + i)); else - cache2.putx(i, new ObjectValue("test full text more" + i)); + cache2.put(i, new ObjectValue("test full text more" + i)); if (i % 200 == 0) info("Put entries count: " + i); @@ -158,8 +158,8 @@ public class GridCacheLuceneQueryIndexTest extends GridCommonAbstractTest { public void testLuceneIndex1() throws Exception { final Ignite g = startGrid(0); - final GridCache<Integer, ObjectValue> cache1 = ((IgniteKernal)g).getCache("local1"); - final GridCache<Integer, ObjectValue> cache2 = ((IgniteKernal)g).getCache("local2"); + final IgniteCache<Integer, ObjectValue> cache1 = g.cache("local1"); + final IgniteCache<Integer, ObjectValue> cache2 = g.cache("local2"); final AtomicInteger threadIdxGen = new AtomicInteger(); @@ -229,8 +229,8 @@ public class GridCacheLuceneQueryIndexTest extends GridCommonAbstractTest { public void testLuceneIndex2() throws Exception { final Ignite g = startGrid(0); - final GridCache<Integer, ObjectValue> cache1 = ((IgniteKernal)g).getCache("local1"); - final GridCache<Integer, ObjectValue> cache2 = ((IgniteKernal)g).getCache("local2"); + final IgniteCache<Integer, ObjectValue> cache1 = g.cache("local1"); + final IgniteCache<Integer, ObjectValue> cache2 = g.cache("local2"); final AtomicInteger threadIdxGen = new AtomicInteger(); @@ -302,8 +302,8 @@ public class GridCacheLuceneQueryIndexTest extends GridCommonAbstractTest { public void testLuceneIndex3() throws Exception { final Ignite g = startGrid(0); - final GridCache<ObjectKey, ObjectValue> cache1 = ((IgniteKernal)g).getCache("local1"); - final GridCache<ObjectKey, ObjectValue> cache2 = ((IgniteKernal)g).getCache("local2"); + final IgniteCache<ObjectKey, ObjectValue> cache1 = g.cache("local1"); + final IgniteCache<ObjectKey, ObjectValue> cache2 = g.cache("local2"); final AtomicInteger threadIdxGen = new AtomicInteger(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java index 505697c..a889055 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.cache.transactions.*; @@ -38,7 +39,7 @@ public abstract class IgniteCacheContainsKeyAbstractSelfTest extends GridCacheAb /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { - cache(0).removeAll(); + jcache(0).removeAll(); } /** {@inheritDoc} */ @@ -73,12 +74,12 @@ public abstract class IgniteCacheContainsKeyAbstractSelfTest extends GridCacheAb public void testDistributedContains() throws Exception { String key = "1"; - cache(0).put(key, 1); + jcache(0).put(key, 1); for (int i = 0; i < gridCount(); i++) { - assertTrue("Invalid result on grid: " + i, cache(i).containsKey(key)); + assertTrue("Invalid result on grid: " + i, jcache(i).containsKey(key)); - assertFalse("Invalid result on grid: " + i, cache(i).containsKey("2")); + assertFalse("Invalid result on grid: " + i, jcache(i).containsKey("2")); } } @@ -90,9 +91,9 @@ public abstract class IgniteCacheContainsKeyAbstractSelfTest extends GridCacheAb String key = "1"; for (int i = 0; i < gridCount(); i++) - assertFalse("Invalid result on grid: " + i, cache(i).containsKey(key)); + assertFalse("Invalid result on grid: " + i, jcache(i).containsKey(key)); - GridCache<String, Integer> cache = cache(0); + IgniteCache<String, Integer> cache = jcache(0); for (TransactionConcurrency conc : TransactionConcurrency.values()) { for (TransactionIsolation iso : TransactionIsolation.values()) { @@ -109,7 +110,7 @@ public abstract class IgniteCacheContainsKeyAbstractSelfTest extends GridCacheAb } for (int i = 0; i < gridCount(); i++) - assertFalse("Invalid result on grid: " + i, cache(i).containsKey(key)); + assertFalse("Invalid result on grid: " + i, jcache(i).containsKey(key)); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java index 8f1cdc1..47676b3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java @@ -255,7 +255,7 @@ public abstract class GridCacheAbstractTransformWriteThroughSelfTest extends Gri nearStore.reset(); for (String key : keys) - cache(0).clearLocally(key); + jcache(0).localClear(key); info(">>> Starting transform transaction"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java index 9fe125c..b83cb12 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java @@ -125,7 +125,7 @@ public class GridCachePartitionedLoadCacheSelfTest extends GridCommonAbstractTes ClusterNode locNode = grid(0).localNode(); - for (Cache.Entry<Integer, String> e : this.<Integer, String>cache(0).entrySet()) { + for (Cache.Entry<Integer, String> e : this.<Integer, String>jcache(0).localEntries()) { assert aff.isPrimary(locNode, e.getKey()) || aff.isBackup(locNode, e.getKey()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java index ea424f7..9094755 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java @@ -297,7 +297,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti info("Generating keys for test..."); - GridCache<String, Integer> cache0 = cache(0); + IgniteCache<String, Integer> cache0 = jcache(0); for (int i = 0; i < 5; i++) { while (true) { @@ -307,7 +307,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti ignite(0).affinity(null).isBackup(grid(1).localNode(), key)) { keys.add(key); - assertTrue(cache0.putx(key, i)); + cache0.put(key, i); break; } @@ -316,43 +316,21 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti info("Finished generating keys for test."); - GridCache<String, Integer> cache2 = cache(2); + IgniteCache<String, Integer> cache2 = jcache(2); assertEquals(Integer.valueOf(0), cache2.get(keys.get(0))); assertEquals(Integer.valueOf(1), cache2.get(keys.get(1))); - assertEquals(0, cache0.nearSize()); - assertEquals(5, cache0.size() - cache0.nearSize()); + assertEquals(0, cache0.localSize(NEAR)); + assertEquals(5, cache0.size() - cache0.localSize(NEAR)); - GridCache<String, Integer> cache1 = cache(1); + IgniteCache<String, Integer> cache1 = jcache(1); - assertEquals(0, cache1.nearSize()); - assertEquals(5, cache1.size() - cache1.nearSize()); + assertEquals(0, cache1.localSize(NEAR)); + assertEquals(5, cache1.size() - cache1.localSize(NEAR)); - assertEquals(nearEnabled() ? 2 : 0, cache2.nearSize()); - assertEquals(0, cache2.size() - cache2.nearSize()); - - CacheEntryPredicate prjFilter = new CacheEntryPredicateAdapter() { - @Override public boolean apply(GridCacheEntryEx e) { - try { - Integer val = CU.value(e.rawGetOrUnmarshal(false), e.context(), false); - - return val != null && val >= 1 && val <= 3; - } - catch (IgniteCheckedException err) { - throw new IgniteException(err); - } - } - }; - - assertEquals(0, cache0.projection(prjFilter).nearSize()); - assertEquals(3, cache0.projection(prjFilter).size() - cache0.projection(prjFilter).nearSize()); - - assertEquals(0, cache1.projection(prjFilter).nearSize()); - assertEquals(3, cache1.projection(prjFilter).size() - cache1.projection(prjFilter).nearSize()); - - assertEquals(nearEnabled() ? 1 : 0, cache2.projection(prjFilter).nearSize()); - assertEquals(0, cache2.projection(prjFilter).size() - cache2.projection(prjFilter).nearSize()); + assertEquals(nearEnabled() ? 2 : 0, cache2.localSize(NEAR)); + assertEquals(0, cache2.size() - cache2.localSize(NEAR)); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java index 721a4f7..fa746a3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java @@ -113,7 +113,7 @@ public class GridPartitionedBackupLoadSelfTest extends GridCommonAbstractTest { if (grid(i).affinity(null).isBackup(grid(i).localNode(), 1)) { assert cache.localPeek(1, CachePeekMode.ONHEAP) == 1; - cache(i).clearLocally(1); + jcache(i).localClear(1); assert cache.localPeek(1, CachePeekMode.ONHEAP) == null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java index dbf4fb1..034265e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java @@ -71,11 +71,11 @@ public class GridCacheReplicatedEvictionSelfTest extends GridCacheAbstractSelfTe final int KEYS = 10; for (int i = 0; i < KEYS; i++) - cache(0).put(String.valueOf(i), i); + jcache(0).put(String.valueOf(i), i); for (int g = 0 ; g < gridCount(); g++) { for (int i = 0; i < KEYS; i++) - assertNotNull(cache(g).peek(String.valueOf(i))); + assertNotNull(jcache(g).localPeek(String.valueOf(i))); } Collection<IgniteFuture<Event>> futs = new ArrayList<>(); @@ -86,7 +86,7 @@ public class GridCacheReplicatedEvictionSelfTest extends GridCacheAbstractSelfTe for (int g = 0; g < gridCount(); g++) { for (int i = 0; i < KEYS; i++) { if (grid(g).affinity(null).isPrimary(grid(g).localNode(), String.valueOf(i))) - assertTrue(cache(g).evict(String.valueOf(i))); + jcache(g).localEvict(Collections.singleton(String.valueOf(i))); } } @@ -97,7 +97,7 @@ public class GridCacheReplicatedEvictionSelfTest extends GridCacheAbstractSelfTe @Override public boolean apply() { for (int g = 0 ; g < gridCount(); g++) { for (int i = 0; i < KEYS; i++) { - if (cache(g).peek(String.valueOf(i)) != null) { + if (jcache(g).localPeek(String.valueOf(i)) != null) { log.info("Non-null value, will wait [grid=" + g + ", key=" + i + ']'); return false; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java index a2b7c46..c2c02fd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java @@ -153,24 +153,15 @@ public class GridCacheReplicatedInvalidateSelfTest extends GridCommonAbstractTes TransactionIsolation isolation) throws Throwable { int idx = RAND.nextInt(GRID_CNT); - GridCache<Integer, String> cache = cache(idx); + IgniteCache<Integer, String> cache = jcache(idx); - Transaction tx = cache.txStart(concurrency, isolation, 0, 0); + Transaction tx = grid(idx).transactions().txStart(concurrency, isolation, 0, 0); try { cache.put(KEY, VAL); tx.commit(); } - catch (IgniteTxOptimisticCheckedException e) { - log.warning("Optimistic transaction failure (will rollback) [msg=" + e.getMessage() + ", tx=" + tx + ']'); - - tx.rollback(); - - assert concurrency == OPTIMISTIC && isolation == SERIALIZABLE; - - assert false : "Invalid optimistic failure: " + tx; - } catch (Throwable e) { error("Transaction failed (will rollback): " + tx, e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java index 50bbdba..1e937ea 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java @@ -657,7 +657,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs checkTtl(key, 10_000L); for (int idx = 0; idx < gridCount(); idx++) { - assertEquals(1, cache(idx).get(key)); // Try get. + assertEquals(1, jcache(idx).get(key)); // Try get. checkTtl(key, 10_000L); } @@ -718,7 +718,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs checkTtl(key, 60_000L); for (int idx = 0; idx < gridCount(); idx++) { - assertEquals(1, cache(idx).get(key)); // Try get. + assertEquals(1, jcache(idx).get(key)); // Try get. checkTtl(key, 60_000L); } @@ -733,7 +733,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs checkTtl(key, 61_000L); for (int idx = 0; idx < gridCount(); idx++) { - assertEquals(2, cache(idx).get(key)); // Try get. + assertEquals(2, jcache(idx).get(key)); // Try get. checkTtl(key, 61_000L); } @@ -746,7 +746,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs tx.commit(); for (int idx = 0; idx < gridCount(); idx++) - assertNull(cache(idx).get(key)); + assertNull(jcache(idx).get(key)); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index 3c58114..dc030da 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@ -169,9 +169,9 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo } for (int i = 0; i < gridCount(); i++) - assertEquals("Cache is not empty [entrySet=" + ((IgniteKernal)grid(i)).getCache(null).entrySet() + + assertEquals("Cache is not empty [entrySet=" + grid(i).cache(null).localEntries() + ", i=" + i + ']', - 0, ((IgniteKernal)grid(i)).getCache(null).size()); + 0, grid(i).cache(null).localSize()); for (int i = 0; i < gridCount(); i++) { @@ -418,7 +418,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo public void testLocalNodeOnly() throws Exception { IgniteCache<Integer, Integer> cache = grid(0).cache(null); - if (((IgniteKernal)grid(0)).getCache(null).configuration().getCacheMode() != PARTITIONED) + if (grid(0).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED) return; ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); @@ -488,7 +488,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo * @throws Exception If failed. */ public void testBuffering() throws Exception { - if (((IgniteKernal)grid(0)).getCache(null).configuration().getCacheMode() != PARTITIONED) + if (grid(0).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED) return; IgniteCache<Integer, Integer> cache = grid(0).cache(null); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java index 89a3186..7d60aeb 100644 --- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java +++ b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java @@ -19,14 +19,16 @@ package org.apache.ignite.internal.processors.query.h2; import com.vividsolutions.jts.geom.*; import com.vividsolutions.jts.io.*; +import org.apache.ignite.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.testframework.*; +import javax.cache.*; import java.io.*; import java.util.*; import java.util.concurrent.*; @@ -64,7 +66,7 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest { */ @SuppressWarnings("unchecked") public void testGeo() throws Exception { - GridCache<Integer, EnemyCamp> cache = ((IgniteKernal)grid(0)).getCache(null); + IgniteCache<Integer, EnemyCamp> cache = grid(0).cache(null); WKTReader r = new WKTReader(); @@ -73,46 +75,50 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest { cache.put(2, new EnemyCamp(r.read("POINT(70 30)"), "C")); cache.put(3, new EnemyCamp(r.read("POINT(75 25)"), "D")); - CacheQuery<Map.Entry<Integer, EnemyCamp>> qry = cache.queries().createSqlQuery(EnemyCamp.class, - "coords && ?"); + SqlQuery<Integer, EnemyCamp> query = new SqlQuery(EnemyCamp.class, "coords && ?"); - Collection<Map.Entry<Integer, EnemyCamp>> res = qry.execute(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))")) - .get(); + Collection<Cache.Entry<Integer, EnemyCamp>> res = cache.query( + query.setArgs(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))"))).getAll(); checkPoints(res, "A"); - res = qry.execute(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))")).get(); + res = cache.query( + query.setArgs(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))"))).getAll(); checkPoints(res, "C", "D"); // Move B to the first polygon. cache.put(1, new EnemyCamp(r.read("POINT(20 75)"), "B")); - res = qry.execute(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))")).get(); + res = cache.query( + query.setArgs(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))"))).getAll(); checkPoints(res, "A", "B"); // Move B to the second polygon. cache.put(1, new EnemyCamp(r.read("POINT(30 30)"), "B")); - res = qry.execute(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))")).get(); + res = cache.query( + query.setArgs(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))"))).getAll(); checkPoints(res, "B", "C", "D"); // Remove B. cache.remove(1); - res = qry.execute(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))")).get(); + res = cache.query( + query.setArgs(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))"))).getAll(); checkPoints(res, "A"); - res = qry.execute(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))")).get(); + res = cache.query( + query.setArgs(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))"))).getAll(); checkPoints(res, "C", "D"); // Check explaint request. - assertTrue(F.first(cache.queries().createSqlFieldsQuery("explain select * from EnemyCamp " + - "where coords && 'POINT(25 75)'").execute().get()).get(0).toString().contains("coords_idx")); + assertTrue(F.first(cache.query(new SqlFieldsQuery("explain select * from EnemyCamp " + + "where coords && 'POINT(25 75)'")).getAll()).get(0).toString().contains("coords_idx")); } /** @@ -120,9 +126,9 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest { */ @SuppressWarnings("unchecked") public void testGeoMultithreaded() throws Exception { - final GridCache<Integer, EnemyCamp> cache1 = ((IgniteKernal)grid(0)).getCache(null); - final GridCache<Integer, EnemyCamp> cache2 = ((IgniteKernal)grid(1)).getCache(null); - final GridCache<Integer, EnemyCamp> cache3 = ((IgniteKernal)grid(2)).getCache(null); + final IgniteCache<Integer, EnemyCamp> cache1 = grid(0).cache(null); + final IgniteCache<Integer, EnemyCamp> cache2 = grid(1).cache(null); + final IgniteCache<Integer, EnemyCamp> cache3 = grid(2).cache(null); final String[] points = new String[CNT]; @@ -153,7 +159,7 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest { while (!stop.get()) { int cacheIdx = rnd.nextInt(0, 3); - GridCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1 : cacheIdx == 1 ? cache2 : cache3; + IgniteCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1 : cacheIdx == 1 ? cache2 : cache3; int idx = rnd.nextInt(CNT); int x = rnd.nextInt(1, 100); @@ -178,13 +184,12 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest { try { int cacheIdx = rnd.nextInt(0, 3); - GridCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1 : cacheIdx == 1 ? cache2 : cache3; + IgniteCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1 : cacheIdx == 1 ? cache2 : cache3; - CacheQuery<Map.Entry<Integer, EnemyCamp>> qry = cache.queries().createSqlQuery( - EnemyCamp.class, "coords && ?"); + SqlQuery<Integer, EnemyCamp> qry = new SqlQuery<>(EnemyCamp.class, "coords && ?"); - Collection<Map.Entry<Integer, EnemyCamp>> res = qry.execute( - r.read("POLYGON((0 0, 0 100, 100 100, 100 0, 0 0))")).get(); + Collection<Cache.Entry<Integer, EnemyCamp>> res = cache.query(qry.setArgs( + r.read("POLYGON((0 0, 0 100, 100 100, 100 0, 0 0))"))).getAll(); checkPoints(res, points); @@ -222,12 +227,12 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest { * @param res Result. * @param points Expected points. */ - private void checkPoints( Collection<Map.Entry<Integer, EnemyCamp>> res, String... points) { + private void checkPoints( Collection<Cache.Entry<Integer, EnemyCamp>> res, String... points) { Set<String> set = new HashSet<>(Arrays.asList(points)); assertEquals(set.size(), res.size()); - for (Map.Entry<Integer, EnemyCamp> e : res) + for (Cache.Entry<Integer, EnemyCamp> e : res) assertTrue(set.remove(e.getValue().name)); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java index b84dbc9..f4ba51b 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java @@ -77,83 +77,4 @@ public class GridCacheReduceQueryMultithreadedSelfTest extends GridCacheAbstract return cfg; } - - /** - * @throws Exception In case of error. - */ - public void testReduceQuery() throws Exception { - final int keyCnt = 5000; - final int logFreq = 500; - - final GridCache<String, Integer> c = cache(); - - final CountDownLatch startLatch = new CountDownLatch(1); - - IgniteInternalFuture<?> fut1 = multithreadedAsync(new Callable() { - @Override public Object call() throws Exception { - for (int i = 1; i < keyCnt; i++) { - assertTrue(c.putx(String.valueOf(i), i)); - - startLatch.countDown(); - - if (i % logFreq == 0) - info("Stored entries: " + i); - } - - return null; - } - }, 1); - - // Create query. - final CacheQuery<Map.Entry<String, Integer>> sumQry = - c.queries().createSqlQuery(Integer.class, "_val > 0").timeout(TEST_TIMEOUT); - - final R1<Map.Entry<String, Integer>, Integer> rmtRdc = new R1<Map.Entry<String, Integer>, Integer>() { - /** */ - private AtomicInteger sum = new AtomicInteger(); - - @Override public boolean collect(Map.Entry<String, Integer> e) { - sum.addAndGet(e.getValue()); - - return true; - } - - @Override public Integer reduce() { - return sum.get(); - } - }; - - final AtomicBoolean stop = new AtomicBoolean(); - - startLatch.await(); - - IgniteInternalFuture<?> fut2 = multithreadedAsync(new Callable() { - @Override public Object call() throws Exception { - int cnt = 0; - - while (!stop.get()) { - Collection<Integer> res = sumQry.execute(rmtRdc).get(); - - int sum = F.sumInt(res); - - cnt++; - - assertTrue(sum > 0); - - if (cnt % logFreq == 0) { - info("Reduced value: " + sum); - info("Executed queries: " + cnt); - } - } - - return null; - } - }, 1); - - fut1.get(); - - stop.set(true); - - fut2.get(); - } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java index 3dfdfcb..9726058 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java @@ -89,9 +89,9 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { - cache().removeAll(); + jcache().removeAll(); - assert cache().isEmpty(); + assert jcache().localSize() == 0; assert size(ValueObject.class) == 0; STORE_MAP.clear(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java index e27e922..881d003 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java @@ -232,7 +232,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes final IgniteCache<Integer, String> c = g.cache(null); final IgniteCache<Integer, Long> cl = g.cache(null); - assertEquals(0, ((IgniteKernal)g).getCache(null).size()); + assertEquals(0, g.cache(null).localSize()); assertEquals(0, c.query(new SqlQuery(String.class, "1 = 1")).getAll().size()); assertEquals(0, cl.query(new SqlQuery(Long.class, "1 = 1")).getAll().size()); @@ -311,7 +311,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes final IgniteCache<Integer, Long> c = g.cache(null); final IgniteCache<Integer, String> c1 = g.cache(null); - assertEquals(0, ((IgniteKernal)g).getCache(null).size()); + assertEquals(0, g.cache(null).localSize()); assertEquals(0, c1.query(new SqlQuery(String.class, "1 = 1")).getAll().size()); assertEquals(0, c.query(new SqlQuery(Long.class, "1 = 1")).getAll().size()); @@ -464,7 +464,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes // Put test values into cache. final IgniteCache<Integer, TestValue> c = g.cache(null); - assertEquals(0, ((IgniteKernal)g).getCache(null).size()); + assertEquals(0, g.cache(null).localSize()); assertEquals(0, c.query(new SqlQuery(TestValue.class, "1 = 1")).getAll().size()); Random rnd = new Random(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5adc4d33/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java index a3171e8..b0434f9 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java @@ -118,42 +118,4 @@ public class GridCacheReplicatedFieldsQuerySelfTest extends GridCacheAbstractFie stopGrid(); } } - - /** - * @throws Exception If failed. - */ - public void testLostIterator() throws Exception { - GridCache<Integer, Integer> cache = ((IgniteKernal)grid(0)).getCache(null); - - CacheQueryFuture<List<?>> fut = null; - - for (int i = 0; i < GridCacheQueryManager.MAX_ITERATORS + 1; i++) { - CacheQuery<List<?>> q = cache.queries().createSqlFieldsQuery( - "select _key from Integer where _key >= 0 order by _key").projection(grid(0).cluster()); - - q.pageSize(50); - - CacheQueryFuture<List<?>> f = q.execute(); - - assertEquals(0, f.next().get(0)); - - if (fut == null) - fut = f; - } - - final CacheQueryFuture<List<?>> fut0 = fut; - - GridTestUtils.assertThrows(log, new Callable<Object>() { - @Override public Object call() throws Exception { - int i = 0; - - List<?> next; - - while ((next = fut0.next()) != null) - assertEquals(++i % 50, next.get(0)); - - return null; - } - }, IgniteException.class, null); - } }