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

Brian Stansberry brian.stansberry at jboss.com
Fri Jul 13 12:51:13 EDT 2007


  User: bstansberry
  Date: 07/07/13 12:51:13

  Modified:    tests/functional/org/jboss/cache/buddyreplication  Tag:
                        Branch_JBossCache_1_4_0
                        BuddyReplicationWithCacheLoaderTest.java
  Log:
  [JBCACHE-1139] Confirm that BR works with autoDataGravitation=false and a CacheLoader
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.2   +42 -5     JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyReplicationWithCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -b -r1.4.2.1 -r1.4.2.2
  --- BuddyReplicationWithCacheLoaderTest.java	10 Nov 2006 20:03:34 -0000	1.4.2.1
  +++ BuddyReplicationWithCacheLoaderTest.java	13 Jul 2007 16:51:12 -0000	1.4.2.2
  @@ -8,6 +8,7 @@
   
   import org.jboss.cache.Fqn;
   import org.jboss.cache.TreeCache;
  +import org.jboss.cache.config.Option;
   import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.misc.TestingUtil;
   
  @@ -18,7 +19,6 @@
    */
   public class BuddyReplicationWithCacheLoaderTest extends BuddyReplicationTestsBase
   {
  -
       protected Fqn fqn = Fqn.fromString("/test");
       protected String key = "key";
       protected String value = "value";
  @@ -38,12 +38,21 @@
   
       public void testWithDataGravitationDefault() throws Exception
       {
  +       dataGravitationDefaultTest(true);
  +    }
  +
  +    public void testNoAutoDataGravitationDefault() throws Exception
  +    {
  +       dataGravitationDefaultTest(false);
  +    }
   
  +    private void dataGravitationDefaultTest(boolean autoGravitate) throws Exception
  +    {
           TreeCache[] caches = null;
           try
           {
               // create 3 caches
  -            caches = createCachesWithCacheLoader(3, true, true, passivation);
  +            caches = createCachesWithCacheLoader(3, autoGravitate, true, passivation);
   
               TestingUtil.sleepThread(1000);
   
  @@ -64,7 +73,16 @@
               dumpCacheContents(caches);
   
               // request data from cache2
  +            if (autoGravitate)
  +            {
               assertEquals(value, caches[2].get(fqn, key));
  +            }
  +            else
  +            {
  +               Option opt = new Option();
  +               opt.setForceDataGravitation(true);
  +               assertEquals(value, caches[2].get(fqn, key, opt));
  +            }
               assertNoLocks(caches);
   
               for (int i=0;i<3; i++) System.out.println(i + ": " + loaders[i].get(fqn));
  @@ -128,18 +146,37 @@
   
       public void testWithDataGravitationEviction() throws Exception
       {
  +       dataGravitationEvictionTest(true);
  +    }
  +
  +    public void testNoAutoDataGravitationEviction() throws Exception
  +    {
  +       dataGravitationEvictionTest(false);
  +    }
  +    
  +    private void dataGravitationEvictionTest(boolean autoGravitate) throws Exception
  +    {
           TreeCache[] caches = null;
           try
           {
               // create 3 caches
  -            caches = createCachesWithCacheLoader(3, true, false, passivation);
  +            caches = createCachesWithCacheLoader(3, autoGravitate, false, passivation);
               CacheLoader[] loaders = getLoaders(caches);
   
               // put stuff in cache0
               caches[0].put(fqn, key, value);
   
               // request data from cache2
  +            if (autoGravitate)
  +            {
               assertEquals(value, caches[2].get(fqn, key));
  +            }
  +            else
  +            {
  +               Option opt = new Option();
  +               opt.setForceDataGravitation(true);
  +               assertEquals(value, caches[2].get(fqn, key, opt));
  +            }
   
               // test that data does not exist in cache0
               assertTrue("should not exist in cache0", !caches[0].exists(fqn));
  
  
  



More information about the jboss-cvs-commits mailing list