Repository: incubator-ignite Updated Branches: refs/heads/ignite-961-master 952ac7246 -> c80e649cb
# master fix 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/192fefc2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/192fefc2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/192fefc2 Branch: refs/heads/ignite-961-master Commit: 192fefc2382d479a62504517cf3ddc8d5188657c Parents: f557728 Author: sboikov <sboi...@gridgain.com> Authored: Mon Jul 20 10:09:24 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Mon Jul 20 10:09:24 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheUtils.java | 4 +- .../ignite/internal/util/IgniteUtils.java | 4 +- .../IgniteClientReconnectFailoverTest.java | 47 ++++++++++++-------- .../cache/IgniteCacheNearLockValueSelfTest.java | 2 + 4 files changed, 32 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/192fefc2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java index bd2623d..e16e30d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java @@ -1561,9 +1561,7 @@ public class GridCacheUtils { */ @NotNull public static RuntimeException convertToCacheException(IgniteCheckedException e) { IgniteClientDisconnectedCheckedException disconnectedErr = - e instanceof IgniteClientDisconnectedCheckedException ? - (IgniteClientDisconnectedCheckedException)e - : e.getCause(IgniteClientDisconnectedCheckedException.class); + e.getCause(IgniteClientDisconnectedCheckedException.class); if (disconnectedErr != null) { assert disconnectedErr.reconnectFuture() != null : disconnectedErr; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/192fefc2/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 66eb596..42982b9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -691,9 +691,7 @@ public abstract class IgniteUtils { } IgniteClientDisconnectedCheckedException disconnectedErr = - e instanceof IgniteClientDisconnectedCheckedException ? - (IgniteClientDisconnectedCheckedException)e - : e.getCause(IgniteClientDisconnectedCheckedException.class); + e.getCause(IgniteClientDisconnectedCheckedException.class); if (disconnectedErr != null) { assert disconnectedErr.reconnectFuture() != null : disconnectedErr; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/192fefc2/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java index 7cfc329..b7de3eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java @@ -22,6 +22,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; +import javax.cache.*; import java.util.*; import java.util.concurrent.*; @@ -114,37 +115,45 @@ public class IgniteClientReconnectFailoverTest extends IgniteClientReconnectFail reconnectFailover(new Callable<Void>() { @Override public Void call() throws Exception { - TreeMap<Integer, Integer> map = new TreeMap<>(); + try { + TreeMap<Integer, Integer> map = new TreeMap<>(); - ThreadLocalRandom rnd = ThreadLocalRandom.current(); + ThreadLocalRandom rnd = ThreadLocalRandom.current(); - for (int i = 0; i < 5; i++) { - Integer key = rnd.nextInt(0, 100_000); + for (int i = 0; i < 5; i++) { + Integer key = rnd.nextInt(0, 100_000); - cache.put(key, key); + cache.put(key, key); - assertEquals(key, cache.get(key)); + assertEquals(key, cache.get(key)); - map.put(key, key); - } + map.put(key, key); + } - for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) { - try (Transaction tx = txs.txStart(txConcurrency, REPEATABLE_READ)) { - for (Map.Entry<Integer, Integer> e : map.entrySet()) { - cache.put(e.getKey(), e.getValue()); + for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) { + try (Transaction tx = txs.txStart(txConcurrency, REPEATABLE_READ)) { + for (Map.Entry<Integer, Integer> e : map.entrySet()) { + cache.put(e.getKey(), e.getValue()); - assertNotNull(cache.get(e.getKey())); - } + assertNotNull(cache.get(e.getKey())); + } - tx.commit(); + tx.commit(); + } } - } - cache.putAll(map); + cache.putAll(map); - Map<Integer, Integer> res = cache.getAll(map.keySet()); + Map<Integer, Integer> res = cache.getAll(map.keySet()); - assertEquals(map, res); + assertEquals(map, res); + } + catch (CacheException e) { + if (e.getCause() instanceof IgniteClientDisconnectedException) + throw e; + else + log.info("Ignore error: " + e); + } return null; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/192fefc2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java index cd04433..c500bbf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java @@ -49,6 +49,8 @@ public class IgniteCacheNearLockValueSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { super.afterTestsStopped(); + + stopAllGrids(); } /** {@inheritDoc} */