http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java index 834be7f..23037d9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java @@ -45,6 +45,10 @@ import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.Nullable; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -55,6 +59,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.values; /** * */ +@RunWith(JUnit4.class) public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -66,6 +71,7 @@ public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest protected boolean client; /** {@inheritDoc} */ + @Before @Override public void setUp() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); @@ -95,6 +101,7 @@ public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testMultiNode() throws Exception { startGridsMultiThreaded(4);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java index 37f0879..35a2852 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java @@ -28,6 +28,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -37,6 +40,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * */ +@RunWith(JUnit4.class) public class IgniteCacheScanPredicateDeploymentSelfTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -87,6 +91,7 @@ public class IgniteCacheScanPredicateDeploymentSelfTest extends GridCommonAbstra /** * @throws Exception In case of error. */ + @Test public void testDeployScanPredicate() throws Exception { startGrids(4); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java index 436c198..b76130c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java @@ -28,6 +28,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -35,6 +38,7 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED; /** * */ +@RunWith(JUnit4.class) public class IgniteCacheSerializationSelfTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -83,6 +87,7 @@ public class IgniteCacheSerializationSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testSerializeClosure() throws Exception { Ignite client = ignite(CLIENT); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java index daa5d83..15467ee 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java @@ -27,11 +27,15 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test for dynamic cache start. */ @SuppressWarnings("unchecked") +@RunWith(JUnit4.class) public class IgniteCacheStartStopLoadTest extends GridCommonAbstractTest { /** */ private static final long DURATION = 20_000L; @@ -76,6 +80,7 @@ public class IgniteCacheStartStopLoadTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testMemoryLeaks() throws Exception { final Ignite ignite = ignite(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java index c889c31..ecc72eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java @@ -29,10 +29,14 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgniteCacheStartTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -71,6 +75,7 @@ public class IgniteCacheStartTest extends GridCommonAbstractTest { * @throws Exception If failed. */ @SuppressWarnings("unchecked") + @Test public void testStartAndNodeJoin() throws Exception { Ignite node0 = startGrid(0); @@ -103,6 +108,7 @@ public class IgniteCacheStartTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testStartFromJoiningNode1() throws Exception { checkStartFromJoiningNode(false); } @@ -110,6 +116,7 @@ public class IgniteCacheStartTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testStartFromJoiningNode2() throws Exception { checkStartFromJoiningNode(true); } http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java index 4210822..e2daaf4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java @@ -29,6 +29,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -38,6 +41,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; /** * */ +@RunWith(JUnit4.class) public class IgniteCacheStoreCollectionTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -84,6 +88,7 @@ public class IgniteCacheStoreCollectionTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testStoreMap() throws Exception { IgniteCache<Object, Object> cache1 = ignite(0).cache(CACHE1); IgniteCache<Object, Object> cache2 = ignite(0).cache(CACHE2); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java index bd259a5..f4ffb12 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java @@ -45,12 +45,16 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCach import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.testframework.GridTestUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * */ +@RunWith(JUnit4.class) public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstractTest { /** */ private boolean cpyOnRead; @@ -125,6 +129,7 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr /** * @throws Exception If failed. */ + @Test public void testValueNotStored() throws Exception { cpyOnRead = true; @@ -296,6 +301,7 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr /** * @throws Exception If failed. */ + @Test public void testValueStored() throws Exception { cpyOnRead = false; http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java index 06e6045..2ee30b1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTransactionalStopBusySelfTest.java @@ -18,12 +18,17 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Stopped node when client operations are executing. */ +@RunWith(JUnit4.class) public class IgniteCacheTransactionalStopBusySelfTest extends IgniteCacheAbstractStopBusySelfTest { /** {@inheritDoc} */ + @Test @Override public void testPut() throws Exception { bannedMsg.set(GridNearTxPrepareRequest.class); @@ -31,6 +36,7 @@ public class IgniteCacheTransactionalStopBusySelfTest extends IgniteCacheAbstrac } /** {@inheritDoc} */ + @Test @Override public void testPutBatch() throws Exception { bannedMsg.set(GridNearTxPrepareRequest.class); @@ -38,6 +44,7 @@ public class IgniteCacheTransactionalStopBusySelfTest extends IgniteCacheAbstrac } /** {@inheritDoc} */ + @Test @Override public void testPutAsync() throws Exception { bannedMsg.set(GridNearTxPrepareRequest.class); @@ -45,9 +52,10 @@ public class IgniteCacheTransactionalStopBusySelfTest extends IgniteCacheAbstrac } /** {@inheritDoc} */ + @Test @Override public void testRemove() throws Exception { bannedMsg.set(GridNearTxPrepareRequest.class); super.testPut(); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java index 27bf171..da32265 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.testframework.MvccFeatureChecker; +import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -27,6 +28,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; */ public class IgniteCacheTxCopyOnReadDisabledTest extends IgniteCacheCopyOnReadDisabledAbstractTest { /** {@inheritDoc} */ + @Before @Override public void setUp() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); @@ -36,4 +38,4 @@ public class IgniteCacheTxCopyOnReadDisabledTest extends IgniteCacheCopyOnReadDi @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java index 26dbb7e..2fc36dd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.testframework.MvccFeatureChecker; +import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.LOCAL; @@ -29,6 +30,7 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; */ public class IgniteCacheTxLocalPeekModesTest extends IgniteCachePeekModesAbstractTest { /** {@inheritDoc} */ + @Before @Override public void setUp() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE); @@ -49,4 +51,4 @@ public class IgniteCacheTxLocalPeekModesTest extends IgniteCachePeekModesAbstrac @Override protected CacheMode cacheMode() { return LOCAL; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java index a25fd90..9783fba 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java @@ -21,6 +21,7 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.MvccFeatureChecker; +import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.LOCAL; @@ -30,6 +31,7 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; */ public class IgniteCacheTxLocalStoreValueTest extends IgniteCacheStoreValueAbstractTest { /** {@inheritDoc} */ + @Before @Override public void setUp() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); @@ -55,4 +57,4 @@ public class IgniteCacheTxLocalStoreValueTest extends IgniteCacheStoreValueAbstr @Override protected NearCacheConfiguration nearConfiguration() { return null; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java index 4dc2cf3..787fa61 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java @@ -19,12 +19,14 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.MvccFeatureChecker; +import org.junit.Before; /** * */ public class IgniteCacheTxNearEnabledStoreValueTest extends IgniteCacheTxStoreValueTest { /** {@inheritDoc} */ + @Before @Override public void setUp() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); @@ -35,4 +37,4 @@ public class IgniteCacheTxNearEnabledStoreValueTest extends IgniteCacheTxStoreVa @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java index bd03983..8a396e3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java @@ -17,13 +17,20 @@ package org.apache.ignite.internal.processors.cache; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + import org.apache.ignite.testframework.MvccFeatureChecker; /** * Tests peek modes with near tx cache. */ +@RunWith(JUnit4.class) public class IgniteCacheTxNearPeekModesTest extends IgniteCacheTxPeekModesTest { /** {@inheritDoc} */ + @Before @Override public void setUp() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); @@ -36,6 +43,7 @@ public class IgniteCacheTxNearPeekModesTest extends IgniteCacheTxPeekModesTest { } /** {@inheritDoc} */ + @Test @Override public void testLocalPeek() throws Exception { // TODO: uncomment and re-open ticket if fails. // fail("https://issues.apache.org/jira/browse/IGNITE-1824"); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java index ebd0a96..44034e1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java @@ -30,6 +30,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -41,6 +44,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA /** * */ +@RunWith(JUnit4.class) public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest { /** */ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -80,6 +84,7 @@ public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testTxNoWrite() throws Exception { txNoWrite(true); } @@ -87,6 +92,7 @@ public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testTxNoWriteRollback() throws Exception { txNoWrite(false); } @@ -129,4 +135,4 @@ public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest { // Try to start one more node. startGrid(2); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java index f137e52..782d783 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java @@ -21,6 +21,7 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.MvccFeatureChecker; +import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -30,6 +31,7 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED; */ public class IgniteCacheTxStoreValueTest extends IgniteCacheStoreValueAbstractTest { /** {@inheritDoc} */ + @Before @Override public void setUp() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR); @@ -55,4 +57,4 @@ public class IgniteCacheTxStoreValueTest extends IgniteCacheStoreValueAbstractTe @Override protected NearCacheConfiguration nearConfiguration() { return null; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachingProviderSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachingProviderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachingProviderSelfTest.java index 37dda12..67f16b0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachingProviderSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachingProviderSelfTest.java @@ -28,10 +28,14 @@ import org.apache.ignite.cache.CachingProvider; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgniteCachingProviderSelfTest extends IgniteCacheAbstractTest { /** {@inheritDoc} */ @Override protected int gridCount() { @@ -90,6 +94,7 @@ public class IgniteCachingProviderSelfTest extends IgniteCacheAbstractTest { /** * */ + @Test public void testStartIgnite() { javax.cache.spi.CachingProvider cachingProvider = Caching.getCachingProvider(); @@ -118,6 +123,7 @@ public class IgniteCachingProviderSelfTest extends IgniteCacheAbstractTest { /** * @throws Exception If failed. */ + @Test public void testCloseManager() throws Exception { startGridsMultiThreaded(1); @@ -131,4 +137,4 @@ public class IgniteCachingProviderSelfTest extends IgniteCacheAbstractTest { assertNotSame(cacheMgr, cachingProvider.getCacheManager()); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java index 0a7a680..8f0199d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java @@ -33,10 +33,14 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Tests affinity assignment for different affinity types. */ +@RunWith(JUnit4.class) public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -75,6 +79,7 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe /** * @throws Exception If failed. */ + @Test public void testRendezvousAssignment() throws Exception { checkAffinityFunction(); } @@ -200,4 +205,4 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe assertEquals(topVer, cache.context().affinity().affinityTopologyVersion().topologyVersion()); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java index c6179fb..a30ae20 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java @@ -64,11 +64,15 @@ import org.apache.ignite.spi.indexing.IndexingQueryFilter; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test checks whether cache initialization error on client side * doesn't causes hangs and doesn't impact other caches. */ +@RunWith(JUnit4.class) public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractTest { /** Failed cache name. */ private static final String CACHE_NAME = "cache"; @@ -150,6 +154,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** * @throws Exception If failed. */ + @Test public void testAtomicCacheInitialization() throws Exception { checkCacheInitialization(ATOMIC_CACHE_NAME); } @@ -157,6 +162,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** * @throws Exception If failed. */ + @Test public void testTransactionalCacheInitialization() throws Exception { checkCacheInitialization(TX_CACHE_NAME); } @@ -164,6 +170,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** * @throws Exception If failed. */ + @Test public void testMvccTransactionalCacheInitialization() throws Exception { checkCacheInitialization(MVCC_TX_CACHE_NAME); } @@ -171,6 +178,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** * @throws Exception If failed. */ + @Test public void testAtomicNearCacheInitialization() throws Exception { checkCacheInitialization(NEAR_ATOMIC_CACHE_NAME); } @@ -178,6 +186,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** * @throws Exception If failed. */ + @Test public void testTransactionalNearCacheInitialization() throws Exception { checkCacheInitialization(NEAR_TX_CACHE_NAME); } @@ -185,6 +194,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** * @throws Exception If failed. */ + @Test public void testMvccTransactionalNearCacheInitialization() throws Exception { fail("https://issues.apache.org/jira/browse/IGNITE-7187"); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java index fa7d0a8..de18c44 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java @@ -53,6 +53,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -62,6 +65,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * */ +@RunWith(JUnit4.class) public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** */ protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -99,6 +103,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testClientStartCoordinatorFailsAtomic() throws Exception { clientStartCoordinatorFails(ATOMIC); } @@ -106,6 +111,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testClientStartCoordinatorFailsTx() throws Exception { clientStartCoordinatorFails(TRANSACTIONAL); } @@ -113,6 +119,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testClientStartCoordinatorFailsMvccTx() throws Exception { clientStartCoordinatorFails(TRANSACTIONAL_SNAPSHOT); } @@ -167,6 +174,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testClientStartLastServerFailsAtomic() throws Exception { clientStartLastServerFails(ATOMIC); } @@ -174,6 +182,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testClientStartLastServerFailsTx() throws Exception { clientStartLastServerFails(TRANSACTIONAL); } @@ -181,6 +190,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testClientStartLastServerFailsMvccTx() throws Exception { fail("https://issues.apache.org/jira/browse/IGNITE-10262"); @@ -273,6 +283,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testRebalanceState() throws Exception { final int SRVS = 3; @@ -344,6 +355,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testRebalanceStateConcurrentStart() throws Exception { final int SRVS1 = 3; final int CLIENTS = 5; @@ -438,6 +450,7 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testClientStartCloseServersRestart() throws Exception { final int SRVS = 4; final int CLIENTS = 4; http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java index cc65ada..c71d891 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java @@ -55,6 +55,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -63,6 +66,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * */ +@RunWith(JUnit4.class) public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -166,6 +170,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateSimple_SingleNode() throws Exception { activateSimple(1, 0, 0); } @@ -173,6 +178,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateSimple_5_Servers() throws Exception { activateSimple(5, 0, 0); } @@ -180,6 +186,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateSimple_5_Servers2() throws Exception { activateSimple(5, 0, 4); } @@ -187,6 +194,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateSimple_5_Servers_5_Clients() throws Exception { activateSimple(5, 4, 0); } @@ -194,6 +202,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateSimple_5_Servers_5_Clients_FromClient() throws Exception { activateSimple(5, 4, 6); } @@ -260,6 +269,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testReActivateSimple_5_Servers_4_Clients_FromClient() throws Exception { reactivateSimple(5, 4, 6); } @@ -267,6 +277,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testReActivateSimple_5_Servers_4_Clients_FromServer() throws Exception { reactivateSimple(5, 4, 0); } @@ -340,6 +351,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testJoinWhileActivate1_Server() throws Exception { joinWhileActivate1(false, false); } @@ -347,6 +359,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testJoinWhileActivate1_WithCache_Server() throws Exception { joinWhileActivate1(false, true); } @@ -354,6 +367,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testJoinWhileActivate1_Client() throws Exception { joinWhileActivate1(true, false); } @@ -488,6 +502,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testJoinWhileDeactivate1_Server() throws Exception { joinWhileDeactivate1(false, false); } @@ -495,6 +510,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testJoinWhileDeactivate1_WithCache_Server() throws Exception { joinWhileDeactivate1(false, true); } @@ -502,6 +518,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testJoinWhileDeactivate1_Client() throws Exception { joinWhileDeactivate1(true, false); } @@ -565,6 +582,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testConcurrentJoinAndActivate() throws Exception { for (int iter = 0; iter < 3; iter++) { log.info("Iteration: " + iter); @@ -615,6 +633,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateSimple_SingleNode() throws Exception { deactivateSimple(1, 0, 0); } @@ -622,6 +641,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateSimple_5_Servers() throws Exception { deactivateSimple(5, 0, 0); } @@ -629,6 +649,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateSimple_5_Servers2() throws Exception { deactivateSimple(5, 0, 4); } @@ -636,6 +657,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateSimple_5_Servers_5_Clients() throws Exception { deactivateSimple(5, 4, 0); } @@ -643,6 +665,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateSimple_5_Servers_5_Clients_FromClient() throws Exception { deactivateSimple(5, 4, 6); } @@ -732,6 +755,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testClientReconnectClusterActive() throws Exception { testReconnectSpi = true; @@ -770,6 +794,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testClientReconnectClusterInactive() throws Exception { testReconnectSpi = true; @@ -809,6 +834,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testClientReconnectClusterDeactivated() throws Exception { clientReconnectClusterDeactivated(false); } @@ -816,6 +842,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testClientReconnectClusterDeactivateInProgress() throws Exception { clientReconnectClusterDeactivated(true); } @@ -909,6 +936,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testClientReconnectClusterActivated() throws Exception { clientReconnectClusterActivated(false); } @@ -916,6 +944,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testClientReconnectClusterActivateInProgress() throws Exception { clientReconnectClusterActivated(true); } @@ -996,6 +1025,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testInactiveTopologyChanges() throws Exception { testSpi = true; @@ -1052,6 +1082,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateFailover1() throws Exception { stateChangeFailover1(true); } @@ -1059,6 +1090,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateFailover1() throws Exception { stateChangeFailover1(false); } @@ -1109,6 +1141,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateFailover2() throws Exception { stateChangeFailover2(true); } @@ -1116,6 +1149,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateFailover2() throws Exception { stateChangeFailover2(false); } @@ -1177,6 +1211,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testActivateFailover3() throws Exception { stateChangeFailover3(true); } @@ -1184,6 +1219,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testDeactivateFailover3() throws Exception { stateChangeFailover3(false); } @@ -1239,6 +1275,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testClusterStateNotWaitForDeactivation() throws Exception { testSpi = true; http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java index 4dc4f27..292a667 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java @@ -41,10 +41,14 @@ import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.testframework.GridTestUtils; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteClusterActivateDeactivateTest { /** {@inheritDoc} */ @Override protected boolean persistenceEnabled() { @@ -73,6 +77,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl /** * @throws Exception If failed. */ + @Test public void testActivateCachesRestore_SingleNode() throws Exception { activateCachesRestore(1, false); } @@ -80,6 +85,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl /** * @throws Exception If failed. */ + @Test public void testActivateCachesRestore_SingleNode_WithNewCaches() throws Exception { activateCachesRestore(1, true); } @@ -87,6 +93,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl /** * @throws Exception If failed. */ + @Test public void testActivateCachesRestore_5_Servers() throws Exception { activateCachesRestore(5, false); } @@ -94,6 +101,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl /** * @throws Exception If failed. */ + @Test public void testActivateCachesRestore_5_Servers_WithNewCaches() throws Exception { activateCachesRestore(5, true); } @@ -103,6 +111,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl * * @throws Exception If failed. */ + @Test public void testDeactivateInactiveCluster() throws Exception { ccfgs = new CacheConfiguration[] { new CacheConfiguration<>("test_cache_1") @@ -225,6 +234,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl /** * @see <a href="https://issues.apache.org/jira/browse/IGNITE-7330">IGNITE-7330</a> for more information about context of the test */ + @Test public void testClientJoinsWhenActivationIsInProgress() throws Exception { startGridsAndLoadData(5); @@ -283,6 +293,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl /** * @throws Exception If failed. */ + @Test public void testActivateCacheRestoreConfigurationConflict() throws Exception { final int SRVS = 3; @@ -319,6 +330,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl * * @throws Exception If failed. */ + @Test public void testDeactivateDuringEvictionAndRebalance() throws Exception { IgniteEx srv = (IgniteEx) startGrids(3); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java index 2f9bd53..f064724 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java @@ -28,6 +28,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; @@ -36,6 +39,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DAEMON; /** * */ +@RunWith(JUnit4.class) public class IgniteDaemonNodeMarshallerCacheTest extends GridCommonAbstractTest { /** */ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -64,6 +68,7 @@ public class IgniteDaemonNodeMarshallerCacheTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testMarshalOnDaemonNode1() throws Exception { marshalOnDaemonNode(true); } @@ -71,6 +76,7 @@ public class IgniteDaemonNodeMarshallerCacheTest extends GridCommonAbstractTest /** * @throws Exception If failed. */ + @Test public void testMarshalOnDaemonNode2() throws Exception { marshalOnDaemonNode(false); } @@ -191,4 +197,4 @@ public class IgniteDaemonNodeMarshallerCacheTest extends GridCommonAbstractTest this.val = val; } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java index 50f45a7..ec78c5e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java @@ -27,10 +27,14 @@ import org.apache.ignite.testframework.*; import org.apache.ignite.testframework.junits.common.*; import java.util.concurrent.*; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgniteDynamicCacheAndNodeStop extends GridCommonAbstractTest { /** */ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -54,6 +58,7 @@ public class IgniteDynamicCacheAndNodeStop extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testCacheAndNodeStop() throws Exception { final Ignite ignite = startGrid(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java index 4d74172..3a248eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java @@ -30,6 +30,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; @@ -38,6 +41,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * */ +@RunWith(JUnit4.class) public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -86,6 +90,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testCofiguredCacheFilter() throws Exception { attrVal = "A"; http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheMultinodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheMultinodeTest.java index fb1643e..1a37821 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheMultinodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheMultinodeTest.java @@ -31,6 +31,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -38,6 +41,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; /** * */ +@RunWith(JUnit4.class) public class IgniteDynamicCacheMultinodeTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -73,6 +77,7 @@ public class IgniteDynamicCacheMultinodeTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testGetOrCreateCache() throws Exception { createCacheMultinode(TestOp.GET_OR_CREATE_CACHE); } @@ -80,6 +85,7 @@ public class IgniteDynamicCacheMultinodeTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testGetOrCreateCaches() throws Exception { createCacheMultinode(TestOp.GET_OR_CREATE_CACHES); } http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java index 371c9d5..1a70e1d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java @@ -1,261 +1,266 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import javax.cache.CacheException; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteDataStreamer; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.affinity.AffinityFunctionContext; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.GridJobExecuteResponse; -import org.apache.ignite.internal.managers.communication.GridIoMessage; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.spi.IgniteSpiException; -import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; - -public class IgniteDynamicCacheStartCoordinatorFailoverTest extends GridCommonAbstractTest { - /** Default IP finder for single-JVM cloud grid. */ - private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); - - /** Latch which blocks DynamicCacheChangeFailureMessage until main thread has sent node fail signal. */ - private static volatile CountDownLatch latch; - - /** */ - private static final String COORDINATOR_ATTRIBUTE = "coordinator"; - - /** Client mode flag. */ - private Boolean appendCustomAttribute; - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - latch = new CountDownLatch(1); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - discoSpi.setIpFinder(ipFinder); - - cfg.setDiscoverySpi(discoSpi); - - TcpCommunicationSpi commSpi = new CustomCommunicationSpi(); - commSpi.setLocalPort(GridTestUtils.getNextCommPort(getClass())); - - cfg.setCommunicationSpi(commSpi); - - cfg.setFailureDetectionTimeout(15_000); - - if (appendCustomAttribute) { - Map<String, Object> attrs = new HashMap<>(); - - attrs.put(COORDINATOR_ATTRIBUTE, Boolean.TRUE); - - cfg.setUserAttributes(attrs); - } - - return cfg; - } - - /** - * Tests coordinator failover during cache start failure. - * - * @throws Exception If test failed. - */ - public void testCoordinatorFailure() throws Exception { - // Start coordinator node. - appendCustomAttribute = true; - - Ignite g = startGrid(0); - - appendCustomAttribute = false; - - Ignite g1 = startGrid(1); - Ignite g2 = startGrid(2); - - awaitPartitionMapExchange(); - - CacheConfiguration cfg = new CacheConfiguration(); - - cfg.setName("test-coordinator-failover"); - - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - - cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(2))); - - GridTestUtils.runAsync(new Callable<Object>() { - @Override public Object call() throws Exception { - GridTestUtils.assertThrows(log, new Callable<Object>() { - @Override public Object call() throws Exception { - g1.getOrCreateCache(cfg); - return null; - } - }, CacheException.class, null); - - return null; - } - }, "cache-starter-thread"); - - latch.await(); - - stopGrid(0, true); - - awaitPartitionMapExchange(); - - // Correct the cache configuration. - cfg.setAffinity(new RendezvousAffinityFunction()); - - IgniteCache cache = g1.getOrCreateCache(cfg); - - checkCacheOperations(g1, cache); - } - - /** - * Test the basic cache operations. - * - * @param cache Cache. - * @throws Exception If test failed. - */ - protected void checkCacheOperations(Ignite ignite, IgniteCache cache) throws Exception { - int cnt = 1000; - - // Check base cache operations. - for (int i = 0; i < cnt; ++i) - cache.put(i, i); - - for (int i = 0; i < cnt; ++i) { - Integer v = (Integer) cache.get(i); - - assertNotNull(v); - assertEquals(i, v.intValue()); - } - - // Check Data Streamer capabilities. - try (IgniteDataStreamer streamer = ignite.dataStreamer(cache.getName())) { - for (int i = 0; i < 10_000; ++i) - streamer.addData(i, i); - } - } - - /** - * Communication SPI which could optionally block outgoing messages. - */ - private static class CustomCommunicationSpi extends TcpCommunicationSpi { - /** - * Send message optionally either blocking it or throwing an exception if it is of - * {@link GridJobExecuteResponse} type. - * - * @param node Destination node. - * @param msg Message to be sent. - * @param ackClosure Ack closure. - * @throws org.apache.ignite.spi.IgniteSpiException If failed. - */ - @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure) - throws IgniteSpiException { - - if (msg instanceof GridIoMessage) { - GridIoMessage msg0 = (GridIoMessage)msg; - - if (msg0.message() instanceof GridDhtPartitionsSingleMessage) { - Boolean attr = (Boolean) node.attributes().get(COORDINATOR_ATTRIBUTE); - - GridDhtPartitionsSingleMessage singleMsg = (GridDhtPartitionsSingleMessage) msg0.message(); - - Exception err = singleMsg.getError(); - - if (Boolean.TRUE.equals(attr) && err != null) { - // skip message - latch.countDown(); - - return; - } - } - } - - super.sendMessage(node, msg, ackClosure); - } - } - - /** - * Affinity function that throws an exception when affinity nodes are calculated on the given node. - */ - public static class BrokenAffinityFunction extends RendezvousAffinityFunction { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - @IgniteInstanceResource - private Ignite ignite; - - /** Exception should arise on all nodes. */ - private boolean eOnAllNodes = false; - - /** Exception should arise on node with certain name. */ - private String gridName; - - /** - * Default constructor. - */ - public BrokenAffinityFunction() { - // No-op. - } - - /** - * @param eOnAllNodes {@code True} if exception should be thrown on all nodes. - * @param gridName Exception should arise on node with certain name. - */ - public BrokenAffinityFunction(boolean eOnAllNodes, String gridName) { - this.eOnAllNodes = eOnAllNodes; - this.gridName = gridName; - } - - /** {@inheritDoc} */ - @Override public List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx) { - if (eOnAllNodes || ignite.name().equals(gridName)) - throw new IllegalStateException("Simulated exception [locNodeId=" - + ignite.cluster().localNode().id() + "]"); - else - return super.assignPartitions(affCtx); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.CountDownLatch; +import javax.cache.CacheException; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.IgniteDataStreamer; +import org.apache.ignite.IgniteException; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.affinity.AffinityFunctionContext; +import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.GridJobExecuteResponse; +import org.apache.ignite.internal.managers.communication.GridIoMessage; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage; +import org.apache.ignite.lang.IgniteInClosure; +import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.resources.IgniteInstanceResource; +import org.apache.ignite.spi.IgniteSpiException; +import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; +import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; +import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; +import org.apache.ignite.testframework.GridTestUtils; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class IgniteDynamicCacheStartCoordinatorFailoverTest extends GridCommonAbstractTest { + /** Default IP finder for single-JVM cloud grid. */ + private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** Latch which blocks DynamicCacheChangeFailureMessage until main thread has sent node fail signal. */ + private static volatile CountDownLatch latch; + + /** */ + private static final String COORDINATOR_ATTRIBUTE = "coordinator"; + + /** Client mode flag. */ + private Boolean appendCustomAttribute; + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); + } + + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + latch = new CountDownLatch(1); + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + + TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); + discoSpi.setIpFinder(ipFinder); + + cfg.setDiscoverySpi(discoSpi); + + TcpCommunicationSpi commSpi = new CustomCommunicationSpi(); + commSpi.setLocalPort(GridTestUtils.getNextCommPort(getClass())); + + cfg.setCommunicationSpi(commSpi); + + cfg.setFailureDetectionTimeout(15_000); + + if (appendCustomAttribute) { + Map<String, Object> attrs = new HashMap<>(); + + attrs.put(COORDINATOR_ATTRIBUTE, Boolean.TRUE); + + cfg.setUserAttributes(attrs); + } + + return cfg; + } + + /** + * Tests coordinator failover during cache start failure. + * + * @throws Exception If test failed. + */ + @Test + public void testCoordinatorFailure() throws Exception { + // Start coordinator node. + appendCustomAttribute = true; + + Ignite g = startGrid(0); + + appendCustomAttribute = false; + + Ignite g1 = startGrid(1); + Ignite g2 = startGrid(2); + + awaitPartitionMapExchange(); + + CacheConfiguration cfg = new CacheConfiguration(); + + cfg.setName("test-coordinator-failover"); + + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); + + cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(2))); + + GridTestUtils.runAsync(new Callable<Object>() { + @Override public Object call() throws Exception { + GridTestUtils.assertThrows(log, new Callable<Object>() { + @Override public Object call() throws Exception { + g1.getOrCreateCache(cfg); + return null; + } + }, CacheException.class, null); + + return null; + } + }, "cache-starter-thread"); + + latch.await(); + + stopGrid(0, true); + + awaitPartitionMapExchange(); + + // Correct the cache configuration. + cfg.setAffinity(new RendezvousAffinityFunction()); + + IgniteCache cache = g1.getOrCreateCache(cfg); + + checkCacheOperations(g1, cache); + } + + /** + * Test the basic cache operations. + * + * @param cache Cache. + * @throws Exception If test failed. + */ + protected void checkCacheOperations(Ignite ignite, IgniteCache cache) throws Exception { + int cnt = 1000; + + // Check base cache operations. + for (int i = 0; i < cnt; ++i) + cache.put(i, i); + + for (int i = 0; i < cnt; ++i) { + Integer v = (Integer) cache.get(i); + + assertNotNull(v); + assertEquals(i, v.intValue()); + } + + // Check Data Streamer capabilities. + try (IgniteDataStreamer streamer = ignite.dataStreamer(cache.getName())) { + for (int i = 0; i < 10_000; ++i) + streamer.addData(i, i); + } + } + + /** + * Communication SPI which could optionally block outgoing messages. + */ + private static class CustomCommunicationSpi extends TcpCommunicationSpi { + /** + * Send message optionally either blocking it or throwing an exception if it is of + * {@link GridJobExecuteResponse} type. + * + * @param node Destination node. + * @param msg Message to be sent. + * @param ackClosure Ack closure. + * @throws org.apache.ignite.spi.IgniteSpiException If failed. + */ + @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure) + throws IgniteSpiException { + + if (msg instanceof GridIoMessage) { + GridIoMessage msg0 = (GridIoMessage)msg; + + if (msg0.message() instanceof GridDhtPartitionsSingleMessage) { + Boolean attr = (Boolean) node.attributes().get(COORDINATOR_ATTRIBUTE); + + GridDhtPartitionsSingleMessage singleMsg = (GridDhtPartitionsSingleMessage) msg0.message(); + + Exception err = singleMsg.getError(); + + if (Boolean.TRUE.equals(attr) && err != null) { + // skip message + latch.countDown(); + + return; + } + } + } + + super.sendMessage(node, msg, ackClosure); + } + } + + /** + * Affinity function that throws an exception when affinity nodes are calculated on the given node. + */ + public static class BrokenAffinityFunction extends RendezvousAffinityFunction { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + @IgniteInstanceResource + private Ignite ignite; + + /** Exception should arise on all nodes. */ + private boolean eOnAllNodes = false; + + /** Exception should arise on node with certain name. */ + private String gridName; + + /** + * Default constructor. + */ + public BrokenAffinityFunction() { + // No-op. + } + + /** + * @param eOnAllNodes {@code True} if exception should be thrown on all nodes. + * @param gridName Exception should arise on node with certain name. + */ + public BrokenAffinityFunction(boolean eOnAllNodes, String gridName) { + this.eOnAllNodes = eOnAllNodes; + this.gridName = gridName; + } + + /** {@inheritDoc} */ + @Override public List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx) { + if (eOnAllNodes || ignite.name().equals(gridName)) + throw new IllegalStateException("Simulated exception [locNodeId=" + + ignite.cluster().localNode().id() + "]"); + else + return super.assignPartitions(affCtx); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java index 4826119..d41dddf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java @@ -58,9 +58,6 @@ public class IgniteDynamicCacheStartFailWithPersistenceTest extends IgniteAbstra /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - if (MvccFeatureChecker.forcedMvcc()) - fail("https://issues.apache.org/jira/browse/IGNITE-10421"); - cleanPersistenceDir(); startGrids(gridCount()); @@ -71,6 +68,12 @@ public class IgniteDynamicCacheStartFailWithPersistenceTest extends IgniteAbstra } /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + if (MvccFeatureChecker.forcedMvcc()) + fail("https://issues.apache.org/jira/browse/IGNITE-10421"); + } + + /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { stopAllGrids(); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java index a00fd24..2b14c6c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java @@ -42,6 +42,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.NotNull; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -51,6 +54,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * */ +@RunWith(JUnit4.class) public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbstractTest { /** */ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -91,6 +95,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testMultinodeCacheStart() throws Exception { for (int i = 0; i < 10; i++) { log.info("Iteration: " + i); @@ -122,6 +127,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testOldestNotAffinityNode1() throws Exception { for (CacheConfiguration ccfg : cacheConfigurations()) oldestNotAffinityNode1(ccfg); @@ -150,6 +156,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testOldestNotAffinityNode2() throws Exception { for (CacheConfiguration ccfg : cacheConfigurations()) oldestNotAffinityNode2(ccfg); @@ -181,6 +188,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testNotAffinityNode1() throws Exception { for (CacheConfiguration ccfg : cacheConfigurations()) notAffinityNode1(ccfg); @@ -209,6 +217,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testNotAffinityNode2() throws Exception { for (CacheConfiguration ccfg : cacheConfigurations()) notAffinityNode2(ccfg); @@ -240,6 +249,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testOldestChanged1() throws Exception { IgniteEx ignite0 = grid(0); @@ -267,6 +277,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testOldestChanged2() throws Exception { IgniteEx ignite0 = grid(0); @@ -292,6 +303,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst /** * @throws Exception If failed. */ + @Test public void testOldestChanged3() throws Exception { IgniteEx ignite0 = grid(0); @@ -510,4 +522,4 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst super.sendMessage(node, msg, ackClosure); } } -} \ No newline at end of file +}