# sprint-5 use vm ip finder in test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c3bf8031 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c3bf8031 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c3bf8031 Branch: refs/heads/ignite-868 Commit: c3bf803132c9d048f9f5236339eb71ed24d28625 Parents: e16cb03 Author: sboikov <sboi...@gridgain.com> Authored: Thu May 28 09:06:04 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Thu May 28 09:06:04 2015 +0300 ---------------------------------------------------------------------- .../cache/IgniteDynamicCacheStartSelfTest.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c3bf8031/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java index 72b76d7..095221e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java @@ -26,6 +26,9 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.discovery.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.*; import org.apache.ignite.testframework.junits.common.*; @@ -40,6 +43,9 @@ import java.util.concurrent.atomic.*; @SuppressWarnings("unchecked") public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { /** */ + private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** */ private static final String DYNAMIC_CACHE_NAME = "TestDynamicCache"; /** */ @@ -51,8 +57,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { /** */ public static final IgnitePredicate<ClusterNode> NODE_FILTER = new IgnitePredicate<ClusterNode>() { /** {@inheritDoc} */ - @Override - public boolean apply(ClusterNode n) { + @Override public boolean apply(ClusterNode n) { Boolean val = n.attribute(TEST_ATTRIBUTE_NAME); return val != null && val; @@ -78,6 +83,8 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); + ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder); + cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE_NAME, testAttribute)); CacheConfiguration cacheCfg = new CacheConfiguration(); @@ -157,8 +164,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { futs.clear(); GridTestUtils.runMultiThreaded(new Callable<Object>() { - @Override - public Object call() throws Exception { + @Override public Object call() throws Exception { futs.add(kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME)); return null; @@ -218,8 +224,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { futs.clear(); GridTestUtils.runMultiThreaded(new Callable<Object>() { - @Override - public Object call() throws Exception { + @Override public Object call() throws Exception { IgniteEx kernal = grid(ThreadLocalRandom.current().nextInt(nodeCount())); futs.add(kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME)); @@ -940,8 +945,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { latches[i] = new CountDownLatch(1); lsnrs[i] = new IgnitePredicate<CacheEvent>() { - @Override - public boolean apply(CacheEvent e) { + @Override public boolean apply(CacheEvent e) { switch (e.type()) { case EventType.EVT_CACHE_NODES_LEFT: latches[idx].countDown();