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

Manik Surtani manik at jboss.org
Thu May 24 14:13:59 EDT 2007


  User: msurtani
  Date: 07/05/24 14:13:59

  Modified:    tests/functional/org/jboss/cache/buddyreplication   
                        BuddyReplicationWithCacheLoaderTest.java
                        BuddyBackupActivationInactivationTest.java
                        BuddyReplicationTestsBase.java
  Log:
  fixed buggy stuff around BG comms
  
  Revision  Changes    Path
  1.9       +109 -105  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.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- BuddyReplicationWithCacheLoaderTest.java	2 Mar 2007 12:07:44 -0000	1.8
  +++ BuddyReplicationWithCacheLoaderTest.java	24 May 2007 18:13:59 -0000	1.9
  @@ -11,6 +11,8 @@
   import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.misc.TestingUtil;
   
  +import java.util.Map;
  +
   /**
    * Tests use of the data gravitator alongside other cache loaders as well as data gravitator options such as removeOnFind.
    *
  @@ -120,10 +122,15 @@
            // create 3 caches
            caches = createCachesWithCacheLoader(3, true, false, passivation);
            CacheLoader[] loaders = getLoaders(caches);
  -
  +      Fqn b1 = BuddyManager.getBackupFqn(caches[0].getLocalAddress(), fqn);
  +      Fqn b2 = BuddyManager.getBackupFqn(caches[2].getLocalAddress(), fqn);
            // put stuff in cache0
            caches[0].put(fqn, key, value);
   
  +      Map m = loaders[1].get(b1);
  +      System.out.println("From loader:  " + m);
  +
  +      System.out.println("*** About do cause a gravitation event ... ");
            // request data from cache2
            assertEquals(value, caches[2].get(fqn, key));
   
  @@ -145,9 +152,6 @@
            // test that data does exist in loader2
            assertTrue("should exist in loader2", passivation ? !loaders[2].exists(fqn) : loaders[2].exists(fqn));
   
  -         Fqn b1 = new Fqn(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, BuddyManager.getGroupNameFromAddress(caches[0].getLocalAddress())), fqn.peekElements());
  -         Fqn b2 = new Fqn(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, BuddyManager.getGroupNameFromAddress(caches[2].getLocalAddress())), fqn.peekElements());
  -
            // test that bkup does exist in cache0
            assertTrue("should not exist in cache0", !caches[0].exists(b1));
            assertTrue("should exist in cache0", caches[0].exists(b2));
  
  
  
  1.18      +21 -4     JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyBackupActivationInactivationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- BuddyBackupActivationInactivationTest.java	23 Apr 2007 15:56:29 -0000	1.17
  +++ BuddyBackupActivationInactivationTest.java	24 May 2007 18:13:59 -0000	1.18
  @@ -18,6 +18,7 @@
   import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.misc.TestingUtil;
  +import org.jboss.cache.util.CachePrinter;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -45,15 +46,31 @@
      {
         CacheSPI cache1 = createCache("cache1", true, true, true);
         CacheSPI cache2 = createCache("cache2", true, true, true);
  -
  +      Fqn A = Fqn.fromString("/a");
         TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
   
  -      cache1.getRegionManager().activate(Fqn.fromString("/a"));
  +      // create the regions on the two caches first
  +      Region c1 = cache1.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
  +      Region c2 = cache2.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
  +
  +      assertFalse(c1.isActive());
  +      assertFalse(c2.isActive());
  +
  +      c1.activate();
         cache1.put(A_B, "name", JOE);
   
         TestingUtil.sleepThread(getSleepTimeout());
   
  -      cache2.getRegionManager().activate(Fqn.fromString("/a"));
  +      System.out.println("Cache dump BEFORE activation");
  +      System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
  +      System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
  +
  +      c2.activate();
  +
  +      System.out.println("Cache dump AFTER activation");
  +      System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
  +      System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
  +
         Fqn fqn = BuddyManager.getBackupFqn(cache1.getLocalAddress(), A_B);
   
         assertEquals("State transferred with activation", JOE, cache2.get(fqn, "name"));
  @@ -122,7 +139,7 @@
         Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
   
         cache.setConfiguration(c);
  -      cache.getConfiguration().setClusterName("Test");
  +      cache.getConfiguration().setClusterName("TestCluster");
         if (useMarshalling)
         {
            cache.getConfiguration().setUseRegionBasedMarshalling(true);
  
  
  
  1.45      +3 -3      JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyReplicationTestsBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -b -r1.44 -r1.45
  --- BuddyReplicationTestsBase.java	16 Apr 2007 17:37:10 -0000	1.44
  +++ BuddyReplicationTestsBase.java	24 May 2007 18:13:59 -0000	1.45
  @@ -111,7 +111,7 @@
   
      protected CacheImpl createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
      {
  -      CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),false);
  +      CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
         c.getConfiguration().setClusterName("BuddyReplicationTest");
         // basic config
         String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
  @@ -216,7 +216,7 @@
                 "<preload></preload>\n" +
   
                 "<cacheloader>\n" +
  -              "<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
  +              "<class>org.jboss.cache.loader.DummyInMemoryCacheLoader</class>\n" +
                 "<properties>location=" + (location) + "</properties>\n" +
                 "<async>false</async>\n" +
                 "<shared>false</shared>\n" +
  
  
  



More information about the jboss-cvs-commits mailing list