Author: manik.surtani(a)jboss.com
Date: 2008-01-23 12:08:28 -0500 (Wed, 23 Jan 2008)
New Revision: 5205
Modified:
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
Log:
Added a test method and added this test to the 'transaction' group
Modified:
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java 2008-01-23
17:08:03 UTC (rev 5204)
+++
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java 2008-01-23
17:08:28 UTC (rev 5205)
@@ -19,7 +19,7 @@
*
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
*/
-@Test(groups = "functional")
+@Test(groups = {"functional", "transaction"})
public class OptimisticWithCacheLoaderTest extends AbstractOptimisticTestCase
{
@@ -124,6 +124,38 @@
loader.remove(fqn);
}
+
+ public void testCacheStoringImplicitTx() throws Exception
+ {
+ CacheSPI<Object, Object> cache = createCacheWithLoader();
+ CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
+
+ // test the cache ...
+ DummyTransactionManager mgr = DummyTransactionManager.getInstance();
+ assertNull(mgr.getTransaction());
+ cache.put(fqn, key, value);
+
+ assertEquals(value, cache.get(fqn, key));
+
+ //now lets see if the state has been persisted in the cache loader
+ assertEquals(value, loader.get(fqn).get(key));
+
+
+ cache.removeNode(fqn);
+
+ assertNull(cache.get(fqn, key));
+ //now lets see if the state has been persisted in the cache loader
+ assertNull(loader.get(fqn));
+
+ cache.put(fqn, key, value);
+
+ assertEquals(value, cache.get(fqn, key));
+ assertEquals(value, loader.get(fqn).get(key));
+
+ // clean up loader
+ loader.remove(fqn);
+ }
+
public void testCacheLoading() throws Exception
{
CacheSPI<Object, Object> cache = createCacheWithLoader();
Show replies by date