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

Manik Surtani msurtani at jboss.com
Thu Jan 11 08:49:04 EST 2007


  User: msurtani
  Date: 07/01/11 08:49:04

  Modified:    tests/functional/org/jboss/cache/passivation      
                        PassivationTestsBase.java BasicPassivationTest.java
                        PassivationToLocalDelegatingCacheLoaderTest.java
                        ConcurrentPassivationTest.java
                        ReplicatedPassivationIntegrationTest.java
                        LocalPassivationIntegrationTest.java
  Log:
  Changed CacheImpl ctor to be protected, and changed cache factories accordingly
  
  Revision  Changes    Path
  1.26      +3 -2      JBossCache/tests/functional/org/jboss/cache/passivation/PassivationTestsBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PassivationTestsBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/PassivationTestsBase.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -b -r1.25 -r1.26
  --- PassivationTestsBase.java	4 Jan 2007 05:35:36 -0000	1.25
  +++ PassivationTestsBase.java	11 Jan 2007 13:49:04 -0000	1.26
  @@ -7,6 +7,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
   import org.jboss.cache.Node;
  @@ -38,7 +39,7 @@
    * Base tests for passivation using any of the cache loaders
    *
    * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  - * @version $Id: PassivationTestsBase.java,v 1.25 2007/01/04 05:35:36 msurtani Exp $
  + * @version $Id: PassivationTestsBase.java,v 1.26 2007/01/11 13:49:04 msurtani Exp $
    */
   abstract public class PassivationTestsBase extends TestCase
   {
  @@ -73,7 +74,7 @@
         super.setUp();
         log.debug("Testing " + getName());
         log.debug("");
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode("local");
         configureCache();
         // cache.setCacheLoaderPreload("/1/2/3/4/5/d");
  
  
  
  1.14      +11 -8     JBossCache/tests/functional/org/jboss/cache/passivation/BasicPassivationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BasicPassivationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/BasicPassivationTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- BasicPassivationTest.java	30 Dec 2006 17:49:59 -0000	1.13
  +++ BasicPassivationTest.java	11 Jan 2007 13:49:04 -0000	1.14
  @@ -13,13 +13,14 @@
   import org.jboss.cache.AbstractCacheListener;
   import org.jboss.cache.CacheImpl;
   import org.jboss.cache.CacheListener;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.misc.TestingUtil;
   
   /**
    * @author Ben Wang
  - * @version $Revision: 1.13 $
  + * @version $Revision: 1.14 $
    */
   public class BasicPassivationTest extends TestCase
   {
  @@ -41,12 +42,14 @@
      public void setUp() throws Exception
      {
         super.setUp();
  -      TestingUtil.recursiveFileRemove("/tmp/JBossCacheFileCacheLoader"); // clean up any stale files left around by previous unit tests
  +      TestingUtil.recursiveFileRemove("/tmp/JBossCacheFileCacheLoader");// clean up any stale files left around by previous unit tests
         initCaches();
         wakeupIntervalMillis_ = cache_.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
         log("wakeupInterval is " + wakeupIntervalMillis_);
         if (wakeupIntervalMillis_ < 0)
  +      {
            fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis_);
  +      }
   
         t1_ex = t2_ex = null;
         isTrue = true;
  @@ -54,8 +57,8 @@
   
      void initCaches() throws Exception
      {
  -      cache_ = new CacheImpl();
  -      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml")); // read in generic local xml
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
  +      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"));// read in generic local xml
         cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         CacheListener listener = new TestCacheListener();
         cache_.start();
  @@ -140,8 +143,8 @@
      {
         public void nodeActivated(Fqn fqn, boolean pre)
         {
  -         if (pre) return;  // we are not interested in postActivate event
  -         if (!fqn.isChildOrEquals(Fqn.fromString(FQNSTR))) return;  // don't care about fqn that doesn't belong to me.
  +         if (pre) return;// we are not interested in postActivate event
  +         if (!fqn.isChildOrEquals(Fqn.fromString(FQNSTR))) return;// don't care about fqn that doesn't belong to me.
   
            log("nodeActivate(): send postActivate event on fqn: " + fqn);
            activationCount++;
  @@ -149,8 +152,8 @@
   
         public void nodePassivated(Fqn fqn, boolean pre)
         {
  -         if (!pre) return;  // we are not interested in postPassivate event
  -         if (!fqn.isChildOrEquals(Fqn.fromString(FQNSTR))) return;  // don't care about fqn that doesn't belong to me.
  +         if (!pre) return;// we are not interested in postPassivate event
  +         if (!fqn.isChildOrEquals(Fqn.fromString(FQNSTR))) return;// don't care about fqn that doesn't belong to me.
   
            log("nodePassivate(): send prePassivate event on fqn: " + fqn);
            passivationCount++;
  
  
  
  1.9       +3 -2      JBossCache/tests/functional/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PassivationToLocalDelegatingCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- PassivationToLocalDelegatingCacheLoaderTest.java	30 Dec 2006 17:49:59 -0000	1.8
  +++ PassivationToLocalDelegatingCacheLoaderTest.java	11 Jan 2007 13:49:04 -0000	1.9
  @@ -3,6 +3,7 @@
   import junit.framework.Test;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.loader.DelegatingCacheLoader;
   import org.jboss.cache.loader.LocalDelegatingCacheLoader;
  @@ -11,7 +12,7 @@
    * Runs a test against using delegated cache loader
    *
    * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  - * @version $Id: PassivationToLocalDelegatingCacheLoaderTest.java,v 1.8 2006/12/30 17:49:59 msurtani Exp $
  + * @version $Id: PassivationToLocalDelegatingCacheLoaderTest.java,v 1.9 2007/01/11 13:49:04 msurtani Exp $
    */
   public class PassivationToLocalDelegatingCacheLoaderTest extends PassivationTestsBase
   {
  @@ -21,7 +22,7 @@
   
      protected void configureCache() throws Exception
      {
  -      delegating_cache = new CacheImpl();
  +      delegating_cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         delegating_cache.create();
         delegating_cache.start();
  
  
  
  1.10      +6 -3      JBossCache/tests/functional/org/jboss/cache/passivation/ConcurrentPassivationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentPassivationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/ConcurrentPassivationTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- ConcurrentPassivationTest.java	30 Dec 2006 19:48:47 -0000	1.9
  +++ ConcurrentPassivationTest.java	11 Jan 2007 13:49:04 -0000	1.10
  @@ -11,6 +11,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.CacheLoaderConfig;
   import org.jboss.cache.config.Configuration;
  @@ -21,7 +22,7 @@
    * Tests cache behavior in the presence of concurrent passivation.
    *
    * @author Brian Stansberry
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class ConcurrentPassivationTest extends TestCase
   {
  @@ -39,15 +40,17 @@
         initCaches();
         wakeupIntervalMillis_ = cache_.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
         if (wakeupIntervalMillis_ < 0)
  +      {
            fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis_);
  +      }
   
      }
   
      void initCaches() throws Exception
      {
         TestingUtil.recursiveFileRemove("/tmp/JBossCacheFileCacheLoader");
  -      cache_ = new CacheImpl();
  -      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml")); // read in generic local xml
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
  +      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"));// read in generic local xml
         cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
   
         // hack in the path to the file store in the cache loaders
  
  
  
  1.5       +4 -3      JBossCache/tests/functional/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedPassivationIntegrationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- ReplicatedPassivationIntegrationTest.java	30 Dec 2006 17:49:59 -0000	1.4
  +++ ReplicatedPassivationIntegrationTest.java	11 Jan 2007 13:49:04 -0000	1.5
  @@ -27,6 +27,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.AbstractCacheListener;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.misc.TestingUtil;
  @@ -53,12 +54,12 @@
      public void setUp() throws Exception
      {
         super.setUp();
  -      cache_ = new CacheImpl();
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         initCaches(cache_);
         cache_.getConfiguration().setUseRegionBasedMarshalling(true);
         cache_.start();
   
  -      cache1_ = new CacheImpl();
  +      cache1_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         initCaches(cache1_);
         cache1_.getConfiguration().setUseRegionBasedMarshalling(true);
   
  @@ -76,7 +77,7 @@
   
      void initCaches(CacheImpl cache) throws Exception
      {
  -      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/replSync-passivation-service.xml")); // read in generic local xml
  +      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/replSync-passivation-service.xml"));// read in generic local xml
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
      }
   
  
  
  
  1.14      +4 -3      JBossCache/tests/functional/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalPassivationIntegrationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- LocalPassivationIntegrationTest.java	30 Dec 2006 17:49:59 -0000	1.13
  +++ LocalPassivationIntegrationTest.java	11 Jan 2007 13:49:04 -0000	1.14
  @@ -12,6 +12,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.AbstractCacheListener;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.CacheLoaderConfig;
   import org.jboss.cache.config.Configuration;
  @@ -39,8 +40,8 @@
      public void setUp() throws Exception
      {
         super.setUp();
  -      TestingUtil.recursiveFileRemove("/tmp/JBossCacheFileCacheLoader"); // clean up any stale files left around by previous unit tests
  -      cache_ = new CacheImpl();
  +      TestingUtil.recursiveFileRemove("/tmp/JBossCacheFileCacheLoader");// clean up any stale files left around by previous unit tests
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         initCaches(cache_);
         cache_.getConfiguration().setUseRegionBasedMarshalling(true);
   
  @@ -59,7 +60,7 @@
   
      void initCaches(CacheImpl cache) throws Exception
      {
  -      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml")); // read in generic local xml
  +      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"));// read in generic local xml
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         // hack in the path to the file store in the cache loaders
         injectCacheLoaderLocation(cache.getConfiguration(), "/tmp/JBossCacheFileCacheLoader");
  
  
  



More information about the jboss-cvs-commits mailing list