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 2016/11/24 07:45:11 UTC
ignite git commit: ignite-3955 added test
Repository: ignite
Updated Branches:
refs/heads/master 93c3ccd01 -> 91385256a
ignite-3955 added test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/91385256
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/91385256
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/91385256
Branch: refs/heads/master
Commit: 91385256a55f083d8973e5d5b0445f28182d36f2
Parents: 93c3ccd
Author: sboikov <sb...@gridgain.com>
Authored: Thu Nov 24 10:45:03 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Nov 24 10:45:03 2016 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractFullApiSelfTest.java | 36 ++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/91385256/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index b328960..be8de79 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.cache;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -47,8 +49,6 @@ import javax.cache.processor.EntryProcessor;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.EntryProcessorResult;
import javax.cache.processor.MutableEntry;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
import junit.framework.AssertionFailedError;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
@@ -105,6 +105,7 @@ import org.apache.ignite.transactions.TransactionIsolation;
import org.jetbrains.annotations.Nullable;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
@@ -311,6 +312,37 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * Checks that any invoke returns result.
+ *
+ * @throws Exception if something goes bad.
+ */
+ public void testInvokeAllMultithreaded() throws Exception {
+ final IgniteCache<String, Integer> cache = jcache();
+ final int threadCnt = 4;
+ final int cnt = 5000;
+
+ // Concurrent invoke can not be used for ATOMIC cache in CLOCK mode.
+ if (atomicityMode() == ATOMIC &&
+ cacheMode() != LOCAL &&
+ cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode() == CLOCK)
+ return;
+
+ final Set<String> keys = Collections.singleton("myKey");
+
+ GridTestUtils.runMultiThreaded(new Runnable() {
+ @Override public void run() {
+ for (int i = 0; i < cnt; i++) {
+ final Map<String, EntryProcessorResult<String>> res = cache.invokeAll(keys, INCR_PROCESSOR);
+
+ assertEquals(1, res.size());
+ }
+ }
+ }, threadCnt, "testInvokeAllMultithreaded");
+
+ assertEquals(cnt * threadCnt, (int)cache.get("myKey"));
+ }
+
+ /**
* Checks that skipStore flag gets overridden inside a transaction.
*/
public void testWriteThroughTx() {