ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [31/50] ignite git commit: Added test.
Date Thu, 24 Sep 2015 23:12:07 GMT
Added test.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1942d758
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1942d758
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1942d758

Branch: refs/heads/ignite-257
Commit: 1942d75856ab6d317b743de71b53a29abf81316a
Parents: ca2bce0
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Sep 22 17:36:18 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Sep 22 17:36:18 2015 +0300

----------------------------------------------------------------------
 .../IgniteCachePutRetryAbstractSelfTest.java    | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1942d758/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index 943caeb..76f12c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -168,6 +168,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
     /**
      * @throws Exception If failed.
      */
+    public void testGetAndPut() throws Exception {
+        checkRetry(Test.GET_AND_PUT, TestMemoryMode.HEAP, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testPutStoreEnabled() throws Exception {
         checkRetry(Test.PUT, TestMemoryMode.HEAP, true);
     }
@@ -275,6 +282,29 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
                     break;
                 }
 
+                case GET_AND_PUT: {
+                    for (int i = 0; i < keysCnt; i++)
+                        cache.put(i, 0);
+
+                    while (System.currentTimeMillis() < stopTime) {
+                        Integer expOld = iter;
+
+                        Integer val = ++iter;
+
+                        for (int i = 0; i < keysCnt; i++) {
+                            Integer old = cache.getAndPut(i, val);
+
+                            assertTrue("Unexpected old value [old=" + old + ", exp=" + expOld
+ ']',
+                                expOld.equals(old) || val.equals(old));
+                        }
+
+                        for (int i = 0; i < keysCnt; i++)
+                            assertEquals(val, cache.get(i));
+                    }
+
+                    break;
+                }
+
                 case PUT_ALL: {
                     while (System.currentTimeMillis() < stopTime) {
                         Integer val = ++iter;
@@ -495,6 +525,9 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
         PUT,
 
         /** */
+        GET_AND_PUT,
+
+        /** */
         PUT_ALL,
 
         /** */


Mime
View raw message