[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/statetransfer ...

Brian Stansberry brian.stansberry at jboss.com
Thu Jul 20 17:58:21 EDT 2006


  User: bstansberry
  Date: 06/07/20 17:58:21

  Modified:    tests/functional/org/jboss/cache/statetransfer     
                        FailedStateTransferTest.java VersionedTestBase.java
                        ForcedStateTransferTest.java
                        StateTransferTestBase.java
                        StateTransfer200Test.java
  Log:
  [JBCACHE-465] Extract the state transfer code out of TreeCache
  
  Revision  Changes    Path
  1.4       +3 -2      JBossCache/tests/functional/org/jboss/cache/statetransfer/FailedStateTransferTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FailedStateTransferTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/FailedStateTransferTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- FailedStateTransferTest.java	20 Jul 2006 11:14:18 -0000	1.3
  +++ FailedStateTransferTest.java	20 Jul 2006 21:58:21 -0000	1.4
  @@ -24,6 +24,7 @@
   
   import org.jboss.cache.CacheException;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.CacheSPI;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.Version;
   import org.jboss.cache.factories.XmlConfigurationParser;
  @@ -54,10 +55,10 @@
         tree.createService();
         tree.startService();
   
  -      TreeCache recipient = createCache("recipient", false, false, false, false, false);
  +      CacheSPI recipient = createCache("recipient", false, false, false, false, false);
         try
         {
  -         recipient.startService();
  +         recipient.start();
            fail("startService() should throw an exception");
         }
         catch (CacheException good)
  
  
  
  1.8       +159 -152  JBossCache/tests/functional/org/jboss/cache/statetransfer/VersionedTestBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: VersionedTestBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/VersionedTestBase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- VersionedTestBase.java	20 Jul 2006 08:05:18 -0000	1.7
  +++ VersionedTestBase.java	20 Jul 2006 21:58:21 -0000	1.8
  @@ -11,7 +11,8 @@
   import java.util.Random;
   
   import org.jboss.cache.CacheException;
  -import org.jboss.cache.TreeCache;
  +import org.jboss.cache.CacheSPI;
  +import org.jboss.cache.Fqn;
   import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.misc.TestingUtil;
   
  @@ -19,7 +20,7 @@
   
   /**
    * Abstract superclass of "StateTransferVersion"-specific tests 
  - * of TreeCache's state transfer capability.
  + * of CacheSPI's state transfer capability.
    * 
    * TODO add tests with classloader regions
    * 
  @@ -30,25 +31,31 @@
   {
      private static final int SUBTREE_SIZE = 10;
      
  +   public static final Fqn A = Fqn.fromString("/a");
  +   public static final Fqn B = Fqn.fromString("/b");
  +   public static final Fqn C = Fqn.fromString("/c");;
  +   public static final Fqn A_B = Fqn.fromString("/a/b");
  +   public static final Fqn A_C = Fqn.fromString("/a/c");
  +   public static final Fqn A_D = Fqn.fromString("/a/d");
      
      public void testInitialStateTransfer() throws Exception
      {
  -      TreeCache cache1 = createCache("cache1", false, false, false);
  +      CacheSPI cache1 = createCache("cache1", false, false, false);
         
  -      cache1.put("/a/b", "name", JOE);
  -      cache1.put("/a/b", "age", TWENTY);
  -      cache1.put("/a/c", "name", BOB);
  -      cache1.put("/a/c", "age", FORTY);
  +      cache1.put(A_B, "name", JOE);
  +      cache1.put(A_B, "age", TWENTY);
  +      cache1.put(A_C, "name", BOB);
  +      cache1.put(A_C, "age", FORTY);
         
  -      TreeCache cache2 = createCache("cache2", false, false, false);
  +      CacheSPI cache2 = createCache("cache2", false, false, false);
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache2.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache2.get("/a/c", "age"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
      }
      
      public void testInitialStateTferWithLoader() throws Exception
  @@ -63,19 +70,19 @@
      
      private void initialStateTferWithLoaderTest(boolean asyncLoader) throws Exception
      {
  -      TreeCache cache1 = createCache("cache1", false, false, true);
  +      CacheSPI cache1 = createCache("cache1", false, false, true);
         
  -      cache1.put("/a/b", "name", JOE);
  -      cache1.put("/a/b", "age", TWENTY);
  -      cache1.put("/a/c", "name", BOB);
  -      cache1.put("/a/c", "age", FORTY);
  +      cache1.put(A_B, "name", JOE);
  +      cache1.put(A_B, "age", TWENTY);
  +      cache1.put(A_C, "name", BOB);
  +      cache1.put(A_C, "age", FORTY);
         
  -      TreeCache cache2 = createCache("cache2", false, false, true, asyncLoader, false);
  +      CacheSPI cache2 = createCache("cache2", false, false, true, asyncLoader, false);
         
         cache2.start();
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
         if (asyncLoader)
             TestingUtil.sleepThread((long)100);
  @@ -87,127 +94,127 @@
         assertEquals("Incorrect loader name for /a/c", BOB, loader.get(A_C).get("name"));
         assertEquals("Incorrect loader age for /a/c", FORTY, loader.get(A_C).get("age"));
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache2.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache2.get("/a/c", "age"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
      }
      
      public void testPartialStateTransfer() throws Exception
      {
  -      TreeCache cache1 = createCache("cache1", false, true, false);
  +      CacheSPI cache1 = createCache("cache1", false, true, false);
         
  -      cache1.activateRegion("/a");
  +      cache1.getRegion(A).activate();
         
  -      cache1.put("/a/b", "name", JOE);
  -      cache1.put("/a/b", "age", TWENTY);
  -      cache1.put("/a/c", "name", BOB);
  -      cache1.put("/a/c", "age", FORTY);
  +      cache1.put(A_B, "name", JOE);
  +      cache1.put(A_B, "age", TWENTY);
  +      cache1.put(A_C, "name", BOB);
  +      cache1.put(A_C, "age", FORTY);
         
  -      TreeCache cache2 = createCache("cache2", false, true, false);
  +      CacheSPI cache2 = createCache("cache2", false, true, false);
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
  -      assertNull("/a/b name transferred against policy", cache2.get("/a/b", "name"));
  -      assertNull("/a/b age transferred against policy", cache2.get("/a/b", "age"));
  -      assertNull("/a/c name transferred against policy", cache2.get("/a/c", "name"));
  -      assertNull("/a/c age transferred against policy", cache2.get("/a/c", "age"));
  +      assertNull("/a/b name transferred against policy", cache2.get(A_B, "name"));
  +      assertNull("/a/b age transferred against policy", cache2.get(A_B, "age"));
  +      assertNull("/a/c name transferred against policy", cache2.get(A_C, "name"));
  +      assertNull("/a/c age transferred against policy", cache2.get(A_C, "age"));
         
  -      cache2.activateRegion("/a/b");      
  +      cache2.getRegion(A_B).activate();      
   
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertNull("/a/c name transferred against policy", cache2.get("/a/c", "name"));
  -      assertNull("/a/c age transferred against policy", cache2.get("/a/c", "age"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertNull("/a/c name transferred against policy", cache2.get(A_C, "name"));
  +      assertNull("/a/c age transferred against policy", cache2.get(A_C, "age"));
         
  -      cache1.put("/a/d", "name", JANE);
  +      cache1.put(A_D, "name", JANE);
         
  -      assertNull("/a/d name transferred against policy", cache2.get("/a/d", "name"));
  +      assertNull("/a/d name transferred against policy", cache2.get(A_D, "name"));
         
  -      cache2.activateRegion("/a/c");
  +      cache2.getRegion(A_C).activate();
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache2.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache2.get("/a/c", "age"));
  -      assertNull("/a/d name transferred against policy", cache2.get("/a/d", "name"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
  +      assertNull("/a/d name transferred against policy", cache2.get(A_D, "name"));
         
  -      cache2.activateRegion("/a/d");
  +      cache2.getRegion(A_D).activate();
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache2.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache2.get("/a/c", "age"));
  -      assertEquals("Incorrect name for /a/d", JANE, cache2.get("/a/d", "name"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
  +      assertEquals("Incorrect name for /a/d", JANE, cache2.get(A_D, "name"));
         
  -      cache1.inactivateRegion("/a");
  +      cache1.getRegion(A).deactivate();
         
  -      cache1.activateRegion("/a/b");      
  -      cache1.activateRegion("/a/c");      
  -      cache1.activateRegion("/a/d");
  +      cache1.getRegion(A_B).activate();      
  +      cache1.getRegion(A_C).activate();      
  +      cache1.getRegion(A_D).activate();
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache1.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache1.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache1.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache1.get("/a/c", "age"));
  -      assertEquals("Incorrect name for /a/d", JANE, cache1.get("/a/d", "name"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache1.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache1.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache1.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache1.get(A_C, "age"));
  +      assertEquals("Incorrect name for /a/d", JANE, cache1.get(A_D, "name"));
      }
      
      public void testPartialStateTferWithLoader() throws Exception
      {
  -      TreeCache cache1 = createCache("cache1", false, true, true);
  +      CacheSPI cache1 = createCache("cache1", false, true, true);
         
  -      cache1.activateRegion("/a");
  +      cache1.getRegion(A).activate();
         
  -      cache1.put("/a/b", "name", JOE);
  -      cache1.put("/a/b", "age", TWENTY);
  -      cache1.put("/a/c", "name", BOB);
  -      cache1.put("/a/c", "age", FORTY);
  +      cache1.put(A_B, "name", JOE);
  +      cache1.put(A_B, "age", TWENTY);
  +      cache1.put(A_C, "name", BOB);
  +      cache1.put(A_C, "age", FORTY);
         
  -      TreeCache cache2 = createCache("cache2", false, true, true);
  +      CacheSPI cache2 = createCache("cache2", false, true, true);
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
         CacheLoader loader = cache2.getCacheLoader();
         
         assertNull("/a/b transferred to loader against policy", loader.get(A_B));
   
  -      assertNull("/a/b name transferred against policy", cache2.get("/a/b", "name"));
  -      assertNull("/a/b age transferred against policy", cache2.get("/a/b", "age"));
  -      assertNull("/a/c name transferred against policy", cache2.get("/a/c", "name"));
  -      assertNull("/a/c age transferred against policy", cache2.get("/a/c", "age"));
  +      assertNull("/a/b name transferred against policy", cache2.get(A_B, "name"));
  +      assertNull("/a/b age transferred against policy", cache2.get(A_B, "age"));
  +      assertNull("/a/c name transferred against policy", cache2.get(A_C, "name"));
  +      assertNull("/a/c age transferred against policy", cache2.get(A_C, "age"));
         
  -      cache2.activateRegion("/a/b");     
  +      cache2.getRegion(A_B).activate();     
         
         assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
         assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
         assertNull("/a/c transferred to loader against policy", loader.get(A_C));
   
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertNull("/a/c name transferred against policy", cache2.get("/a/c", "name"));
  -      assertNull("/a/c age transferred against policy", cache2.get("/a/c", "age"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertNull("/a/c name transferred against policy", cache2.get(A_C, "name"));
  +      assertNull("/a/c age transferred against policy", cache2.get(A_C, "age"));
         
  -      cache1.put("/a/d", "name", JANE);
  +      cache1.put(A_D, "name", JANE);
         
  -      assertNull("/a/d name transferred against policy", cache2.get("/a/d", "name"));
  +      assertNull("/a/d name transferred against policy", cache2.get(A_D, "name"));
         
  -      cache2.activateRegion("/a/c");     
  +      cache2.getRegion(A_C).activate();     
         
         assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
         assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
         assertEquals("Incorrect name from loader for /a/c", BOB, loader.get(A_C).get("name"));
         assertEquals("Incorrect age from loader for /a/c", FORTY, loader.get(A_C).get("age"));
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache2.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache2.get("/a/c", "age"));
  -      assertNull("/a/d name transferred against policy", cache2.get("/a/d", "name"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
  +      assertNull("/a/d name transferred against policy", cache2.get(A_D, "name"));
         
  -      cache2.activateRegion("/a/d");     
  +      cache2.getRegion(A_D).activate();     
         
         assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
         assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
  @@ -215,17 +222,17 @@
         assertEquals("Incorrect age from loader for /a/c", FORTY, loader.get(A_C).get("age"));
         assertEquals("Incorrect name from loader for /a/d", JANE, loader.get(A_D).get("name"));
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache2.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache2.get("/a/c", "age"));
  -      assertEquals("Incorrect name for /a/d", JANE, cache2.get("/a/d", "name"));
  -      
  -      cache1.inactivateRegion("/a");
  -      
  -      cache1.activateRegion("/a/b");      
  -      cache1.activateRegion("/a/c");      
  -      cache1.activateRegion("/a/d");
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
  +      assertEquals("Incorrect name for /a/d", JANE, cache2.get(A_D, "name"));
  +      
  +      cache1.getRegion(A).deactivate();
  +      
  +      cache1.getRegion(A_B).activate();      
  +      cache1.getRegion(A_C).activate();      
  +      cache1.getRegion(A_D).activate();
         
         loader = cache1.getCacheLoader();     
         
  @@ -235,11 +242,11 @@
         assertEquals("Incorrect age from loader for /a/c", FORTY, loader.get(A_C).get("age"));
         assertEquals("Incorrect name from loader for /a/d", JANE, loader.get(A_D).get("name"));
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache1.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache1.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache1.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache1.get("/a/c", "age"));
  -      assertEquals("Incorrect name for /a/d", JANE, cache1.get("/a/d", "name"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache1.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache1.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache1.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache1.get(A_C, "age"));
  +      assertEquals("Incorrect name for /a/d", JANE, cache1.get(A_D, "name"));
      }
      
      public void testPartialStateTferWithClassLoader() throws Exception
  @@ -253,84 +260,84 @@
         // Set the TCL to a classloader that can't see Person/Address
         Thread.currentThread().setContextClassLoader(getNotFoundClassLoader());
         
  -      TreeCache cache1 = createCache("cache1",
  +      CacheSPI cache1 = createCache("cache1",
                                             false,  // async 
                                             true,   // use marshaller
                                             true,   // use cacheloader
                                             false, false); // don't start
         ClassLoader cl1 = getClassLoader();
  -      cache1.registerClassLoader("/a", cl1);
  +      cache1.getRegion(A).registerContextClassLoader(cl1);
         startCache(cache1);
         
  -      cache1.activateRegion("/a");
  +      cache1.getRegion(A).activate();
         
         Object ben = createBen(cl1);
         
  -      cache1.put("/a/b", "person", ben);
  +      cache1.put(A_B, "person", ben);
         
         // For cache 2 we won't register loader until later
  -      TreeCache cache2 = createCache("cache2",
  +      CacheSPI cache2 = createCache("cache2",
                                             false,  // async 
                                             true,   // use marshalling
                                             true,   // use cacheloader
                                             false, true);  // start
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
         CacheLoader loader = cache2.getCacheLoader();
         
         assertNull("/a/b not transferred to loader", loader.get(A_B));
         
  -      assertNull("/a/b not transferred to cache", cache2.get("/a/b", "person"));
  +      assertNull("/a/b not transferred to cache", cache2.get(A_B, "person"));
         
         ClassLoader cl2 = getClassLoader();
         
  -//      cache2.registerClassLoader("/a", cl2);
  -      cache2.activateRegion("/a");     
  +//      cache2.registerClassLoader(A, cl2);
  +      cache2.getRegion(A);     
         
         assertEquals("Correct state from loader for /a/b", ben.toString(), loader.get(A_B).get("person").toString());
         
  -      assertEquals("Correct state from cache for /a/b", ben.toString(), cache2.get("/a/b", "person").toString());
  +      assertEquals("Correct state from cache for /a/b", ben.toString(), cache2.get(A_B, "person").toString());
         
      }
      
      public void testLoadEntireStateAfterStart() throws Exception
      {
  -      TreeCache cache1 = createCache("cache1", false, true, true);
  +      CacheSPI cache1 = createCache("cache1", false, true, true);
         
  -      cache1.activateRegion("/");
  +      cache1.getRegion(Fqn.ROOT).activate();
         
  -      cache1.put("/a/b", "name", JOE);
  -      cache1.put("/a/b", "age", TWENTY);
  -      cache1.put("/a/c", "name", BOB);
  -      cache1.put("/a/c", "age", FORTY);
  +      cache1.put(A_B, "name", JOE);
  +      cache1.put(A_B, "age", TWENTY);
  +      cache1.put(A_C, "name", BOB);
  +      cache1.put(A_C, "age", FORTY);
         
  -      TreeCache cache2 = createCache("cache2", false, true, true);
  +      CacheSPI cache2 = createCache("cache2", false, true, true);
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
         CacheLoader loader = cache2.getCacheLoader();
         
         assertNull("/a/b transferred to loader against policy", loader.get(A_B));
         
  -      assertNull("/a/b name transferred against policy", cache2.get("/a/b", "name"));
  -      assertNull("/a/b age transferred against policy", cache2.get("/a/b", "age"));
  -      assertNull("/a/c name transferred against policy", cache2.get("/a/c", "name"));
  -      assertNull("/a/c age transferred against policy", cache2.get("/a/c", "age"));
  +      assertNull("/a/b name transferred against policy", cache2.get(A_B, "name"));
  +      assertNull("/a/b age transferred against policy", cache2.get(A_B, "age"));
  +      assertNull("/a/c name transferred against policy", cache2.get(A_C, "name"));
  +      assertNull("/a/c age transferred against policy", cache2.get(A_C, "age"));
         
  -      cache2.activateRegion("/");     
  +      cache2.getRegion(Fqn.ROOT).activate();     
         
         assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
         assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
         assertEquals("Incorrect name from loader for /a/c", BOB, loader.get(A_C).get("name"));
         assertEquals("Incorrect age from loader for /a/c", FORTY, loader.get(A_C).get("age"));
         
  -      assertEquals("Incorrect name for /a/b", JOE, cache2.get("/a/b", "name"));
  -      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  -      assertEquals("Incorrect name for /a/c", BOB, cache2.get("/a/c", "name"));
  -      assertEquals("Incorrect age for /a/c", FORTY, cache2.get("/a/c", "age"));
  +      assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
  +      assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
  +      assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
  +      assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
         
      }
      
  @@ -386,10 +393,10 @@
            }   
            
            // Create activation threads that will block on the semaphore
  -         TreeCache[] caches = new TreeCache[count];
  +         CacheSPI[] caches = new CacheSPI[count];
            for (int i = 0; i < count; i++) {
               activators[i] = new CacheActivator(semaphore, names[i], sync);
  -            caches[i] = activators[i].getTreeCache();
  +            caches[i] = activators[i].getCacheSPI();
               activators[i].start();
            }
            
  @@ -422,7 +429,7 @@
               
               for (int j = 0; j < count; j++)
               {
  -               String fqn = "/a/b/" + names[j];
  +               Fqn fqn = new Fqn(A_B, names[j]);
                  assertEquals("Incorrect value for " + fqn + " on activator " + names[i], 
                                "VALUE", activators[i].getCacheValue(fqn));
   //               System.out.println(names[i] + ":" + fqn + " = " + activators[i].getCacheValue(fqn));
  @@ -482,9 +489,9 @@
         try {
            
            // The first cache we create is inactivated.
  -         TreeCache cacheA = createCache("cacheA", sync, true, false);
  +         CacheSPI cacheA = createCache("cacheA", sync, true, false);
            
  -         TreeCache[] caches = new TreeCache[count + 1];
  +         CacheSPI[] caches = new CacheSPI[count + 1];
            caches[0] = cacheA;
            
            // Create a semaphore and take all its tickets
  @@ -498,7 +505,7 @@
            for (int i = 0; i < count; i++) 
            {
               stressors[i] = new CacheStressor(semaphore, names[i], sync);
  -            caches[i + 1] = stressors[i].getTreeCache();
  +            caches[i + 1] = stressors[i].getCacheSPI();
               stressors[i].start();
            }
            
  @@ -515,8 +522,8 @@
                  // and enabling the stressors
                  for (int i = 0; i < count; i++)
                  {
  -                  cacheA.inactivateRegion("/" + names[i]);
  -                  System.out.println("Run " + x + "-- /" + names[i] + " inactivated on A");
  +                  cacheA.getRegion(Fqn.fromString("/" + names[i])).deactivate();
  +                  System.out.println("Run " + x + "-- /" + names[i] + " deactivated on A");
                     stressors[i].startPuts();
                  }
               }
  @@ -532,7 +539,7 @@
               for (int i = 0; i < count; i++)
               {
   //              System.out.println("Activating /" + names[i] + " on A");
  -               cacheA.activateRegion("/" + names[i]);
  +               cacheA.getRegion(Fqn.fromString("/" + names[i])).activate();
                  // Stop the stressor so we don't pollute cacheA's state
                  // with too many messages sent after activation -- we want
                  // to compare transferred state with the sender
  @@ -563,10 +570,10 @@
               {
                  for (int j = 0; j < SUBTREE_SIZE; j++)
                  {
  -                  String fqn = "/" + names[i] +"/" + j;
  +                  Fqn fqn = Fqn.fromString("/" + names[i] +"/" + j);
                     assertEquals("/A/" + j + " matches " + fqn,
                                  cacheA.get(fqn, "KEY"),
  -                               stressors[i].getTreeCache().get(fqn, "KEY"));
  +                               stressors[i].getCacheSPI().get(fqn, "KEY"));
                  }
               }
            }
  @@ -619,16 +626,16 @@
         
         void useCache() throws Exception
         {
  -         cache.activateRegion("/a/b");
  +         cache.getRegion(A_B).activate();
   //         System.out.println(name + " activated region" + " " + System.currentTimeMillis());
  -         String childFqn = "/a/b/" + name;
  +         Fqn childFqn = Fqn.fromString("/a/b/" + name);
            
            cache.put(childFqn, "KEY", "VALUE");
   //         System.out.println(name + " put fqn " + childFqn + " " + System.currentTimeMillis());
   
         }
         
  -      public Object getCacheValue(String fqn) throws CacheException
  +      public Object getCacheValue(Fqn fqn) throws CacheException
         {
            return cache.get(fqn, "KEY");
         }
  @@ -655,7 +662,7 @@
            // just whether activation causes problems
            int factor = 0;
            int i = 0;
  -         String fqn = null;
  +         Fqn fqn = null;
            
            boolean acquired = false;
            while (!stopped)
  @@ -671,7 +678,7 @@
               {
                  factor = random.nextInt(50);
                  
  -               fqn = "/" + name +"/" + String.valueOf(factor % SUBTREE_SIZE);
  +               fqn = Fqn.fromString("/" + name +"/" + String.valueOf(factor % SUBTREE_SIZE));
                  Integer value = new Integer(factor / SUBTREE_SIZE);
                  cache.put(fqn, "KEY", value);
   
  @@ -713,7 +720,7 @@
      private abstract class CacheUser implements Runnable
      {
         protected Semaphore semaphore;
  -      protected TreeCache cache;
  +      protected CacheSPI cache;
         protected String name;
         protected Exception exception;
         protected Thread thread;
  @@ -729,7 +736,7 @@
            this.name = name;
            
            if (activateRoot)
  -            cache.activateRegion("/");
  +            cache.getRegion(Fqn.ROOT).activate();
         }
         
         public void run()
  @@ -768,7 +775,7 @@
            return exception;
         }
         
  -      public TreeCache getTreeCache()
  +      public CacheSPI getCacheSPI()
         {
            return cache;
         }
  
  
  
  1.10      +39 -38    JBossCache/tests/functional/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ForcedStateTransferTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/ForcedStateTransferTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- ForcedStateTransferTest.java	20 Jul 2006 09:03:55 -0000	1.9
  +++ ForcedStateTransferTest.java	20 Jul 2006 21:58:21 -0000	1.10
  @@ -22,18 +22,19 @@
   
   package org.jboss.cache.statetransfer;
   
  +import java.util.Map;
  +
  +import javax.transaction.Synchronization;
  +import javax.transaction.Transaction;
  +import javax.transaction.TransactionManager;
  +
   import org.jboss.cache.AbstractCacheListener;
   import org.jboss.cache.CacheException;
  +import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.TreeCache;
   import org.jboss.cache.Version;
   import org.jboss.cache.misc.TestingUtil;
   
  -import javax.transaction.Synchronization;
  -import javax.transaction.Transaction;
  -import javax.transaction.TransactionManager;
  -import java.util.Map;
  -
   
   /**
    * Tests the ability to force a state transfer in the presence of 
  @@ -51,11 +52,11 @@
       */
      static class CacheStarter extends Thread
      {
  -      TreeCache cache;
  +      CacheSPI cache;
         boolean useMarshalling;
         Exception failure;
   
  -      CacheStarter(TreeCache cache, boolean useMarshalling)
  +      CacheStarter(CacheSPI cache, boolean useMarshalling)
         {
            this.cache = cache;
            this.useMarshalling = useMarshalling;
  @@ -73,7 +74,7 @@
                  // no guarantee of start() blocking until the view is received
                  // so we need to do it ourself
                  TestingUtil.blockUntilViewReceived(cache, 2, 60000);
  -               cache.activateRegion("/");
  +               cache.getRegion(Fqn.ROOT).activate();
               }
            }
            catch (Exception e)
  @@ -89,13 +90,13 @@
       */
      static abstract class TaskRunner extends Thread
      {
  -      TreeCache cache;
  +      CacheSPI cache;
         Fqn fqn;
         String value;
         Exception failure;
         boolean asleep = false;
   
  -      TaskRunner(TreeCache cache, String rootFqn, String value)
  +      TaskRunner(CacheSPI cache, String rootFqn, String value)
         {
            this.cache = cache;
            this.value = value;
  @@ -143,7 +144,7 @@
         boolean rollback = false;
         boolean done = true;
   
  -      TxRunner(TreeCache cache, String rootFqn, String value, boolean rollback)
  +      TxRunner(CacheSPI cache, String rootFqn, String value, boolean rollback)
         {
            super(cache, rootFqn, value);
            this.rollback = rollback;
  @@ -220,11 +221,11 @@
      {
         HangThreadListener listener;
   
  -      HangThreadRunner(TreeCache cache, String rootFqn, String value)
  +      HangThreadRunner(CacheSPI cache, String rootFqn, String value)
         {
            super(cache, rootFqn, value);
            listener = new HangThreadListener(fqn);
  -         cache.addTreeCacheListener(listener);
  +         cache.addCacheListener(listener);
         }
   
         void executeTask() throws Exception
  @@ -293,7 +294,7 @@
         Transaction tx = null;
         HangThreadSynchronization sync;
   
  -      SynchronizationTxRunner(TreeCache cache, String rootFqn, String value, boolean hangBefore)
  +      SynchronizationTxRunner(CacheSPI cache, String rootFqn, String value, boolean hangBefore)
         {
            super(cache, rootFqn, value);
            this.sync = new HangThreadSynchronization(hangBefore);
  @@ -363,21 +364,21 @@
                                   String isolationLevel) throws Exception
      {
         // Create the cache from which state will be requested
  -      TreeCache sender = initializeSender(isolationLevel, false, false);
  +      CacheSPI sender = initializeSender(isolationLevel, false, false);
   
         // Start threads that will do operations on the cache and then hang
         TxRunner[] runners =
               initializeTransactionRunners(values, sender, "/LOCK", rollback);
   
         // Create and start the cache that requests a state transfer
  -      TreeCache receiver = startReceiver(isolationLevel, false, false);
  +      CacheSPI receiver = startReceiver(isolationLevel, false, false);
   
         // Confirm the receiver got the expected state and the threads are OK
         checkResults(receiver, runners, false);
      }
   
      /**
  -    * Creates and starts a TreeCache from which another cache will request
  +    * Creates and starts a CacheSPI from which another cache will request
       * state. Also adds value "X" under key "KEY" in node "/OK".  This node
       * should be present in the transferred state in any test.
       * 
  @@ -389,16 +390,16 @@
       * 
       * @throws Exception
       */
  -   private TreeCache initializeSender(String isolationLevel,
  +   private CacheSPI initializeSender(String isolationLevel,
                                              boolean replSync,
                                              boolean useMarshalling) throws Exception
      {
  -      TreeCache sender = createCache("sender", isolationLevel, replSync, useMarshalling, true);
  +      CacheSPI sender = createCache("sender", isolationLevel, replSync, useMarshalling, true);
   
         if (useMarshalling)
  -         sender.activateRegion("/");
  +         sender.getRegion(Fqn.ROOT).activate();
   
  -      sender.put("/OK", "KEY", "X");
  +      sender.put(Fqn.fromString("/OK"), "KEY", "X");
   
         return sender;
      }
  @@ -418,7 +419,7 @@
       * @return           the TaskRunner threads
       */
      private TxRunner[] initializeTransactionRunners(String[] values,
  -                                                   TreeCache sender,
  +                                                   CacheSPI sender,
                                                      String rootFqn,
                                                      boolean rollback)
      {
  @@ -466,7 +467,7 @@
       * 
       * @throws CacheException
       */
  -   private void checkResults(TreeCache receiver,
  +   private void checkResults(CacheSPI receiver,
                                TaskRunner[] runners,
                                boolean allowValues) throws CacheException
      {
  @@ -480,7 +481,7 @@
         }
   
         // Confirm we got the "non-hung" state
  -      assertEquals("OK value correct", "X", receiver.get("/OK", "KEY"));
  +      assertEquals("OK value correct", "X", receiver.get(Fqn.fromString("/OK"), "KEY"));
   
         for (int i = 0; i < runners.length; i++)
         {
  @@ -508,14 +509,14 @@
      public void testHungThread() throws Exception
      {
         // Create the cache from which state will be requested
  -      TreeCache sender = initializeSender("REPEATABLE_READ", false, false);
  +      CacheSPI sender = initializeSender("REPEATABLE_READ", false, false);
   
         // Start threads that will do operations on the cache and then hang
         String[] values = { "A", "B", "C" };
         HangThreadRunner[] runners = initializeHangThreadRunners(values, sender, "/LOCK");
   
         // Create and start the cache that requests a state transfer
  -      TreeCache receiver = startReceiver("REPEATABLE_READ", false, false);
  +      CacheSPI receiver = startReceiver("REPEATABLE_READ", false, false);
   
         // Confirm the receiver got the expected state and the threads are OK
         checkResults(receiver, runners, true);
  @@ -535,7 +536,7 @@
       * @return           the TaskRunner threads
       */
      private HangThreadRunner[] initializeHangThreadRunners(String[] values,
  -                                                          TreeCache sender,
  +                                                          CacheSPI sender,
                                                             String rootFqn)
      {
         HangThreadRunner[] runners = new HangThreadRunner[values.length];
  @@ -586,13 +587,13 @@
       */
      private void synchronizationTest(boolean hangBefore) throws Exception
      {
  -      TreeCache sender = initializeSender("REPEATABLE_READ", false, false);
  +      CacheSPI sender = initializeSender("REPEATABLE_READ", false, false);
   
         String[] values = { "A", "B", "C" };
         SynchronizationTxRunner[] runners =
            initializeSynchronizationTxRunners(values, sender, "/LOCK", hangBefore);
   
  -      TreeCache receiver = startReceiver("REPEATABLE_READ", false, false);
  +      CacheSPI receiver = startReceiver("REPEATABLE_READ", false, false);
   
         checkResults(receiver, runners, !hangBefore);
      }
  @@ -615,7 +616,7 @@
       * @return           the TaskRunner threads
       */
      private SynchronizationTxRunner[] initializeSynchronizationTxRunners(String[] values,
  -                                                                        TreeCache sender,
  +                                                                        CacheSPI sender,
                                                                           String rootFqn,
                                                                           boolean hangBefore)
      {
  @@ -691,7 +692,7 @@
                                       boolean replSync,
                                       boolean useMarshalling) throws Exception
      {
  -      TreeCache sender = initializeSender(isolationLevel, replSync, useMarshalling);
  +      CacheSPI sender = initializeSender(isolationLevel, replSync, useMarshalling);
   
         // Do the "after" nodes first, otherwise if there is a /LOCK parent
         // node, the rollback of a tx will remove it causing the test to fail
  @@ -718,7 +719,7 @@
         HangThreadRunner[] threads =
            initializeHangThreadRunners(val5, sender, rootFqn);
   
  -      TreeCache receiver = startReceiver(isolationLevel, replSync, useMarshalling);
  +      CacheSPI receiver = startReceiver(isolationLevel, replSync, useMarshalling);
   
         checkResults(receiver, active, false);
         checkResults(receiver, rollback, false);
  @@ -744,11 +745,11 @@
       * 
       * @throws Exception
       */
  -   private TreeCache startReceiver(String isolationLevel,
  +   private CacheSPI startReceiver(String isolationLevel,
                                           boolean replSync,
                                           boolean useMarshalling) throws Exception
      {
  -      TreeCache receiver = createCache("receiver", isolationLevel, replSync, useMarshalling, false);
  +      CacheSPI receiver = createCache("receiver", isolationLevel, replSync, useMarshalling, false);
   
         // Start the cache in a separate thread so we can kill the
         // thread if the cache doesn't start properly
  @@ -772,14 +773,14 @@
       * Override the superclass version to set an unlimited state transfer timeout
       * and a 1 sec lock acquisition timeout.
       */
  -   private TreeCache createCache(String cacheID,
  +   private CacheSPI createCache(String cacheID,
                                         String isolationLevel,
                                         boolean replSync,
                                         boolean useMarshalling,
                                         boolean startCache)
         throws Exception
      {
  -      TreeCache result = super.createCache(cacheID, replSync,
  +      CacheSPI result = super.createCache(cacheID, replSync,
                                                   useMarshalling, false, false, false);
         result.getConfiguration().setInitialStateRetrievalTimeout(0);
         result.getConfiguration().setLockAcquisitionTimeout(1000);
  
  
  
  1.19      +21 -14    JBossCache/tests/functional/org/jboss/cache/statetransfer/StateTransferTestBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StateTransferTestBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/StateTransferTestBase.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- StateTransferTestBase.java	20 Jul 2006 08:05:18 -0000	1.18
  +++ StateTransferTestBase.java	20 Jul 2006 21:58:21 -0000	1.19
  @@ -23,9 +23,14 @@
   package org.jboss.cache.statetransfer;
   
   import junit.framework.TestCase;
  +
  +import org.jboss.cache.Cache;
  +import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.TreeCache;
  +//import org.jboss.cache.TreeCache;
   import org.jboss.cache.config.Configuration;
  +import org.jboss.cache.factories.CacheFactory;
  +import org.jboss.cache.factories.DefaultCacheFactory;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.marshall.SelectedClassnameClassLoader;
   import org.jboss.cache.xml.XmlHelper;
  @@ -59,7 +64,7 @@
      
      protected abstract String getReplicationVersion();
   
  -   protected TreeCache createCache(String cacheID,
  +   protected CacheSPI createCache(String cacheID,
                                           boolean sync, 
                                           boolean useMarshalling, 
                                           boolean useCacheLoader) 
  @@ -68,7 +73,7 @@
         return createCache(cacheID, sync, useMarshalling, useCacheLoader, false, true);
      }
   
  -   protected TreeCache createCache(String cacheID,
  +   protected CacheSPI createCache(String cacheID,
                                           boolean sync, 
                                           boolean useMarshalling, 
                                           boolean useCacheLoader, 
  @@ -79,7 +84,7 @@
         if (caches.get(cacheID) != null)
            throw new IllegalStateException(cacheID + " already created");
         
  -      TreeCache tree=new TreeCache();
  +//      TreeCache tree=new TreeCache();
         //PropertyConfigurator config=new PropertyConfigurator();
         String configFile = sync ? "META-INF/replSync-service.xml"
                                  : "META-INF/replAsync-service.xml";
  @@ -97,24 +102,26 @@
         if (useCacheLoader) {
            configureCacheLoader(c, cacheID, useMarshalling, cacheLoaderAsync);
         }
  -      tree.setConfiguration(c);
  +//      tree.setConfiguration(c);
  +      CacheFactory factory = new DefaultCacheFactory();
  +      CacheSPI tree = (CacheSPI) factory.createCache(c, false);
         // Put the cache in the map before starting, so if it fails in
         // start it can still be destroyed later
         caches.put(cacheID, tree);
         
         if (startCache)
         {
  -         tree.createService();
  -         tree.startService();
  +         tree.create();
  +         tree.start();
         }
         
         return tree;
      }
   
  -   protected void startCache(TreeCache cache) throws Exception
  +   protected void startCache(Cache cache) throws Exception
      {
  -      cache.createService();
  -      cache.startService();
  +      cache.create();
  +      cache.start();
      }
   
      protected void configureCacheLoader(Configuration c,
  @@ -203,19 +210,19 @@
         cacheIDs = (String[]) keys.toArray(cacheIDs);
         for (int i = 0; i < cacheIDs.length; i++)
         {
  -         stopCache((TreeCache) caches.get(cacheIDs[i]));
  +         stopCache((Cache) caches.get(cacheIDs[i]));
            File file = new File(getTempLocation(cacheIDs[i]));
            cleanFile(file);
         }
      }
   
  -   protected void stopCache(TreeCache cache)
  +   protected void stopCache(Cache cache)
      {
         if (cache != null)
         {
            try {
  -            cache.stopService();
  -            cache.destroyService();
  +            cache.stop();
  +            cache.destroy();
            }
            catch (Exception e) {
               System.out.println("Exception stopping cache " + e.getMessage());
  
  
  
  1.3       +20 -17    JBossCache/tests/functional/org/jboss/cache/statetransfer/StateTransfer200Test.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StateTransfer200Test.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/StateTransfer200Test.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- StateTransfer200Test.java	20 Jul 2006 08:05:18 -0000	1.2
  +++ StateTransfer200Test.java	20 Jul 2006 21:58:21 -0000	1.3
  @@ -7,8 +7,10 @@
   
   package org.jboss.cache.statetransfer;
   
  +import org.jboss.cache.CacheSPI;
   import org.jboss.cache.DataNode;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.InvocationContext;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.buddyreplication.BuddyManager;
   import org.jboss.cache.config.Option;
  @@ -23,7 +25,7 @@
    * Tests that state transfer works properly if the version is 2.0.0.GA.
    * 
    * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class StateTransfer200Test extends VersionedTestBase
   {
  @@ -35,37 +37,37 @@
   
      public void testBuddyBackupExclusion() throws Exception
      {
  -      TreeCache cache1 = createCache("cache1", false, false, false, false, false);
  +      CacheSPI cache1 = createCache("cache1", false, false, false, false, false);
      
         cache1.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
         
  -      cache1.startService();
  +      cache1.start();
         
         Fqn backup = new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, "test");
         cache1.put(backup, "name", JOE);
  -      cache1.put("/a/b", "age", TWENTY);
  +      cache1.put(A_B, "age", TWENTY);
         
  -      TreeCache cache2 = createCache("cache2", false, false, false);
  +      CacheSPI cache2 = createCache("cache2", false, false, false);
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
         assertNull("_buddy_backup_ not transferred", cache2.get(backup, "test"));
  -      assertEquals("Correct age for /a/b", TWENTY, cache2.get("/a/b", "age"));
  +      assertEquals("Correct age for /a/b", TWENTY, cache2.get(A_B, "age"));
      }
   
      public void testBuddyIntegration() throws Exception
      {
  -      TreeCache cache1 = createCache("cache1", false, false, false, false, false);
  +      CacheSPI cache1 = createCache("cache1", false, false, false, false, false);
      
         cache1.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
         
  -      cache1.startService();
  +      cache1.start();
         
  -      TreeCache cache2 = createCache("cache2", false, false, false);
  +      CacheSPI cache2 = createCache("cache2", false, false, false);
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cache1, cache2 }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
         
         Option option = new Option();
         option.setCacheModeLocal(true);
  @@ -73,22 +75,23 @@
         Fqn backup = Fqn.fromString(BuddyManager.BUDDY_BACKUP_SUBTREE);
         backup = new Fqn(backup, "a");
         cache1.put(backup, null, option);
  -      DataNode target = cache1.get(backup);
  +      DataNode target = (DataNode) cache1.get(backup);
         
         Fqn abc = Fqn.fromString("/a/b/c");
  -      cache2.put(abc, "name", JOE, option);
  -      Fqn ad = Fqn.fromString("/a/d");
  -      cache2.put(ad, "name", JANE, option);
  +      InvocationContext.getCurrent().setOptionOverrides(option);
  +      cache2.put(abc, "name", JOE);
  +      InvocationContext.getCurrent().setOptionOverrides(option);
  +      cache2.put(A_D, "name", JANE);
         
         Object[] sources = cache1.getMembers().toArray();
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         Fqn a = Fqn.fromString("/a");
  -      cache1._loadState(a, target, sources, cl);
  +      cache1.getStateTransferManager().loadState(a, target, sources, cl);
         
         Fqn test = new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, abc);
         assertEquals("/a/b/c state integrated in backup region", JOE, cache1.get(test, "name"));
         
  -      test = new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, ad);
  +      test = new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, A_D);
         assertEquals("/a/d state integrated in backup region", JANE, cache1.get(test, "name"));
      }
      
  
  
  



More information about the jboss-cvs-commits mailing list