Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISPN-845 - Memory leaks for 2 phase commit readonly transaction
- Loading branch information
1 parent
a4d542f
commit 73e3f5c
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
core/src/test/java/org/infinispan/tx/ReadOnlyTxCleanupTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.infinispan.tx; | ||
|
||
import org.infinispan.Cache; | ||
import org.infinispan.config.Configuration; | ||
import org.infinispan.manager.EmbeddedCacheManager; | ||
import org.infinispan.test.SingleCacheManagerTest; | ||
import org.infinispan.test.TestingUtil; | ||
import org.infinispan.test.fwk.CleanupAfterMethod; | ||
import org.infinispan.test.fwk.TestCacheManagerFactory; | ||
import org.infinispan.transaction.xa.TransactionTable; | ||
import org.testng.annotations.Test; | ||
|
||
import javax.transaction.HeuristicMixedException; | ||
import javax.transaction.HeuristicRollbackException; | ||
import javax.transaction.NotSupportedException; | ||
import javax.transaction.RollbackException; | ||
import javax.transaction.SystemException; | ||
import javax.transaction.TransactionManager; | ||
|
||
@Test(testName = "tx.ReadOnlyTxCleanupTest", groups = "functional") | ||
@CleanupAfterMethod | ||
public class ReadOnlyTxCleanupTest extends SingleCacheManagerTest { | ||
@Override | ||
protected EmbeddedCacheManager createCacheManager() throws Exception { | ||
Configuration c = new Configuration(); | ||
return TestCacheManagerFactory.createCacheManager(c, true); | ||
} | ||
|
||
public void testReadOnlyTx() throws SystemException, RollbackException, HeuristicRollbackException, HeuristicMixedException, NotSupportedException { | ||
Cache<String, String> c1 = cacheManager.getCache(); | ||
Cache<String, String> c2 = cacheManager.getCache("two"); | ||
|
||
c1.put("c1", "c1"); | ||
c2.put("c2", "c2"); | ||
|
||
TransactionManager tm1 = tm(); | ||
tm1.begin(); | ||
c1.get("c1"); | ||
c2.get("c2"); | ||
tm1.commit(); | ||
|
||
TransactionTable tt1 = TestingUtil.extractComponent(c1, TransactionTable.class); | ||
TransactionTable tt2 = TestingUtil.extractComponent(c2, TransactionTable.class); | ||
|
||
assert tt1.getLocalTxCount() == 0; | ||
assert tt2.getLocalTxCount() == 0; | ||
} | ||
|
||
} |