Fixed test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b7bdfe20 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b7bdfe20 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b7bdfe20 Branch: refs/heads/ignite-843 Commit: b7bdfe20c9e0bc6b3fa3883223ef978562e4f2d3 Parents: db827cf Author: sboikov <[email protected]> Authored: Tue Sep 8 13:46:40 2015 +0300 Committer: sboikov <[email protected]> Committed: Tue Sep 8 13:46:40 2015 +0300 ---------------------------------------------------------------------- ...dCacheQueueMultiNodeConsistencySelfTest.java | 58 ++++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/b7bdfe20/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java index e26c9ef..2d817be 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeConsistencySelfTest.java @@ -28,6 +28,8 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMemoryMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.CollectionConfiguration; +import org.apache.ignite.internal.IgniteKernal; +import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.lang.IgniteCallable; import org.apache.ignite.resources.IgniteInstanceResource; @@ -47,9 +49,6 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends IgniteCollection /** */ protected static final int RETRIES = 20; - /** */ - private static final int PRELOAD_DELAY = 200; - /** Indicates whether force repartitioning is needed or not. */ private boolean forceRepartition; @@ -60,11 +59,6 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends IgniteCollection private int backups; /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-583"); - } - - /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { // No-op. } @@ -165,9 +159,23 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends IgniteCollection if (stopRandomGrid) stopGrid(1 + new Random().nextInt(GRID_CNT)); - if (forceRepartition) - for (int i = 0; i < GRID_CNT; i++) - jcache(i).rebalance(); + if (forceRepartition) { + for (int i = 0; i < GRID_CNT; i++) { + IgniteKernal ignite = (IgniteKernal)grid(i); + + boolean found = false; + + for (GridCacheContext ctx : ignite.context().cache().context().cacheContexts()) { + if (ctx.name() != null && ctx.name().startsWith("datastructures")) { + ctx.cache().rebalance().get(); + + found = true; + } + } + + assertTrue(found); + } + } Ignite newIgnite = startGrid(GRID_CNT + 1); @@ -175,26 +183,28 @@ public class GridCacheQueueMultiNodeConsistencySelfTest extends IgniteCollection // IgniteQueue<Integer> newQueue = newGrid.cache().queue(queueName); // assertTrue(CollectionUtils.isEqualCollection(queue0, newQueue)); - Collection<Integer> locQueueContent = compute(newIgnite.cluster().forLocal()).call(new IgniteCallable<Collection<Integer>>() { - @IgniteInstanceResource - private Ignite grid; + Collection<Integer> locQueueContent = compute(newIgnite.cluster().forLocal()).call( + new IgniteCallable<Collection<Integer>>() { + @IgniteInstanceResource + private Ignite grid; - /** {@inheritDoc} */ - @Override public Collection<Integer> call() throws Exception { - Collection<Integer> values = new ArrayList<>(); + /** {@inheritDoc} */ + @Override public Collection<Integer> call() throws Exception { + Collection<Integer> values = new ArrayList<>(); - grid.log().info("Running job [node=" + grid.cluster().localNode().id() + ", job=" + this + "]"); + grid.log().info("Running job [node=" + grid.cluster().localNode().id() + ", job=" + this + "]"); - IgniteQueue<Integer> locQueue = grid.queue(queueName, QUEUE_CAPACITY, config(false)); + IgniteQueue<Integer> locQueue = grid.queue(queueName, QUEUE_CAPACITY, config(false)); - grid.log().info("Queue size " + locQueue.size()); + grid.log().info("Queue size " + locQueue.size()); - for (Integer element : locQueue) - values.add(element); + for (Integer element : locQueue) + values.add(element); - return values; + return values; + } } - }); + ); assertTrue(CollectionUtils.isEqualCollection(queue0, locQueueContent));
