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

Manik Surtani msurtani at jboss.com
Fri Dec 8 07:17:58 EST 2006


  User: msurtani
  Date: 06/12/08 07:17:58

  Added:       tests/functional/org/jboss/cache/replicated  Tag:
                        Branch_JBossCache_1_4_0 AnycastTest.java
  Log:
  Anycast test
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +68 -0     JBossCache/tests/functional/org/jboss/cache/replicated/Attic/AnycastTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AnycastTest.java
  ===================================================================
  RCS file: AnycastTest.java
  diff -N AnycastTest.java
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ AnycastTest.java	8 Dec 2006 12:17:58 -0000	1.1.2.1
  @@ -0,0 +1,68 @@
  +package org.jboss.cache.replicated;
  +
  +import junit.framework.TestCase;
  +import org.jboss.cache.TreeCache;
  +import org.jboss.cache.Fqn;
  +import org.jboss.cache.misc.TestingUtil;
  +
  +
  +public class AnycastTest extends TestCase
  +{
  +   TreeCache[] caches;
  +   Fqn fqn = Fqn.fromString("/test");
  +
  +   protected void setUp() throws Exception
  +   {
  +      caches = new TreeCache[3];
  +      caches[0] = createCache();
  +      caches[1] = createCache();
  +      caches[2] = createCache();
  +
  +      TestingUtil.blockUntilViewsReceived(caches, 10000);
  +   }
  +
  +   protected void tearDown()
  +   {
  +      if (caches != null)
  +      {
  +         for (int i=0; i<caches.length; i++) caches[i].stopService();
  +      }
  +      caches = null;
  +   }
  +
  +   private TreeCache createCache() throws Exception
  +   {
  +      TreeCache c = new TreeCache();
  +      c.setCacheMode("REPL_SYNC");
  +      c.startService();
  +      return c;
  +   }
  +
  +   public void testMCastReplication() throws Exception
  +   {
  +      assertNull(caches[0].get(fqn));
  +      assertNull(caches[1].get(fqn));
  +      assertNull(caches[2].get(fqn));
  +      
  +      caches[0].put(fqn, "k", "v");
  +
  +      assertEquals("v", caches[0].get(fqn, "k"));
  +      assertEquals("v", caches[1].get(fqn, "k"));
  +      assertEquals("v", caches[2].get(fqn, "k"));
  +   }
  +
  +   public void testAnycastReplication() throws Exception
  +   {
  +      assertNull(caches[0].get(fqn));
  +      assertNull(caches[1].get(fqn));
  +      assertNull(caches[2].get(fqn));
  +
  +      caches[0].setForceAnycast(true);
  +      caches[0].put(fqn, "k", "v");
  +
  +      assertEquals("v", caches[0].get(fqn, "k"));
  +      assertEquals("v", caches[1].get(fqn, "k"));
  +      assertEquals("v", caches[2].get(fqn, "k"));
  +   }
  +
  +}
  
  
  



More information about the jboss-cvs-commits mailing list