ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject incubator-ignite git commit: # IGNITE-56 Migration tests to IgniteCache
Date Mon, 09 Feb 2015 15:42:10 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-96-tests 05163cafd -> 2c2204d6d


# IGNITE-56 Migration 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/2c2204d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2c2204d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2c2204d6

Branch: refs/heads/ignite-96-tests
Commit: 2c2204d6d942e829cbc93d6cd16c6ba289088998
Parents: 05163ca
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Mon Feb 9 18:42:04 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Mon Feb 9 18:42:04 2015 +0300

----------------------------------------------------------------------
 .../GridCacheClientModesAbstractSelfTest.java   | 16 +++++++-------
 .../GridCacheEntrySetAbstractSelfTest.java      | 15 +++++++------
 .../distributed/GridCacheEventAbstractTest.java | 22 --------------------
 .../distributed/GridCacheMixedModeSelfTest.java |  5 +++--
 .../near/GridCacheNearOnlySelfTest.java         |  5 +++--
 5 files changed, 21 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c2204d6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
index 014c96a..a632d37 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
@@ -97,7 +97,7 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
      * @throws Exception If failed.
      */
     public void testPutFromClientNode() throws Exception {
-        GridCache<Object, Object> nearOnly = nearOnlyCache();
+        IgniteCache<Object, Object> nearOnly = nearOnlyCache();
 
         for (int i = 0; i < 5; i++)
             nearOnly.put(i, i);
@@ -113,7 +113,7 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
             if (nearEnabled())
                 assertEquals(key, nearOnly.peek(key));
 
-            assertNull(nearOnly.peek(key, F.asList(GridCachePeekMode.PARTITIONED_ONLY)));
+            assertNull(nearOnly.localPeek(key, CachePeekMode.PRIMARY, CachePeekMode.BACKUP));
         }
     }
 
@@ -121,12 +121,12 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
      * @throws Exception If failed.
      */
     public void testGetFromClientNode() throws Exception {
-        GridCache<Object, Object> dht = dhtCache();
+        IgniteCache<Object, Object> dht = dhtCache();
 
         for (int i = 0; i < 10; i++)
             dht.put(i, i);
 
-        GridCache<Object, Object> nearOnly = nearOnlyCache();
+        IgniteCache<Object, Object> nearOnly = nearOnlyCache();
 
         assert dht != nearOnly;
 
@@ -189,19 +189,19 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
     /**
      * @return Near only cache for this test.
      */
-    protected GridCache<Object, Object> nearOnlyCache() {
+    protected IgniteCache<Object, Object> nearOnlyCache() {
         assert nearOnlyGridName != null;
 
-        return G.ignite(nearOnlyGridName).cache(null);
+        return G.ignite(nearOnlyGridName).jcache(null);
     }
 
     /**
      * @return DHT cache for this test.
      */
-    protected GridCache<Object, Object> dhtCache() {
+    protected IgniteCache<Object, Object> dhtCache() {
         for (int i = 0; i < gridCount(); i++) {
             if (!nearOnlyGridName.equals(grid(i).name()))
-                return grid(i).cache(null);
+                return grid(i).jcache(null);
         }
 
         assert false : "Cannot find DHT cache for this test.";

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c2204d6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
index 7c0377b..31e6cd6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.distributed;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.testframework.*;
@@ -72,7 +73,7 @@ public abstract class GridCacheEntrySetAbstractSelfTest extends GridCacheAbstrac
 
                     log.info("Use cache " + idx);
 
-                    GridCache<Object, Object> cache = grid(idx).cache(null);
+                    IgniteCache<Object, Object> cache = grid(idx).jcache(null);
 
                     for (int i = 0; i < 100; i++)
                         putAndCheckEntrySet(cache);
@@ -90,8 +91,8 @@ public abstract class GridCacheEntrySetAbstractSelfTest extends GridCacheAbstrac
      * @param cache Cache.
      * @throws Exception If failed.
      */
-    private void putAndCheckEntrySet(GridCache<Object, Object> cache) throws Exception
{
-        try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+    private void putAndCheckEntrySet(IgniteCache<Object, Object> cache) throws Exception
{
+        try (IgniteTx tx = cache.unwrap(Ignite.class).transactions().txStart(PESSIMISTIC,
REPEATABLE_READ)) {
             Integer total = (Integer) cache.get(TX_KEY);
 
             if (total == null)
@@ -99,18 +100,16 @@ public abstract class GridCacheEntrySetAbstractSelfTest extends GridCacheAbstrac
 
             int cntr = 0;
 
-            Set<Cache.Entry<Object, Object>> entries = cache.entrySet();
-
-            for (Cache.Entry e : entries) {
+            for (Cache.Entry e : cache) {
                 if (e.getKey() instanceof Integer)
                     cntr++;
             }
 
             assertEquals(total, (Integer)cntr);
 
-            cache.putx(cntr + 1, cntr + 1);
+            cache.put(cntr + 1, cntr + 1);
 
-            cache.putx(TX_KEY, cntr + 1);
+            cache.put(TX_KEY, cntr + 1);
 
             tx.commit();
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c2204d6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
index 52b0044..bcf2746 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
@@ -200,28 +200,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
     /**
      * @throws Exception If test failed.
      */
-    public void testFilteredPut() throws Exception {
-        GridCache<String, Integer> cache = grid(0).cache(null);
-
-        String key = "1";
-        int val = 1;
-
-        assert !cache.putx(key, val, F.<String, Integer>cacheHasPeekValue());
-
-        assert !cache.containsKey(key);
-
-        assertEquals(0, TestEventListener.eventCount(EVT_CACHE_OBJECT_PUT));
-
-        assert cache.putx(key, val);
-
-        assert cache.containsKey(key);
-
-        waitForEvents(0, F.t(EVT_CACHE_OBJECT_PUT, gridCnt));
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
     public void testGetPutRemove() throws Exception {
         // TODO: GG-7578.
         if (jcache(0).getConfiguration(CacheConfiguration.class).getCacheMode() == CacheMode.REPLICATED)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c2204d6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
index 246ff85..d7fcee5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.distributed;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -64,7 +65,7 @@ public class GridCacheMixedModeSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testBasicOps() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
 
         for (int i = 0; i < 1000; i++)
             cache.put(i, i);
@@ -73,7 +74,7 @@ public class GridCacheMixedModeSelfTest extends GridCommonAbstractTest {
             assertEquals(i, cache.get(i));
 
         for (int i = 0; i < 1000; i++)
-            assertEquals(i, cache.remove(i));
+            assertEquals(i, cache.getAndRemove(i));
 
         for (int i = 0; i < 1000; i++)
             assertNull(cache.get(i));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c2204d6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlySelfTest.java
index 647a45b..089b85a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlySelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 
@@ -40,14 +41,14 @@ public class GridCacheNearOnlySelfTest extends GridCacheClientModesAbstractSelfT
      * @throws Exception If failed.
      */
     public void testUpdateNearOnlyReader() throws Exception {
-        GridCache<Object, Object> dhtCache = dhtCache();
+        IgniteCache<Object, Object> dhtCache = dhtCache();
 
         final int keyCnt = 100;
 
         for (int i = 0; i < keyCnt; i++)
             dhtCache.put(i, i);
 
-        GridCache<Object, Object> nearOnlyCache = nearOnlyCache();
+        IgniteCache<Object, Object> nearOnlyCache = nearOnlyCache();
 
         for (int i = 0; i < keyCnt; i++) {
             assertNull(nearOnlyCache.peek(i));


Mime
View raw message