ignite-257: fixed most of the test. Only collocated and near tests are keep failing.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b5d85453 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b5d85453 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b5d85453 Branch: refs/heads/master Commit: b5d8545341aeb2b58904a4d9b4405b608d53baee Parents: e1707b6 Author: Denis Magda <dma...@gridgain.com> Authored: Fri Sep 11 10:16:50 2015 +0300 Committer: Denis Magda <dma...@gridgain.com> Committed: Fri Sep 11 10:16:50 2015 +0300 ---------------------------------------------------------------------- .../IgniteTxExceptionAbstractSelfTest.java | 29 ++++++++++++++------ .../GridCacheColocatedTxExceptionSelfTest.java | 20 ++++++++++---- .../near/GridCacheNearTxExceptionSelfTest.java | 2 +- .../GridCacheReplicatedTxExceptionSelfTest.java | 5 ---- .../GridCacheLocalTxExceptionSelfTest.java | 5 ---- 5 files changed, 37 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java index bdbc004..10b47fe 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java @@ -26,7 +26,9 @@ import javax.cache.Cache; import javax.cache.CacheException; import javax.cache.processor.EntryProcessor; import javax.cache.processor.MutableEntry; +import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; @@ -64,7 +66,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac private static final int NOT_PRIMARY_AND_BACKUP = 2; /** */ - private static Integer lastKey; + private static volatile Integer lastKey; /** {@inheritDoc} */ @Override protected int gridCount() { @@ -91,6 +93,8 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac ccfg.setWriteThrough(false); ccfg.setLoadPreviousValue(true); + ccfg.setIndexedTypes(Integer.class, Integer.class); + return ccfg; } @@ -105,8 +109,18 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac @Override protected void afterTest() throws Exception { idxSpi.forceFail(false); - for (int key = 0; key < lastKey; key++) + Transaction tx = jcache().unwrap(Ignite.class).transactions().tx(); + + if (tx != null) { + tx.close(); + + fail("Cache transaction remained after test completion: " + tx); + } + + for (int key = 0; key <= lastKey; key++) grid(0).cache(null).remove(key); + + assertEquals(0, jcache(0).size(CachePeekMode.ALL)); } /** {@inheritDoc} */ @@ -367,7 +381,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac info("Check key: " + key); for (int i = 0; i < gridCount(); i++) { - IgniteKernal grid = (IgniteKernal) grid(i); + IgniteKernal grid = (IgniteKernal)grid(i); GridCacheAdapter cache = grid.internalCache(null); @@ -383,9 +397,8 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac log.info("Dht entry: " + entry); - if (entry != null) { + if (entry != null) assertFalse("Unexpected entry for grid [i=" + i + ", entry=" + entry + ']', entry.lockedByAny()); - } } } } @@ -459,7 +472,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac } }, CacheException.class, null); - assertTrue("Unexpected cause: " +e, e.getCause() instanceof TransactionHeuristicException); + assertTrue("Unexpected cause: " + e, e.getCause() instanceof TransactionHeuristicException); checkUnlocked(key); } @@ -469,7 +482,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac * @param keys Keys. * @throws Exception If failed. */ - private void checkPutAll(boolean putBefore, Integer ... keys) throws Exception { + private void checkPutAll(boolean putBefore, Integer... keys) throws Exception { assert keys.length > 1; if (putBefore) { @@ -616,7 +629,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac } /** {@inheritDoc} */ - @Override public Iterator<Cache.Entry<?,?>> query(@Nullable String spaceName, Collection<Object> params, + @Override public Iterator<Cache.Entry<?, ?>> query(@Nullable String spaceName, Collection<Object> params, @Nullable IndexingQueryFilter filters) throws IgniteSpiException { throw new UnsupportedOperationException(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java index 5c1435f..86f32f3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java @@ -28,11 +28,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED; */ public class GridCacheColocatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest { /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-257"); - } - - /** {@inheritDoc} */ @Override protected CacheMode cacheMode() { return PARTITIONED; } @@ -41,4 +36,19 @@ public class GridCacheColocatedTxExceptionSelfTest extends IgniteTxExceptionAbst @Override protected NearCacheConfiguration nearConfiguration() { return null; } + + /** {@inheritDoc} */ + @Override public void testRemovePrimary() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-257"); + } + + /** {@inheritDoc} */ + @Override public void testPutPrimary() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-257"); + } + + /** {@inheritDoc} */ + @Override public void testTransformPrimary() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-257"); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java index 4cb47f4..67bccac 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java @@ -27,7 +27,7 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED; */ public class GridCacheNearTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest { /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { + @Override protected void beforeTestsStarted() throws Exception { fail("https://issues.apache.org/jira/browse/IGNITE-257"); } http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java index fa74043..1c96a4d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java @@ -28,11 +28,6 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED; */ public class GridCacheReplicatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest { /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-257"); - } - - /** {@inheritDoc} */ @Override protected CacheMode cacheMode() { return REPLICATED; } http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java index a112462..63a900d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java @@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; */ public class GridCacheLocalTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest { /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-257"); - } - - /** {@inheritDoc} */ @Override protected int gridCount() { return 1; }