You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2014/12/16 16:12:12 UTC

[09/18] incubator-ignite git commit: GG-9141 - Fixed and enabled test.

GG-9141 - Fixed and enabled test.


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

Branch: refs/heads/ignite-41
Commit: 766e45cf279ce270a59b835efa5433b837bb4336
Parents: 62b9617
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Sun Dec 14 11:43:25 2014 -0800
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Sun Dec 14 11:43:25 2014 -0800

----------------------------------------------------------------------
 .../near/GridCacheNearOneNodeSelfTest.java      | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/766e45cf/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
index 10d438d..728336d 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
@@ -15,6 +15,7 @@ import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.gridgain.grid.cache.*;
 import org.gridgain.grid.cache.store.*;
+import org.gridgain.grid.kernal.processors.cache.*;
 import org.gridgain.testframework.junits.common.*;
 import org.jetbrains.annotations.*;
 
@@ -135,22 +136,24 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     @SuppressWarnings({"ConstantConditions"})
-    public void _testOptimisticTxWriteThrough() throws Exception { // TODO GG-9141
+    public void testOptimisticTxWriteThrough() throws Exception {
         GridCache<Integer, String> near = cache();
-        GridCache<Integer, String> dht = dht();
+        GridCacheAdapter<Integer, String> dht = dht();
 
-        GridCacheTx tx = cache().txStart(OPTIMISTIC, REPEATABLE_READ);
+        try (GridCacheTx tx = cache().txStart(OPTIMISTIC, REPEATABLE_READ) ) {
+            near.putx(2, "2");
+            near.put(3, "3");
 
-        near.putx(2, "2");
-        near.put(3, "3");
+            assert "2".equals(near.get(2));
+            assert "3".equals(near.get(3));
 
-        assert "2".equals(near.get(2));
-        assert "3".equals(near.get(3));
+            GridCacheEntryEx<Integer, String> entry = dht.peekEx(2);
 
-        assert dht.peek(2) == null;
-        assert dht.peek(3) != null;
+            assert entry == null || entry.rawGetOrUnmarshal(false) == null : "Invalid entry: " + entry;
+            assert dht.peek(3) != null;
 
-        tx.commit();
+            tx.commit();
+        }
 
         assert "2".equals(near.get(2));
         assert "3".equals(near.get(3));