[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/optimistic ...
Manik Surtani
msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 16:28:50 EDT 2006
User: msurtani
Date: 06/08/30 16:28:50
Modified: tests/functional/org/jboss/cache/optimistic
AbstractOptimisticTestCase.java
OptimisticWithCacheLoaderTest.java
Log:
fixed up some unit tests
Revision Changes Path
1.37 +6 -0 JBossCache/tests/functional/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractOptimisticTestCase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- AbstractOptimisticTestCase.java 30 Aug 2006 18:32:17 -0000 1.36
+++ AbstractOptimisticTestCase.java 30 Aug 2006 20:28:50 -0000 1.37
@@ -10,6 +10,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.transaction.DummyTransactionManager;
import org.jboss.cache.xml.XmlHelper;
import org.w3c.dom.Element;
@@ -268,6 +269,11 @@
TestingUtil.sleepThread(l);
}
+ protected void tearDown()
+ {
+ DummyTransactionManager.getInstance().setTransaction(null);
+ }
+
public abstract class ExceptionThread extends Thread
{
protected Exception exception;
1.13 +231 -224 JBossCache/tests/functional/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticWithCacheLoaderTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- OptimisticWithCacheLoaderTest.java 25 Apr 2006 15:18:29 -0000 1.12
+++ OptimisticWithCacheLoaderTest.java 30 Aug 2006 20:28:50 -0000 1.13
@@ -26,6 +26,7 @@
super(s);
}
+
public void testLoaderIndependently() throws Exception
{
TreeCache cache = createCacheWithLoader();
@@ -43,14 +44,17 @@
public void testCacheLoadOnTree() throws Exception
{
+ CacheLoader loader = null;
+ try
+ {
TreeCache cache = createCacheWithLoader();
- CacheLoader loader = cache.getCacheLoader();
+ loader = cache.getCacheLoader();
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
Transaction tx;
// make sure the fqn is not in cache
- Assert.assertNull(cache.get(fqn));
+ assertNull(cache.get(fqn));
// put something in the loader and make sure all tx's can see it
loader.put(fqn, key, value);
@@ -58,20 +62,23 @@
// start the 1st tx
mgr.begin();
tx = mgr.getTransaction();
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.suspend();
// start a new tx
mgr.begin();
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.commit();
mgr.resume(tx);
- Assert.assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, cache.get(fqn, key));
mgr.commit();
-
+ }
+ finally
+ {
// cleanup
- loader.remove(fqn);
+ if (loader != null) loader.remove(fqn);
+ }
}
public void testCacheStoring() throws Exception
More information about the jboss-cvs-commits
mailing list