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

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


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

  Added:       tests/functional/org/jboss/cache/passivation  Tag:
                        Branch_JBossCache_1_4_0 OptionSurvivalTest.java
  Log:
  [JBCACHE-1139] Confirm option survives CacheLoaderInterceptor call
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +99 -0     JBossCache/tests/functional/org/jboss/cache/passivation/Attic/OptionSurvivalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptionSurvivalTest.java
  ===================================================================
  RCS file: OptionSurvivalTest.java
  diff -N OptionSurvivalTest.java
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ OptionSurvivalTest.java	13 Jul 2007 16:55:51 -0000	1.1.2.1
  @@ -0,0 +1,99 @@
  +/*
  + * JBoss, Home of Professional Open Source
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
  + */
  +
  +package org.jboss.cache.passivation;
  +
  +import junit.framework.Test;
  +import junit.framework.TestSuite;
  +import org.jboss.cache.Fqn;
  +import org.jboss.cache.PropertyConfigurator;
  +import org.jboss.cache.TreeCache;
  +import org.jboss.cache.TreeCacheMBean;
  +import org.jboss.cache.config.Option;
  +import org.jboss.cache.loader.DummyInMemoryCacheLoader;
  +import org.jboss.cache.loader.AbstractCacheLoaderTestBase;
  +import org.jboss.cache.misc.TestingUtil;
  +
  +/**
  + * Test for http://jira.jboss.com/jira/browse/JBCACHE-1139.
  + * 
  + * Issue is not really specific to passivation. I wrote the test before the exact
  + * scope of JBCACHE-1139 was clear. But, it's a valid test, so no reason
  + * to discard it.
  + *
  + * @author Brian Stansberry
  + * @version $Revision: 1.1.2.1 $
  + */
  +public class OptionSurvivalTest extends AbstractCacheLoaderTestBase
  +{
  +   private TreeCache cache0;
  +   private TreeCache cache1;
  +   private int wakeupIntervalMillis_ = 0;
  +
  +   public OptionSurvivalTest(String s)
  +   {
  +      super(s);
  +   }
  +
  +   public void setUp() throws Exception
  +   {
  +      super.setUp();
  +      cache0 = createCache();
  +      cache1 = createCache();
  +      wakeupIntervalMillis_ = cache0.getEvictionThreadWakeupIntervalSeconds() * 1000;
  +      if (wakeupIntervalMillis_ < 0)
  +         fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis_);
  +      TestingUtil.blockUntilViewsReceived(new TreeCacheMBean[] { cache0, cache1}, 5000);
  +   }
  +
  +   private TreeCache createCache() throws Exception
  +   {
  +      TreeCache cache = new TreeCache();
  +      PropertyConfigurator config = new PropertyConfigurator();
  +      config.configure(cache, "META-INF/local-passivation-service.xml"); // read in generic local xml
  +      cache.setCacheMode("REPL_SYNC");
  +      cache.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      cache.setCacheLoaderConfiguration(getSingleCacheLoaderConfig(true, "/", DummyInMemoryCacheLoader.class.getName(), null, false, true, false, false));
  +      cache.startService();
  +      return cache;
  +   }
  +   
  +   public void tearDown() throws Exception
  +   {
  +      super.tearDown();
  +      cache0.stop();
  +      cache0 = null;
  +      cache1.stop();
  +      cache1 = null;
  +   }
  +
  +   /**
  +    * Confirm that a "cacheModeLocal=true" survives the cache loader.
  +    * 
  +    * @throws Exception
  +    */
  +   public void testOptionSurvival() throws Exception
  +   {
  +      Fqn fqn = Fqn.fromString("/org/jboss/test");
  +      
  +      Option opt = new Option();
  +      opt.setCacheModeLocal(true);
  +      cache0.put(fqn, "test", "test", opt);
  +      
  +      assertNull(cache1.get(fqn, "test"));
  +   }
  +
  +   public static Test suite()
  +   {
  +      return new TestSuite(org.jboss.cache.passivation.OptionSurvivalTest.class);
  +   }
  +
  +   public static void main(String[] args)
  +   {
  +      junit.textui.TestRunner.run(org.jboss.cache.passivation.OptionSurvivalTest.suite());
  +   }
  +}
  
  
  



More information about the jboss-cvs-commits mailing list