# IGNITE-56 Use IgniteCache in ignite-jta module.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ece021f6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ece021f6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ece021f6 Branch: refs/heads/sprint-1 Commit: ece021f6c3b6a92a12c574688cd4b44ccff847fb Parents: d1bdc72 Author: sevdokimov <[email protected]> Authored: Sun Feb 1 15:40:42 2015 +0300 Committer: sevdokimov <[email protected]> Committed: Sun Feb 1 15:40:42 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheJtaSelfTest.java | 34 +++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ece021f6/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaSelfTest.java index abd82d9..e88f76b 100644 --- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaSelfTest.java +++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaSelfTest.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.jta.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; import org.apache.ignite.transactions.*; import org.objectweb.jotm.*; @@ -106,39 +107,41 @@ public class GridCacheJtaSelfTest extends GridCacheAbstractSelfTest { public void testJta() throws Exception { UserTransaction jtaTx = jotm.getUserTransaction(); - assert cache().tx() == null; + IgniteCache<String, Integer> cache = jcache(); + + assert ignite(0).transactions().tx() == null; jtaTx.begin(); try { - assert cache().tx() == null; + assert ignite(0).transactions().tx() == null; - assert cache().put("key", 1) == null; + assert cache.getAndPut("key", 1) == null; - IgniteTx tx = cache().tx(); + IgniteTx tx = ignite(0).transactions().tx(); assert tx != null; assert tx.state() == ACTIVE; Integer one = 1; - assertEquals(one, cache().get("key")); + assertEquals(one, cache.get("key")); - tx = cache().tx(); + tx = ignite(0).transactions().tx(); assert tx != null; assert tx.state() == ACTIVE; jtaTx.commit(); - assert cache().tx() == null; + assert ignite(0).transactions().tx() == null; } finally { if (jtaTx.getStatus() == Status.STATUS_ACTIVE) jtaTx.rollback(); } - assertEquals((Integer)1, cache().get("key")); + assertEquals((Integer)1, cache.get("key")); } /** @@ -148,12 +151,13 @@ public class GridCacheJtaSelfTest extends GridCacheAbstractSelfTest { public void _testJtaTwoCaches() throws Exception { // TODO GG-9141 UserTransaction jtaTx = jotm.getUserTransaction(); - GridCache<String, Integer> cache1 = cache(); + IgniteEx ignite = grid(0); + + IgniteCache<String, Integer> cache1 = jcache(); - GridCache<String, Integer> cache2 = grid(0).cache("cache-2"); + IgniteCache<Object, Object> cache2 = ignite.jcache("cache-2"); - assertNull(cache1.tx()); - assertNull(cache2.tx()); + assertNull(ignite.transactions().tx()); jtaTx.begin(); @@ -164,13 +168,11 @@ public class GridCacheJtaSelfTest extends GridCacheAbstractSelfTest { assertEquals(1, (int)cache1.get("key")); assertEquals(1, (int)cache2.get("key")); - assertEquals(cache1.tx().state(), ACTIVE); - assertEquals(cache2.tx().state(), ACTIVE); + assertEquals(ignite.transactions().tx().state(), ACTIVE); jtaTx.commit(); - assertNull(cache1.tx()); - assertNull(cache2.tx()); + assertNull(ignite.transactions().tx()); assertEquals(1, (int)cache1.get("key")); assertEquals(1, (int)cache2.get("key"));
