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

Manik Surtani msurtani at jboss.com
Thu Nov 16 11:51:53 EST 2006


  User: msurtani
  Date: 06/11/16 11:51:53

  Added:       tests/functional/org/jboss/cache/marshall 
                        ReplicateToInactiveRegionTest.java
  Log:
  Fixed issues dealing with inactive regions.
  
  Revision  Changes    Path
  1.1      date: 2006/11/16 16:51:53;  author: msurtani;  state: Exp;JBossCache/tests/functional/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
  
  Index: ReplicateToInactiveRegionTest.java
  ===================================================================
  package org.jboss.cache.marshall;
  
  import junit.framework.TestCase;
  import org.jboss.cache.TreeCache;
  import org.jboss.cache.Fqn;
  import org.jboss.cache.misc.TestingUtil;
  
  public class ReplicateToInactiveRegionTest extends TestCase
  {
     TreeCache[] caches;
  
     protected void setUp() throws Exception
     {
        super.setUp();
        caches = new TreeCache[]{createCache(), createCache()};
        TestingUtil.blockUntilViewsReceived(caches, 10000);
     }
  
     protected void tearDown() throws Exception
     {
        super.tearDown();
        destroyCache(caches[0]);
        destroyCache(caches[1]);
        caches = null;
     }
  
     private void destroyCache(TreeCache c)
     {
        c.stop();
     }
  
     private TreeCache createCache() throws Exception
     {
        TreeCache c = new TreeCache();
        c.getConfiguration().setCacheMode("REPL_SYNC");
        c.getConfiguration().setUseRegionBasedMarshalling(true);
        c.start();
        return c;
     }
  
     public void testTransferToInactiveRegion()
     {
        Fqn f = Fqn.fromString("/a/b");
        
        caches[0].put(f, "k", "v");
  
        assertEquals("v", caches[0].peek(f, "k"));
        assertEquals("v", caches[1].peek(f, "k"));
  
        // now deactvate the region on cache 2
        caches[1].getRegionManager().getRegion(f, true).deactivate();
  
        caches[0].put(f, "k", "v2");
        assertEquals("v2", caches[0].peek(f, "k"));
        assertNull(caches[1].peek(f, "k"));
  
     }
  }
  
  
  
  



More information about the jboss-cvs-commits mailing list