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

Ben Wang bwang at jboss.com
Tue Oct 10 02:26:59 EDT 2006


  User: bwang   
  Date: 06/10/10 02:26:59

  Modified:    tests-50/functional/org/jboss/cache/pojo/region    
                        NewLocalTest.java ReplicatedTest.java
                        LocalTest.java LocalConcurrentTest.java
  Log:
  upd
  
  Revision  Changes    Path
  1.4       +7 -2      JBossCache/tests-50/functional/org/jboss/cache/pojo/region/NewLocalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NewLocalTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/region/NewLocalTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- NewLocalTest.java	9 Oct 2006 08:14:51 -0000	1.3
  +++ NewLocalTest.java	10 Oct 2006 06:26:59 -0000	1.4
  @@ -14,6 +14,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.pojo.*;
   import org.jboss.cache.pojo.test.Person;
  +import org.jboss.cache.Fqn;
   
   import java.util.Map;
   
  @@ -41,7 +42,7 @@
         boolean toStart = false;
         cache_ = PojoCacheFactory.createInstance(configFile, toStart);
         cache_.start();
  -      InvocationContext.getCurrent().setRegion("SESSION");
  +      cache_.getCache().getRegion(Fqn.fromString("SESSION"), true);
      }
   
      protected void tearDown() throws Exception
  @@ -52,7 +53,11 @@
   
   //   public void testDummy() {}
   
  -   public void testBadFqn() throws Exception
  +   /**
  +    * Not applied anymore.
  +    * @throws Exception
  +    */
  +   public void XtestBadFqn() throws Exception
      {
         log_.info("testBadFqn() ....");
         Person test = new Person();
  
  
  
  1.3       +3 -1      JBossCache/tests-50/functional/org/jboss/cache/pojo/region/ReplicatedTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/region/ReplicatedTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ReplicatedTest.java	8 Sep 2006 07:55:58 -0000	1.2
  +++ ReplicatedTest.java	10 Oct 2006 06:26:59 -0000	1.3
  @@ -15,6 +15,7 @@
   import org.jboss.cache.pojo.*;
   import org.jboss.cache.pojo.test.Person;
   import org.jboss.cache.pojo.test.Student;
  +import org.jboss.cache.Fqn;
   
   import java.util.List;
   
  @@ -44,7 +45,8 @@
         cache.start();
         cache1 = PojoCacheFactory.createInstance(configFile, toStart);
         cache1.start();
  -      InvocationContext.getCurrent().setRegion("SESSION");
  +      cache.getCache().getRegion(Fqn.fromString("SESSION"), true);
  +      cache1.getCache().getRegion(Fqn.fromString("SESSION"), true);
      }
   
      protected void tearDown() throws Exception
  
  
  
  1.5       +20 -5     JBossCache/tests-50/functional/org/jboss/cache/pojo/region/LocalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/region/LocalTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- LocalTest.java	17 Sep 2006 02:44:25 -0000	1.4
  +++ LocalTest.java	10 Oct 2006 06:26:59 -0000	1.5
  @@ -17,6 +17,7 @@
   import org.jboss.cache.pojo.test.Address;
   import org.jboss.cache.pojo.test.Student;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.Node;
   import org.jboss.aop.proxy.ClassProxy;
   
   import java.util.List;
  @@ -36,6 +37,7 @@
   {
      Log log = LogFactory.getLog(org.jboss.cache.pojo.region.LocalTest.class);
      PojoCache cache_;
  +   static final String REGION = "person";
   
      public LocalTest(String name)
      {
  @@ -50,7 +52,8 @@
         boolean toStart = false;
         cache_ = PojoCacheFactory.createInstance(configFile, toStart);
         cache_.start();
  -      InvocationContext.getCurrent().setRegion("SESSION");
  +      cache_.getCache().getRegion(Fqn.fromString(REGION), true);
  +      cache_.getCache().getRegion(Fqn.fromString("RANDOM"), true);
      }
   
      protected void tearDown() throws Exception
  @@ -95,8 +98,8 @@
         assertEquals((Object) "Joe Black", p.getName());
   
         assertTrue("Region node should exist ",
  -              cache_.getCache().hasChild(new Fqn(new Fqn("SESSION"), "person")));
  -      Fqn fqn = new Fqn(InternalConstant.JBOSS_INTERNAL, "SESSION");
  +              cache_.getCache().hasChild(new Fqn(REGION)));
  +      Fqn fqn = new Fqn(Fqn.fromString(REGION), InternalConstant.JBOSS_INTERNAL);
         assertTrue("Internal region node should exist ",
                 cache_.getCache().hasChild(fqn));
      }
  @@ -113,8 +116,14 @@
      {
         Person joe = createPerson("person/test3", "Joe", 32);
         cache_.detach("person/test3");
  -//      assertNull("Underlying cache content " + cache_.getCache().printDetails(),
  -//              cache_.getCache().get("person/test3"));
  +
  +      String str = ((org.jboss.cache.TreeCacheProxyImpl)cache_.getCache()).printDetails();
  +      System.out.println("**** Details ***/n" +str);
  +
  +      Fqn fqn = new Fqn(Fqn.fromString(REGION), InternalConstant.JBOSS_INTERNAL);
  +      Node n = cache_.getCache().getChild(fqn);
  +      assertTrue("Internal region node should not exist ",
  +              n.getChildren().size() == 0);
      }
   
      public void testDynamicRefSwapping() throws Exception
  @@ -184,6 +193,12 @@
         log.debug("Hobbies is " + hobbies.toString());
   
         cache_.detach("person/test1");
  +
  +      Fqn fqn = new Fqn(Fqn.fromString(REGION), InternalConstant.JBOSS_INTERNAL);
  +      Node n = cache_.getCache().getChild(fqn);
  +      assertTrue("Internal region node should not exist ",
  +              n.getChildren().size() == 0);
  +
         hobbies = ben.getHobbies();
         if ((hobbies instanceof ClassProxy))
         {
  
  
  
  1.3       +7 -5      JBossCache/tests-50/functional/org/jboss/cache/pojo/region/LocalConcurrentTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalConcurrentTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/region/LocalConcurrentTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- LocalConcurrentTest.java	8 Sep 2006 07:55:58 -0000	1.2
  +++ LocalConcurrentTest.java	10 Oct 2006 06:26:59 -0000	1.3
  @@ -15,6 +15,7 @@
   import org.jboss.cache.pojo.test.Address;
   import org.jboss.cache.transaction.DummyTransactionManager;
   import org.jboss.cache.lock.UpgradeException;
  +import org.jboss.cache.Fqn;
   
   import javax.transaction.UserTransaction;
   import javax.naming.Context;
  @@ -27,7 +28,7 @@
    * Local concurrent test for PojoCache. Test attach and detach under load
    * and concurrency.
    *
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    * @author<a href="mailto:bwang at jboss.org">Ben Wang</a> December 2004
    */
   public class LocalConcurrentTest extends TestCase
  @@ -170,7 +171,7 @@
         {
            try
            {
  -            InvocationContext.getCurrent().setRegion(Thread.currentThread().getName());
  +            cache_.getCache().getRegion(Fqn.fromString(Thread.currentThread().getName()), true);
               _run();
            }
            catch (Exception e)
  @@ -215,9 +216,10 @@
         ArrayList<String> newList = new ArrayList<String>();
   
         // Skip root node
  -      oldList.add("/");
  -      newList.add("/");
  -      strList.add("/");
  +      String str = Thread.currentThread().getName();
  +      oldList.add(str);
  +      newList.add(str);
  +      strList.add(str);
   
         while (depth > 0)
         {
  
  
  



More information about the jboss-cvs-commits mailing list