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

Brian Stansberry brian.stansberry at jboss.com
Fri Jan 5 10:30:36 EST 2007


  User: bstansberry
  Date: 07/01/05 10:30:36

  Modified:    tests/functional/org/jboss/cache/statetransfer  Tag:
                        Branch_JBossCache_1_4_0 VersionedTestBase.java
  Log:
  Add comments
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.5   +26 -14    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.6.2.4
  retrieving revision 1.6.2.5
  diff -u -b -r1.6.2.4 -r1.6.2.5
  --- VersionedTestBase.java	3 Jan 2007 03:54:32 -0000	1.6.2.4
  +++ VersionedTestBase.java	5 Jan 2007 15:30:36 -0000	1.6.2.5
  @@ -653,6 +653,8 @@
         config.configure(cache1, "META-INF/replSync-eviction-service.xml");      
         cache1.startService();
         
  +      // Put in a bunch of data, both in the default region
  +      // and in the region that's configured for 5 nodes max w/ a 4 sec max age
         for (int i = 0; i < 25000; i++)
         {
            cache1.put("/base/" + i, "key", "base" + i);
  @@ -673,6 +675,7 @@
         // exceed the 4 sec TTL when eviction thread runs
         TestingUtil.sleepThread(2500);
         
  +      // Thread that puts data in the cache
         class Putter extends Thread
         {
             TreeCache cache = null;
  @@ -696,6 +699,8 @@
                 }
             }
         }
  +      
  +      // Start putting data in the caches
         Putter p1= new Putter();
         p1.cache = cache1;
         p1.start();
  @@ -703,9 +708,13 @@
         p2.cache = cache2;
         p2.start();
         
  +      // Pause a while to let puts occur.  Make the pause
  +      // random to guard against some pattern invalidating the result
         Random rnd = new Random();
  -      TestingUtil.sleepThread(rnd.nextInt(200));
  +      TestingUtil.sleepThread(rnd.nextInt(200) + 25);
         
  +      // Continuously check cache2 to confirm that at some point 
  +      // nodes are evicted from both regions
         int maxCountBase = 0;
         int maxCountData = 0;
         boolean sawBaseDecrease = false;
  @@ -761,22 +770,24 @@
         assertNull("No exceptions in p1", p1.ex);
         assertNull("No exceptions in p2", p2.ex);
         
  -      // Sleep 5.1 secs so we are sure the eviction thread ran
  +      // Sleep 5.1 secs so we are sure the eviction thread ran again
         TestingUtil.sleepThread(5100);
         
  -      children = cache2.getChildrenNames("/org/jboss/test/data");
  +      children = cache2.getChildrenNames("/base");
         if (children != null)
         {
            System.out.println(children.size());
  -         assertTrue("Excess children evicted", children.size() <= 5);
  +         assertTrue("Excess children evicted", children.size() <= 25000);
         }
  -      children = cache2.getChildrenNames("/base");
  +      children = cache2.getChildrenNames("/org/jboss/test/data");
         if (children != null)
         {
            System.out.println(children.size());
  -         assertTrue("Excess children evicted", children.size() <= 25000);
  +         assertTrue("Excess children evicted", children.size() <= 5);
         }
         
  +      if (children != null && children.size() > 0)
  +      {
         // Sleep more to let the eviction thread run again,
         // which will evict all data nodes due to their ttl of 4 secs
         TestingUtil.sleepThread(5100);
  @@ -785,6 +796,7 @@
         if (children != null)
            assertEquals("All data children evicted", 0, children.size());
      }
  +   }
      
      private Object createBen(ClassLoader loader) throws Exception
      {
  
  
  



More information about the jboss-cvs-commits mailing list