Repository: incubator-ignite Updated Branches: refs/heads/ignite-96-tests 95d2c9566 -> 0f437c1b8
# 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/0f437c1b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0f437c1b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0f437c1b Branch: refs/heads/ignite-96-tests Commit: 0f437c1b820ab1b872bfbe8c488dd306225b9325 Parents: 95d2c95 Author: sevdokimov <[email protected]> Authored: Tue Feb 10 15:05:40 2015 +0300 Committer: sevdokimov <[email protected]> Committed: Tue Feb 10 15:05:40 2015 +0300 ---------------------------------------------------------------------- .../cache/GridCacheObjectToStringSelfTest.java | 18 +++++------------- .../cache/GridCacheP2PUndeploySelfTest.java | 11 +++++------ .../cache/GridCacheSwapPreloadSelfTest.java | 2 +- ...ridCacheQueueMultiNodeConsistencySelfTest.java | 2 +- 4 files changed, 12 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f437c1b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java index 8a37a30..9e26e5f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java @@ -30,9 +30,6 @@ 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 static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; @@ -155,7 +152,7 @@ public class GridCacheObjectToStringSelfTest extends GridCommonAbstractTest { Ignite g = startGrid(0); try { - GridCache<Object, Object> cache = g.cache(null); + IgniteCache<Object, Object> cache = g.jcache(null); for (int i = 0; i < 10; i++) cache.put(i, i); @@ -167,22 +164,17 @@ public class GridCacheObjectToStringSelfTest extends GridCommonAbstractTest { assertFalse("Entry is locked after implicit transaction commit: " + entry, entry.lockedByAny()); } - Set<Cache.Entry<Object, Object>> entries = cache.entrySet(); - - assertNotNull(entries); - assertFalse(entries.toString().isEmpty()); + assertFalse(cache.toString().isEmpty()); + assertFalse(cache.iterator().toString().isEmpty()); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = g.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { assertEquals(1, cache.get(1)); cache.put(2, 22); assertFalse(tx.toString().isEmpty()); - entries = cache.entrySet(); - - assertNotNull(entries); - assertFalse(entries.toString().isEmpty()); + assertFalse(cache.toString().isEmpty()); tx.commit(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f437c1b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java index f3ceef4..fff6ae0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache; +import com.google.common.collect.*; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; @@ -206,8 +207,8 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest { Ignite ignite1 = startGrid(1); IgniteKernal grid2 = (IgniteKernal)startGrid(2); - GridCache<Integer, Object> cache1 = ignite1.cache(cacheName); - GridCache<Integer, Object> cache2 = grid2.cache(cacheName); + IgniteCache<Integer, Object> cache1 = ignite1.jcache(cacheName); + IgniteCache<Integer, Object> cache2 = grid2.jcache(cacheName); Object v1 = valCls.newInstance(); @@ -229,9 +230,7 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest { assert !v2.getClass().getClassLoader().equals(getClass().getClassLoader()); assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader"); - assert cache2.evict(2); - assert cache2.evict(3); - assert cache2.evict(4); + cache2.localEvict(ImmutableSet.of(2, 3, 4)); long swapSize = size(cacheName, grid2); @@ -286,7 +285,7 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest { * @throws InterruptedException If thread was interrupted. */ @SuppressWarnings({"BusyWait"}) - private boolean waitCacheEmpty(CacheProjection<Integer, Object> cache, long timeout) + private boolean waitCacheEmpty(IgniteCache<Integer, Object> cache, long timeout) throws InterruptedException { assert cache != null; assert timeout >= 0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f437c1b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java ---------------------------------------------------------------------- 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 d5669dc..5d1c960 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 @@ -195,7 +195,7 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest { done.set(true); - int size = grid(1).cache(null).size(); + int size = grid(1).jcache(null).localSize(); info("New node cache size: " + size); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f437c1b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java index 6beeb6e..8e2a288 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java @@ -150,7 +150,7 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends IgniteCollection if (forceRepartition) for (int i = 0; i < GRID_CNT; i++) - grid(i).cache(null).forceRepartition(); + cache(i).forceRepartition(); Ignite newIgnite = startGrid(GRID_CNT + 1);
