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 bdbc0048afc79..10b47fe63504a 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.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 @@ private void checkUnlocked(final Integer key) throws Exception { 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 @@ private void checkUnlocked(final Integer key) throws Exception { 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 @@ private void checkTransform(boolean putBefore, final Integer key) throws Excepti } }, 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 @@ private void checkTransform(boolean putBefore, final Integer key) throws Excepti * @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 void forceFail(boolean fail) { } /** {@inheritDoc} */ - @Override public Iterator> query(@Nullable String spaceName, Collection params, + @Override public Iterator> query(@Nullable String spaceName, Collection params, @Nullable IndexingQueryFilter filters) throws IgniteSpiException { throw new UnsupportedOperationException(); } 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 5c1435f686a48..86f32f3460a77 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 @@ -27,11 +27,6 @@ * Tests colocated cache. */ 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 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 4cb47f4d48929..67bccac5ade86 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 @@ */ 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"); } 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 fa7404340250a..1c96a4da6cfa7 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 @@ -27,11 +27,6 @@ * Tests replicated cache. */ 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; 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 a112462e77cb9..63a900dd1141d 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 @@ -26,11 +26,6 @@ * Tests local cache. */ 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;