# ignite-sprint-6 more info in assert
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fffc2ecc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fffc2ecc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fffc2ecc Branch: refs/heads/ignite-1003-debug Commit: fffc2ecc86628a9a25c6f855d89277d124711873 Parents: af829d0 Author: sboikov <sboi...@gridgain.com> Authored: Thu Jun 18 08:57:39 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Thu Jun 18 08:57:39 2015 +0300 ---------------------------------------------------------------------- .../dht/GridDhtPartitionTopologyImpl.java | 4 +++- .../IgniteCacheP2pUnmarshallingTxErrorTest.java | 19 ++++++++++--------- .../junits/common/GridCommonAbstractTest.java | 8 ++++++-- 3 files changed, 19 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fffc2ecc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java index 374ab87..de7f876 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java @@ -620,7 +620,9 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { lock.readLock().lock(); try { - assert node2part != null && node2part.valid() : "Invalid node-to-partitions map [topVer=" + topVer + + assert node2part != null && node2part.valid() : "Invalid node-to-partitions map [topVer1=" + topVer + + ", topVer2=" + this.topVer + + ", cache=" + cctx.name() + ", node2part=" + node2part + ']'; Collection<ClusterNode> nodes = null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fffc2ecc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java index 017f7db..356d67b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingTxErrorTest.java @@ -26,11 +26,13 @@ import org.apache.ignite.transactions.*; import javax.cache.*; import java.io.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; + /** * Checks behavior on exception while unmarshalling key. */ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmarshallingErrorTest { - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return CacheAtomicityMode.TRANSACTIONAL; @@ -41,7 +43,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars IgniteConfiguration cfg = super.getConfiguration(gridName); if (!gridName.endsWith("0")) - cfg.getCacheConfiguration()[0].setRebalanceDelay(-1); //allows to check GridDhtLockRequest fail. + cfg.getCacheConfiguration()[0].setRebalanceDelay(-1); // Allows to check GridDhtLockRequest fail. return cfg; } @@ -52,8 +54,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars protected void failOptimistic() { IgniteCache<Object, Object> cache = jcache(0); - try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC, - TransactionIsolation.REPEATABLE_READ)) { + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { cache.put(new TestKey(String.valueOf(++key)), ""); @@ -65,7 +66,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars assert X.hasCause(e, IOException.class); } - assert readCnt.get() == 0; //ensure we have read count as expected. + assert readCnt.get() == 0; // Ensure we have read count as expected. } /** @@ -74,8 +75,8 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars protected void failPessimictic() { IgniteCache<Object, Object> cache = jcache(0); - try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC, - TransactionIsolation.REPEATABLE_READ)) { + try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, + REPEATABLE_READ)) { cache.put(new TestKey(String.valueOf(++key)), ""); @@ -85,7 +86,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars assert X.hasCause(e, IOException.class); } - assert readCnt.get() == 0; //ensure we have read count as expected. + assert readCnt.get() == 0; // Ensure we have read count as expected. } /** {@inheritDoc} */ @@ -108,7 +109,7 @@ public class IgniteCacheP2pUnmarshallingTxErrorTest extends IgniteCacheP2pUnmars //GridDhtLockRequest unmarshalling failed test readCnt.set(3); - try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { + try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { jcache(0).put(new TestKey(String.valueOf(++key)), ""); //No failure at client side. } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fffc2ecc/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java index bc33746..9941ca8 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java @@ -379,8 +379,10 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { int exp = affNodes.size(); - Collection<ClusterNode> owners = top.topologyVersion() == AffinityTopologyVersion.NONE ? - Collections.<ClusterNode>emptyList() : top.nodes(p, AffinityTopologyVersion.NONE); + GridDhtTopologyFuture topFut = top.topologyVersionFuture(); + + Collection<ClusterNode> owners = (topFut != null && topFut.isDone()) ? + top.nodes(p, AffinityTopologyVersion.NONE) : Collections.<ClusterNode>emptyList(); int actual = owners.size(); @@ -390,6 +392,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { ", cache=" + cfg.getName() + ", cacheId=" + dht.context().cacheId() + ", topVer=" + top.topologyVersion() + + ", topFut=" + topFut + ", p=" + p + ", affNodesCnt=" + exp + ", ownersCnt=" + actual + @@ -406,6 +409,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { ", cache=" + cfg.getName() + ", cacheId=" + dht.context().cacheId() + ", topVer=" + top.topologyVersion() + + ", topFut=" + topFut + ", p=" + p + ", affNodesCnt=" + exp + ", ownersCnt=" + actual +