[jbosscache-commits] JBoss Cache SVN: r7443 - core/trunk/src/test/java/org/jboss/cache/integration/websession/util.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Sat Jan 10 22:08:46 EST 2009


Author: mircea.markus
Date: 2009-01-10 22:08:46 -0500 (Sat, 10 Jan 2009)
New Revision: 7443

Modified:
   core/trunk/src/test/java/org/jboss/cache/integration/websession/util/BuddyReplicationAssertions.java
Log:
also validate the cache loader

Modified: core/trunk/src/test/java/org/jboss/cache/integration/websession/util/BuddyReplicationAssertions.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/websession/util/BuddyReplicationAssertions.java	2009-01-11 03:06:17 UTC (rev 7442)
+++ core/trunk/src/test/java/org/jboss/cache/integration/websession/util/BuddyReplicationAssertions.java	2009-01-11 03:08:46 UTC (rev 7443)
@@ -27,6 +27,9 @@
 import org.jboss.cache.Cache;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.loader.CacheLoader;
+import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
 
@@ -36,7 +39,7 @@
  */
 public class BuddyReplicationAssertions
 {
-   public static void assertBuddyBackup(String contextHostName, String sessionId, Cache<Object, Object> owner, Cache<Object, Object> backup)
+   public static void assertBuddyBackup(String contextHostName, String sessionId, Cache<Object, Object> owner, Cache<Object, Object> backup) throws Exception
    {
       Fqn<String> fqn = Fqn.fromElements(FqnUtil.JSESSION, contextHostName, sessionId);
       Map<Object, Object> owned = owner.getData(fqn);
@@ -59,21 +62,23 @@
       assertBuddyTreeClear(contextHostName, sessionId, owner);
    }
    
-   public static void assertUnrelated(String contextHostName, String sessionId, Cache<Object, Object> cache)
+   public static void assertUnrelated(String contextHostName, String sessionId, Cache<Object, Object> cache) throws Exception
    {
       assertMainTreeClear(contextHostName, sessionId, cache);
       assertBuddyTreeClear(contextHostName, sessionId, cache);
    }
    
-   public static void assertMainTreeClear(String contextHostName, String sessionId, Cache<Object, Object> cache)
+   public static void assertMainTreeClear(String contextHostName, String sessionId, Cache<Object, Object> cache) throws Exception
    {
       Fqn<String> fqn = Fqn.fromElements(FqnUtil.JSESSION, contextHostName, sessionId);
+      verifyCacheLoader(cache, fqn);
       assert cache.getNode(fqn) == null : "found node for " + fqn + " on cache instance " + cache.getLocalAddress();
    }
-   
-   public static void assertBuddyTreeClear(String contextHostName, String sessionId, Cache<Object, Object> cache)
+
+   public static void assertBuddyTreeClear(String contextHostName, String sessionId, Cache<Object, Object> cache) throws Exception
    {
       Fqn<String> fqn = Fqn.fromElements(FqnUtil.JSESSION, contextHostName, sessionId);
+      verifyCacheLoader(cache, fqn);
       Node<Object, Object> bbRoot = cache.getNode(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
       if (bbRoot != null)
       {
@@ -84,6 +89,17 @@
          }
       }
    }
-   
+
+   private static void verifyCacheLoader(Cache<Object, Object> cache, Fqn<String> fqn)
+         throws Exception
+   {
+      CacheLoaderManager loaderManager = ((CacheSPI) cache).getCacheLoaderManager();
+      if (loaderManager != null && loaderManager.getCacheLoader() != null)
+      {
+         CacheLoader cl = loaderManager.getCacheLoader();
+         assert !cl.exists(fqn) : "found node for " + fqn + " on cache loader of cache " + cache.getLocalAddress();
+      }
+   }
+
    private BuddyReplicationAssertions() {}
 }




More information about the jbosscache-commits mailing list