ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [32/48] incubator-ignite git commit: # sprint-2
Date Thu, 19 Feb 2015 18:43:54 GMT
# sprint-2


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

Branch: refs/heads/ignite-292
Commit: c93d86f9bb705172299160280c4f284d4dfb8cfc
Parents: f9193fb
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Feb 19 13:16:41 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Feb 19 13:16:41 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     |  2 +-
 .../cache/GridCacheVersionMultinodeTest.java    | 65 +++++++++++++++++---
 2 files changed, 58 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c93d86f9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 8e3fda9..a36f546 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -3533,7 +3533,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
             updateTtl(ttl);
 
             /*
-            TODO IGNITE-41.
+            TODO IGNITE-305.
             try {
                 if (var == null || ver.equals(version()))
                     updateTtl(ttl);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c93d86f9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
index 5101d75..78ba777 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
@@ -42,6 +43,9 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest
{
     /** */
     private CacheAtomicWriteOrderMode atomicWriteOrder;
 
+    /** */
+    private CacheDistributionMode distrMode = PARTITIONED_ONLY;
+
     /** {@inheritDoc} */
     @Override protected int gridCount() {
         return 3;
@@ -56,11 +60,15 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest
{
         ccfg.setAtomicityMode(atomicityMode);
 
         if (atomicityMode == null) {
-            assert atomicityMode != null;
+            assert atomicWriteOrder != null;
 
             ccfg.setAtomicWriteOrderMode(atomicWriteOrder);
         }
 
+        assert distrMode != null;
+
+        ccfg.setDistributionMode(distrMode);
+
         return ccfg;
     }
 
@@ -70,11 +78,6 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest
{
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheDistributionMode distributionMode() {
-        return PARTITIONED_ONLY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         // No-op.
     }
@@ -101,6 +104,17 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest
{
     /**
      * @throws Exception If failed.
      */
+    public void testVersionTxNearEnabled() throws Exception {
+        atomicityMode = TRANSACTIONAL;
+
+        distrMode = NEAR_PARTITIONED;
+
+        checkVersion();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testVersionAtomicClock() throws Exception {
         atomicityMode = ATOMIC;
 
@@ -112,6 +126,19 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest
{
     /**
      * @throws Exception If failed.
      */
+    public void testVersionAtomicClockNearEnabled() throws Exception {
+        atomicityMode = ATOMIC;
+
+        atomicWriteOrder = CLOCK;
+
+        distrMode = NEAR_PARTITIONED;
+
+        checkVersion();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testVersionAtomicPrimary() throws Exception {
         atomicityMode = ATOMIC;
 
@@ -123,6 +150,19 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest
{
     /**
      * @throws Exception If failed.
      */
+    public void testVersionAtomicPrimaryNearEnabled() throws Exception {
+        atomicityMode = ATOMIC;
+
+        atomicWriteOrder = PRIMARY;
+
+        distrMode = NEAR_PARTITIONED;
+
+        checkVersion();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     private void checkVersion() throws Exception {
         super.beforeTestsStarted();
 
@@ -188,13 +228,22 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest
{
 
             GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache();
 
+            GridCacheEntryEx<Object, Object> e;
+
             if (cache.affinity().isPrimaryOrBackup(grid.localNode(), key)) {
-                GridCacheEntryEx<Object, Object> e = cache.peekEx(key);
+                if (cache instanceof GridNearCacheAdapter)
+                    cache = ((GridNearCacheAdapter<Object, Object>)cache).dht();
+
+                e = cache.peekEx(key);
 
                 assertNotNull(e);
+            }
+            else
+                e = cache.peekEx(key);
 
+            if (e != null) {
                 if (ver != null) {
-                    assertEquals("Non-equal versions for key " + key, ver, e.version());
+                    assertEquals("Non-equal versions for key: " + key, ver, e.version());
 
                     verified = true;
                 }


Mime
View raw message