#IGNITE-136 Fixed 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/23338a4c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/23338a4c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/23338a4c Branch: refs/heads/ignite-334 Commit: 23338a4c5f3f58a30ce6254c35602644f2222ca9 Parents: c3b7db8 Author: nikolay_tikhonov <ntikho...@gridgain.com> Authored: Tue Feb 24 16:53:10 2015 +0300 Committer: nikolay_tikhonov <ntikho...@gridgain.com> Committed: Tue Feb 24 16:53:35 2015 +0300 ---------------------------------------------------------------------- .../GridCacheAbstractLocalStoreSelfTest.java | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/23338a4c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java index ef33797..4b647a1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java @@ -24,6 +24,9 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.processors.cache.store.*; 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.junits.common.*; import org.jetbrains.annotations.*; @@ -43,6 +46,9 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; */ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbstractTest { /** */ + private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); + + /** */ public static final TestLocalStore<Integer, Integer> LOCAL_STORE_1 = new TestLocalStore<>(); /** */ @@ -74,6 +80,12 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst cfg.setCacheConfiguration(cacheCfg, cacheBackupCfg); + TcpDiscoverySpi spi = new TcpDiscoverySpi(); + + spi.setIpFinder(IP_FINDER); + + cfg.setDiscoverySpi(spi); + return cfg; } @@ -82,6 +94,10 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst super.afterTest(); stopAllGrids(); + + LOCAL_STORE_1.clear(); + LOCAL_STORE_2.clear(); + LOCAL_STORE_3.clear(); } private CacheConfiguration cache(String gridName, String cacheName, int backups) { @@ -151,6 +167,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst ignite1.events().localListen(new IgnitePredicate<Event>() { @Override public boolean apply(Event event) { startPartExchange.countDown(); + eventOcr.set(true); return true; @@ -174,7 +191,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst */ private void waitExpirePartition(CountDownLatch startPartExchange, AtomicBoolean eventOcr) throws Exception { if (getCacheMode() != REPLICATED) { - assert startPartExchange.await(1, TimeUnit.SECONDS); + assert startPartExchange.await(2, TimeUnit.SECONDS); while (true) { if (eventOcr.get()) { @@ -310,5 +327,12 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst for (Object key : keys) map.remove(key); } + + /** + * Clear store. + */ + public void clear(){ + map.clear(); + } } }