[jboss-user] [JBossCache] - Re: Buddy replication behavior

puggelli do-not-reply at jboss.com
Wed Jan 17 12:38:19 EST 2007


Manik, this is a test case that cover this use case:


  | public class BuddyReplicationFailoverTest extends BuddyReplicationTestsBase 
  | {
  | ...
  | 
  |     public void testReplication() throws Exception
  |     {
  |     	caches = createCaches(3, false, false, false);
  | 
  |     	final String[] fqns = { "/one", "/two", "/three" };
  |     	final String[] backupFqns = {
  |     			"/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" 
  |     			+ BuddyManager.getGroupNameFromAddress(caches[0].getLocalAddress()) + fqns[0],
  |     			
  |     			"/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" 
  |     			+ BuddyManager.getGroupNameFromAddress(caches[1].getLocalAddress()) + fqns[1],
  |     			
  |     			"/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" 
  |     			+ BuddyManager.getGroupNameFromAddress(caches[2].getLocalAddress()) + fqns[2],
  |     	};
  |     	
  |     	caches[0].put(fqns[0], key, value);
  |     	caches[1].put(fqns[1], key, value);
  |     	caches[2].put(fqns[2], key, value);
  |     	
  |     	dumpCacheContents(caches);
  |     	
  |         caches[0].stopService();
  |         caches[0] = null;
  |         TestingUtil.sleepThread(500);
  |         
  |         dumpCacheContents(caches);
  | 
  |         assertTrue("caches[1] should contain \"one\" and \"two\"", 
  |                    caches[1].exists(fqns[0]) && caches[1].exists(fqns[2]));
  |         assertTrue("caches[1] should contain the \"three\" backup", caches[1].exists(backupFqns[2]));
  |         
  |         assertTrue("caches[2] should contain \"three\"", caches[2].exists(fqns[2]));
  |         assertTrue("caches[2] should contain the \"one\" and \"two\" backups", 
  |                    caches[2].exists(backupFqns[0]) && caches[2].exists(backupFqns[1]));    	
  |     }
  | ...
  | }
  | 

The first assertion fails. This is what is printed before the first cache kill:


  | **** START: Cache Contents ****
  |   ** Cache 0 is 192.168.0.4:33266
  |     
  | /one
  | /_BUDDY_BACKUP_
  |     /192.168.0.4_33270
  |         /three
  | 
  |   ** Cache 1 is 192.168.0.4:33268
  |     
  | /_BUDDY_BACKUP_
  |     /192.168.0.4_33266
  |         /one
  | /two
  | 
  |   ** Cache 2 is 192.168.0.4:33270
  |     
  | /three
  | /_BUDDY_BACKUP_
  |     /192.168.0.4_33268
  |         /two
  | 
  | **** END: Cache Contents ****
  | 

While this is what is printed after the kill:


  | **** START: Cache Contents ****
  |   ** Cache 0 is null!
  |   ** Cache 1 is 192.168.0.4:33268
  |     
  | /_BUDDY_BACKUP_
  |     /192.168.0.4_33270
  |         /three
  |     /192.168.0.4_33266
  |         /one
  | /two
  | 
  |   ** Cache 2 is 192.168.0.4:33270
  |     
  | /three
  | /_BUDDY_BACKUP_
  |     /192.168.0.4_33268
  |         /two
  | 
  | **** END: Cache Contents ****
  | 

The same as my original post.

Thanks and regards
gianluca

-- 
Gianluca Puggelli
skype:pugg1138

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4002950#4002950

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4002950



More information about the jboss-user mailing list