Author: manik.surtani(a)jboss.com
Date: 2007-12-19 07:52:53 -0500 (Wed, 19 Dec 2007)
New Revision: 4876
Added:
core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java
Removed:
core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java
Log:
JBCACHE-1246 - memory leak when using fail silently option
Copied:
core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java
(from rev 4875,
core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java)
===================================================================
---
core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java
(rev 0)
+++
core/branches/1.4.X/tests/functional/org/jboss/cache/options/OptimisticMemLeakTest.java 2007-12-19
12:52:53 UTC (rev 4876)
@@ -0,0 +1,50 @@
+package org.jboss.cache.options;
+
+import junit.framework.TestCase;
+import org.jboss.cache.DummyTransactionManagerLookup;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.config.Option;
+
+import javax.transaction.TransactionManager;
+
+/**
+ * To test memory leak reported in
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112143#...
+ *
+ * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
+ */
+public class OptimisticMemLeakTest extends TestCase
+{
+ private TreeCache cache;
+ private TransactionManager tm;
+ private Fqn fqn = Fqn.fromString("/a/b/c");
+ private String key = "key", value = "value";
+
+ protected void tearDown()
+ {
+ cache.stop();
+ }
+
+ protected void setUp() throws Exception
+ {
+ cache = new TreeCache();
+ cache.setNodeLockingScheme("OPTIMISTIC");
+
cache.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache.startService();
+ tm = cache.getTransactionManager();
+ }
+
+ public void testLeakWithFailSilently() throws Exception
+ {
+ tm.begin();
+ Option option = new Option();
+ option.setFailSilently(true);
+ cache.put(fqn, key, value, option);
+ tm.commit();
+
+ int gtxCnt = cache.getTransactionTable().getNumGlobalTransactions();
+ int txCnt = cache.getTransactionTable().getNumLocalTransactions();
+ assertEquals("Global transaction count is > 0", 0, gtxCnt);
+ assertEquals("Local transaction count is > 0", 0, txCnt);
+ }
+}
Deleted:
core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java
===================================================================
---
core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java 2007-12-19
12:50:02 UTC (rev 4875)
+++
core/branches/1.4.X/tests/perf/org/jboss/cache/manualtests/OptimisticMemLeakTest.java 2007-12-19
12:52:53 UTC (rev 4876)
@@ -1,50 +0,0 @@
-package org.jboss.cache.manualtests;
-
-import junit.framework.TestCase;
-import org.jboss.cache.DummyTransactionManagerLookup;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.config.Option;
-
-import javax.transaction.TransactionManager;
-
-/**
- * To test memory leak reported in
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112143#...
- *
- * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
- */
-public class OptimisticMemLeakTest extends TestCase
-{
- private TreeCache cache;
- private TransactionManager tm;
- private Fqn fqn = Fqn.fromString("/a/b/c");
- private String key = "key", value = "value";
-
- protected void tearDown()
- {
- cache.stop();
- }
-
- protected void setUp() throws Exception
- {
- cache = new TreeCache();
- cache.setNodeLockingScheme("OPTIMISTIC");
-
cache.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
- cache.startService();
- tm = cache.getTransactionManager();
- }
-
- public void testLeakWithFailSilently() throws Exception
- {
- tm.begin();
- Option option = new Option();
- option.setFailSilently(true);
- cache.put(fqn, key, value, option);
- tm.commit();
-
- int gtxCnt = cache.getTransactionTable().getNumGlobalTransactions();
- int txCnt = cache.getTransactionTable().getNumLocalTransactions();
- assertEquals("Global transaction count is > 0", 0, gtxCnt);
- assertEquals("Local transaction count is > 0", 0, txCnt);
- }
-}