You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by nt...@apache.org on 2015/07/03 14:15:18 UTC
[1/2] incubator-ignite git commit: IGNITE-901 Updated api block tests.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-901 c4abdf4ca -> bf97d042a
IGNITE-901 Updated api block tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3508bce5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3508bce5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3508bce5
Branch: refs/heads/ignite-901
Commit: 3508bce5a62b3bd6416f8f750509b5e11b5b7be8
Parents: 97a6224
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 3 15:15:14 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 3 15:15:14 2015 +0300
----------------------------------------------------------------------
.../IgniteClientReconnectAbstractTest.java | 13 +-
.../IgniteClientReconnectApiBlockTest.java | 268 +++++++++++++++++++
2 files changed, 272 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3508bce5/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
index 4e9bd0b..eac51c8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.managers.communication.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.plugin.extensions.communication.*;
+import org.apache.ignite.resources.*;
import org.apache.ignite.spi.*;
import org.apache.ignite.spi.communication.tcp.*;
import org.apache.ignite.spi.discovery.tcp.*;
@@ -60,7 +61,7 @@ public abstract class IgniteClientReconnectAbstractTest extends GridCommonAbstra
cfg.setDiscoverySpi(disco);
- BlockTpcCommunicationSpi commSpi = new BlockTpcCommunicationSpi(log);
+ BlockTpcCommunicationSpi commSpi = new BlockTpcCommunicationSpi();
cfg.setCommunicationSpi(commSpi);
@@ -189,14 +190,8 @@ public abstract class IgniteClientReconnectAbstractTest extends GridCommonAbstra
ConcurrentHashSet<String> classes = new ConcurrentHashSet<>();
/** */
- protected IgniteLogger log;
-
- /**
- * @param log Logger.
- */
- public BlockTpcCommunicationSpi(IgniteLogger log) {
- this.log = log;
- }
+ @LoggerResource
+ private IgniteLogger log;
/** {@inheritDoc} */
@Override public void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3508bce5/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiBlockTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiBlockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiBlockTest.java
index f9522a0..9aed13b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiBlockTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiBlockTest.java
@@ -81,6 +81,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.atomicLong("testAtomic", 41, true);
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.atomicLong("testAtomic", 41, true);
}
},
@@ -100,6 +113,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.set("testSet", new CollectionConfiguration());
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.set("testSet", new CollectionConfiguration());
}
},
@@ -124,6 +150,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.queue("TestQueue", 10, new CollectionConfiguration());
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.queue("TestQueue", 10, new CollectionConfiguration());
}
},
@@ -166,6 +205,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ defaultCache.getAndPut(9999, 9999);
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return defaultCache.getAndPut(9999, 9999);
}
},
@@ -183,6 +235,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ defaultCache.put(10000, 10000);
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
defaultCache.put(10000, 10000);
return true;
@@ -202,6 +267,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ defaultCache.get(10001);
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return defaultCache.get(10001);
}
},
@@ -217,6 +295,26 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ defaultCache.invoke(10000, new CacheEntryProcessor<Object, Object, Object>() {
+ @Override public Object process(MutableEntry<Object, Object> entry,
+ Object... arguments) throws EntryProcessorException {
+ assertTrue(entry.exists());
+
+ return (int)entry.getValue() * 2;
+ }
+ });
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return defaultCache.invoke(10000, new CacheEntryProcessor<Object, Object, Object>() {
@Override public Object process(MutableEntry<Object, Object> entry,
Object... arguments) throws EntryProcessorException {
@@ -243,6 +341,21 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
@Override public Object call() throws Exception {
IgniteCache<Object, Object> async = defaultCache.withAsync();
+ boolean failed = false;
+
+ try {
+ async.put(10002, 10002);
+
+ async.future().get();
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
async.put(10002, 10002);
return async.future().get();
@@ -262,6 +375,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.transactions();
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.transactions();
}
},
@@ -279,6 +405,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.cache(null);
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.cache(null);
}
},
@@ -300,6 +439,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.dataStreamer(null);
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.dataStreamer(null);
}
},
@@ -321,6 +473,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.createCache("test_cache");
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.createCache("test_cache");
}
},
@@ -345,6 +510,29 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
}
/**
+ * @param e Client disconnected exception.
+ */
+ private void checkAndWait(Exception e) {
+ log.info("Expected exception: " + e);
+
+ if (e instanceof IgniteClientDisconnectedException){
+ ((IgniteClientDisconnectedException)e).reconnectFuture().get();
+
+ return;
+ }
+
+ if (e.getCause() instanceof IgniteClientDisconnectedException) {
+ IgniteClientDisconnectedException e0 = (IgniteClientDisconnectedException)e.getCause();
+
+ e0.reconnectFuture().get();
+
+ return;
+ }
+
+ fail("Unexpected exception: " + e);
+ }
+
+ /**
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
@@ -364,6 +552,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.compute();
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.compute();
}
},
@@ -392,6 +593,19 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.cluster().pingNode(new UUID(0, 0));
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.cluster().pingNode(new UUID(0, 0));
}
},
@@ -409,6 +623,23 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.events().remoteListen(null, new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event event) {
+ return true;
+ }
+ });
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.events().remoteListen(null, new IgnitePredicate<Event>() {
@Override public boolean apply(Event event) {
return true;
@@ -432,6 +663,26 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.message().remoteListen(null, new IgniteBiPredicate<UUID, Object>() {
+ @Override public boolean apply(UUID uuid, Object o) {
+ if (o.equals("Test message."))
+ recvLatch.countDown();
+
+ return true;
+ }
+ });
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.message().remoteListen(null, new IgniteBiPredicate<UUID, Object>() {
@Override public boolean apply(UUID uuid, Object o) {
if (o.equals("Test message."))
@@ -465,6 +716,23 @@ public class IgniteClientReconnectApiBlockTest extends IgniteClientReconnectAbst
new T2<Callable, C1<Object, Boolean>>(
new Callable() {
@Override public Object call() throws Exception {
+ boolean failed = false;
+
+ try {
+ client.executorService().submit(new Callable<Integer>() {
+ @Override public Integer call() throws Exception {
+ return 42;
+ }
+ });
+ }
+ catch (Exception e) {
+ failed = true;
+
+ checkAndWait(e);
+ }
+
+ assertTrue(failed);
+
return client.executorService().submit(new Callable<Integer>() {
@Override public Integer call() throws Exception {
return 42;
[2/2] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-901' into ignite-901
Posted by nt...@apache.org.
Merge remote-tracking branch 'origin/ignite-901' into ignite-901
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bf97d042
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bf97d042
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bf97d042
Branch: refs/heads/ignite-901
Commit: bf97d042a669921f19c80dee0ef0d2009e4789e6
Parents: 3508bce c4abdf4
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 3 15:15:32 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 3 15:15:32 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheGateway.java | 4 +-
.../GridCachePartitionExchangeManager.java | 72 ++++++++++----------
.../datastructures/DataStructuresProcessor.java | 12 ++++
.../ignite/spi/discovery/tcp/ClientImpl.java | 4 +-
.../IgniteClientReconnectAbstractTest.java | 2 +-
.../IgniteClientReconnectAtomicsTest.java | 8 +--
.../IgniteClientReconnectCacheTest.java | 13 ++++
...IgniteClientReconnectDiscoveryStateTest.java | 4 +-
8 files changed, 73 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf97d042/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
----------------------------------------------------------------------