ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/2] ignite git commit: ignite-4705
Date Thu, 02 Mar 2017 21:08:20 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4705-2 30bfae0e6 -> 6c4394f09


http://git-wip-us.apache.org/repos/asf/ignite/blob/6c4394f0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
index 69e9348..f45474c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheEntryProcessor;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cluster.ClusterNode;
@@ -41,6 +42,8 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
+import javax.cache.processor.MutableEntry;
+
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -414,6 +417,83 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest
{
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testReplace() throws Exception {
+        final int SRVS = 2;
+
+        startGrids(SRVS);
+
+        client = true;
+
+        Ignite clientNode = startGrid(SRVS);
+
+        final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1,
FULL_SYNC));
+
+        awaitPartitionMapExchange();
+
+        Integer key = primaryKey(ignite(0).cache(TEST_CACHE));
+
+        nearCache.replace(key, 1);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRemove() throws Exception {
+        final int SRVS = 2;
+
+        startGrids(SRVS);
+
+        client = true;
+
+        Ignite clientNode = startGrid(SRVS);
+
+        final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1,
FULL_SYNC));
+
+        awaitPartitionMapExchange();
+
+        Integer key = primaryKey(ignite(0).cache(TEST_CACHE));
+
+        nearCache.remove(key);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRemoveAll() throws Exception {
+        // TODO IGNITE-4705 (some keys exist, some not).
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInvoke() throws Exception {
+        final int SRVS = 2;
+
+        startGrids(SRVS);
+
+        client = true;
+
+        Ignite clientNode = startGrid(SRVS);
+
+        final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1,
FULL_SYNC));
+
+        awaitPartitionMapExchange();
+
+        Integer key = primaryKey(ignite(0).cache(TEST_CACHE));
+
+        nearCache.invoke(key, new SetValueEntryProcessor(null));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInvokeAll() throws Exception {
+        // TODO IGNITE-4705 (some keys updated, some not).
+    }
+
+    /**
      * @param expData Expected cache data.
      */
     private void checkData(Map<Integer, Integer> expData) {
@@ -474,4 +554,27 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest
{
 
         return ccfg;
     }
+
+    /**
+     *
+     */
+    public static class SetValueEntryProcessor implements CacheEntryProcessor<Integer,
Integer, Object> {
+        /** */
+        private Integer val;
+
+        /**
+         * @param val Value.
+         */
+        public SetValueEntryProcessor(Integer val) {
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Integer, Integer> entry, Object...
args) {
+            if (val != null)
+                entry.setValue(val);
+
+            return null;
+        }
+    }
 }


Mime
View raw message