[jbosscache-commits] JBoss Cache SVN: r5205 - core/trunk/src/test/java/org/jboss/cache/optimistic.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Jan 23 12:08:29 EST 2008


Author: manik.surtani at 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 at jboss.org">manik at jboss.org</a>)
  */
- at Test(groups = "functional")
+ at 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();




More information about the jbosscache-commits mailing list