ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [71/92] [abbrv] incubator-ignite git commit: # ignite-51
Date Fri, 06 Mar 2015 10:14:47 GMT
# ignite-51


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

Branch: refs/heads/ignite-user-req
Commit: 86c549f13ac26e732c36b4fde422f3f1ff5a3765
Parents: 440be6e
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Mar 5 17:54:05 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Mar 5 17:59:50 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheSwapManager.java  |  4 +-
 .../GridCacheOnCopyFlagAbstractSelfTest.java    | 57 ++++++++++++++++----
 2 files changed, 49 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c549f1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index 9d4b942..e75ccd6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1452,9 +1452,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
 
                 try {
                     if (cctx.isDht())
-                        cctx.dht().near().removex(cur.getKey(), CU.<K, V>empty());
+                        cctx.dht().near().removex(cur.getKey());
                     else
-                        cctx.cache().removex(cur.getKey(), CU.<K, V>empty());
+                        cctx.cache().removex(cur.getKey());
                 }
                 finally {
                     cur = null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c549f1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
index dd61b1d..20f7f58 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
@@ -31,6 +31,7 @@ import javax.cache.processor.*;
 import java.io.*;
 import java.util.*;
 
+import static org.apache.ignite.cache.CacheDistributionMode.*;
 import static org.junit.Assert.*;
 
 /**
@@ -68,7 +69,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
         super.afterTest();
 
         interceptor.delegate(new CacheInterceptorAdapter<TestKey, TestValue>());
-        
+
         for (int i = 0; i < gridCount(); i++)
             cache(i, null).clearLocally();
     }
@@ -95,10 +96,11 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
         assertNotNull(interceptor);
 
         ccfg.setInterceptor(interceptor);
-        
+
         ccfg.setAtomicityMode(atomicityMode());
         ccfg.setDistributionMode(distributionMode());
         ccfg.setCacheMode(cacheMode());
+        ccfg.setDistributionMode(PARTITIONED_ONLY);
 
         return ccfg;
     }
@@ -222,9 +224,9 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
             }
         });
 
-        for (int i = 0; i < ITER_CNT; i++) 
+        for (int i = 0; i < ITER_CNT; i++)
             cache.invoke(new TestKey(i, i), new EntryProcessor<TestKey, TestValue, Object>()
{
-                @Override public Object process(MutableEntry<TestKey, TestValue> entry,
Object... arguments) 
+                @Override public Object process(MutableEntry<TestKey, TestValue> entry,
Object... arguments)
                     throws EntryProcessorException {
                     // Check that we have correct value and key.
                     assertEquals(entry.getKey().key(), entry.getKey().field());
@@ -251,13 +253,42 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
     public void testPutGet() throws Exception {
         IgniteCache<TestKey, TestValue> cache = grid(0).jcache(null);
 
-        Map<Integer, TestValue> maps = new HashMap<>();
-        
-        for (int i = 0; i < ITER_CNT; i++) 
-            cache.put(new TestKey(i, i), new TestValue(i));
+        Map<TestKey, TestValue> map = new HashMap<>();
+
+        for (int i = 0; i < ITER_CNT; i++) {
+            TestKey key = new TestKey(i, i);
+            TestValue val = new TestValue(i);
+
+            cache.put(key, val);
+
+            map.put(key, val);
+        }
+
+        GridCacheAdapter cache0 = internalCache(cache);
+
+        GridCacheContext cctx = cache0.context();
+
+        for (Map.Entry<TestKey, TestValue> e : map.entrySet()) {
+            GridCacheEntryEx entry = cache0.peekEx(e.getKey());
 
-        for (Cache.Entry<Object, Object> entry : internalCache(0, null).entrySet())
-            assertNotSame(entry.getValue(), maps.get(((TestKey)entry.getKey()).key()));
+            assertNotNull("No entry for key: " + e.getKey(), entry);
+
+            TestKey key0 = entry.key().value(cctx.cacheObjectContext(), false);
+
+            assertNotSame(key0, e.getKey());
+
+            TestKey key1 = entry.key().value(cctx.cacheObjectContext(), true);
+
+            assertNotSame(key0, key1);
+
+            TestValue val0 = entry.rawGet().value(cctx.cacheObjectContext(), false);
+
+            assertNotSame(val0, e.getValue());
+
+            TestValue val1 = entry.rawGet().value(cctx.cacheObjectContext(), true);
+
+            assertNotSame(val0, val1);
+        }
     }
 
     /**
@@ -274,6 +305,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
          * Constructor.
          *
          * @param key Key.
+         * @param field Field.
          */
         public TestKey(int key, int field) {
             this.key = key;
@@ -337,6 +369,11 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
             key = in.readInt();
             field = in.readInt();
         }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return "TestKey [field=" + field + ", key=" + key + ']';
+        }
     }
 
     /**


Mime
View raw message