ignite-656: new transactional 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/e928b6a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e928b6a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e928b6a7

Branch: refs/heads/ignite-286
Commit: e928b6a7b89f293b4504eb4fea53de09eef5726d
Parents: 6105ed3
Author: Denis Magda <dma...@gridgain.com>
Authored: Tue Apr 14 14:46:27 2015 +0300
Committer: Denis Magda <dma...@gridgain.com>
Committed: Tue Apr 14 14:46:27 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAbstractFullApiSelfTest.java | 57 ++++++++++++++++++--
 1 file changed, 54 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e928b6a7/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 a133268..bf8edf0 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
@@ -4377,9 +4377,8 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
             assertTrue(map.containsKey(key));
         }
 
-        //cache.removeAll(); //TODO: doesn't work in transactional mode
-        cache.removeAll(data.keySet());
-
+        cache.removeAll();
+        
         for (String key : keys) {
             assertNull(cacheSkipStore.get(key));
             assertNull(cache.get(key));
@@ -4446,6 +4445,7 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
 
         IgniteTransactions txs = grid(0).transactions();
 
+        // Several put check
         Transaction tx = txs.txStart(txConcurrency, txIsolation);
 
         for (int i = 0; i < keys.size(); i++)
@@ -4459,6 +4459,7 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
 
         tx.commit();
 
+        // cacheSkipStore putAll(..)/removeAll(..) check
         tx = txs.txStart(txConcurrency, txIsolation);
 
         cacheSkipStore.putAll(data);
@@ -4469,6 +4470,56 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
             assertFalse(map.containsKey(key));
         }
 
+        cacheSkipStore.removeAll(data.keySet());
+
+        for (String key: keys) {
+            assertNull(cacheSkipStore.get(key));
+            assertNull(cache.get(key));
+            assertFalse(map.containsKey(key));
+        }
+
+        tx.commit();
+
+        // putAll(..) from both cacheSkipStore and cache
+        tx = txs.txStart(txConcurrency, txIsolation);
+
+        Map<String, Integer> map = new HashMap<>();
+
+        for (int i = 0; i < keys.size() / 2; i++)
+            map.put(keys.get(i), i);
+
+        cacheSkipStore.putAll(map);
+
+        map.clear();
+        for (int i = keys.size() / 2; i < keys.size(); i++)
+            map.put(keys.get(i), i);
+
+        cache.putAll(map);
+
+        for (int i = 0; i < keys.size() / 2; i++) {
+            String key = keys.get(i);
+
+            assertNotNull(cacheSkipStore.get(key));
+            assertNotNull(cache.get(key));
+            assertFalse(map.containsKey(key));
+        }
+
+        for (int i = keys.size() / 2; i < keys.size(); i++) {
+            String key = keys.get(i);
+
+            assertNotNull(cacheSkipStore.get(key));
+            assertNotNull(cache.get(key));
+            assertTrue(map.containsKey(key));
+        }
+
+        cache.removeAll();
+
+        for (String key: keys) {
+            assertNull(cacheSkipStore.get(key));
+            assertNull(cache.get(key));
+            assertFalse(map.containsKey(key));
+        }
+
         tx.commit();
     }
 

Reply via email to