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

Jason Thomas Greene jgreene at jboss.com
Thu Apr 26 21:56:06 EDT 2007


  User: jgreene 
  Date: 07/04/26 21:56:06

  Modified:    tests/functional/org/jboss/cache/pojo/statetransfer 
                        StateTransferAopTestBase.java
  Log:
  Mostly fix tests
  
  Revision  Changes    Path
  1.5       +25 -10    JBossCache/tests/functional/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StateTransferAopTestBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- StateTransferAopTestBase.java	16 Apr 2007 17:37:11 -0000	1.4
  +++ StateTransferAopTestBase.java	27 Apr 2007 01:56:06 -0000	1.5
  @@ -14,6 +14,7 @@
   import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.Region;
   import org.jboss.cache.config.CacheLoaderConfig;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
  @@ -42,7 +43,7 @@
    * Tests state transfer in PojoCache.
    *
    * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public abstract class StateTransferAopTestBase extends TestCase
   {
  @@ -139,12 +140,21 @@
         assertTrue("Bob and Jill have same Address", ac1.getAddress() == ac2.getAddress());
      }
   
  +   private void createAndActivateRegion(Cache c, Fqn f)
  +   {
  +      Region r = c.getRegion(f, true);
  +      r.registerContextClassLoader(getClass().getClassLoader());
  +      r.activate();
  +   }
  +   
      public void testPartialStateTransfer() throws Exception
      {
         log.info("Enter testPartialStateTransfer");
   
         PojoCache cache1 = createCache("cache1", false, true, false);
  -      cache1.getCache().getRegion(Fqn.fromString("/a"), true).activate();
  +
  +      createAndActivateRegion(cache1.getCache(), Fqn.fromString("/a"));
  +      createAndActivateRegion(cache1.getCache(), Fqn.fromString("/__JBossInternal__"));
   
         cache1.attach(A_B_1, joe);
         cache1.attach(A_B_2, jane);
  @@ -158,8 +168,8 @@
         assertNull("/a/b/1 not transferred per policy", cache2.find(A_B_1));
         assertNull("/a/b/2 not transferred per policy", cache2.find(A_B_2));
   
  -      // TODO: Reinstate once we have proper FLUSH working.
  -      cache2.getCache().getRegion(Fqn.fromString("/a"), true).activate();
  +      createAndActivateRegion(cache2.getCache(), Fqn.fromString("/a"));
  +      createAndActivateRegion(cache2.getCache(), Fqn.fromString("/__JBossInternal__"));
   
         Person ab1 = (Person) cache2.find(A_B_1);
         Person ab2 = (Person) cache2.find(A_B_2);
  @@ -192,7 +202,8 @@
         log.info("Enter testPartialStateTransferWithLoader");
   
         PojoCache cache1 = createCache("cache1", false, true, true);
  -      cache1.getCache().getRegion(Fqn.fromString("/a"), true).activate();
  +      createAndActivateRegion(cache1.getCache(), Fqn.fromString("/a"));
  +      createAndActivateRegion(cache1.getCache(), Fqn.fromString("/__JBossInternal__"));
   
         cache1.attach(A_B_1, joe);
         cache1.attach(A_B_2, jane);
  @@ -220,7 +231,9 @@
         assertNull("/a/b/1 not transferred per policy", cache2.find(A_B_1));
         assertNull("/a/b/2 not transferred per policy", cache2.find(A_B_2));
   
  -      cache2.getCache().getRegion(Fqn.fromString("/a"), true).activate();
  +      createAndActivateRegion(cache2.getCache(), Fqn.fromString("/a"));
  +      createAndActivateRegion(cache2.getCache(), Fqn.fromString("/__JBossInternal__"));
  +      
   
   //      assertEquals("Correct name from loader for /a/b/1", joe.getName(), loader.get(A_B_1_f).get("name"));
   //      assertEquals("Correct age from loader for /a/b/1", TWENTY, loader.get(A_B_1_f).get("age"));
  @@ -792,7 +805,9 @@
   
         void useCache() throws Exception
         {
  -         cache.getCache().getRegion(Fqn.fromString("/a/b"), true).activate();
  +         Region region = cache.getCache().getRegion(Fqn.fromString("/a/b"), true);
  +         region.registerContextClassLoader(getClass().getClassLoader());
  +         region.activate();
            log.info("TEST: " + name + " activated region" + " " + System.currentTimeMillis());
            String childFqn = "/a/b/" + name;
   
  
  
  



More information about the jboss-cvs-commits mailing list