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

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


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

  Modified:    tests/functional/org/jboss/cache/loader               
                        ChainingCacheLoaderFullTest.java
                        CacheLoaderPurgingTest.java
                        LocalDelegatingCacheLoaderTest.java
                        RpcDelegatingCacheLoaderTests.java
                        CacheLoaderTestsBase.java
                        AsyncFileCacheLoaderTest.java
                        SharedCacheLoaderTest.java
                        ClusteredCacheLoaderTest.java
                        CacheLoaderWithReplicationTest.java
                        InterceptorSynchronizationTest.java
                        DataSourceIntegrationTest.java
                        TxCacheLoaderTest.java
                        CacheLoaderMethodCallCounterTest.java
                        BdbjeTest.java SingletonStoreCacheLoaderTest.java
  Log:
  Changed CacheImpl ctor to be protected, and changed cache factories accordingly
  
  Revision  Changes    Path
  1.11      +14 -13    JBossCache/tests/functional/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ChainingCacheLoaderFullTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- ChainingCacheLoaderFullTest.java	2 Jan 2007 17:15:29 -0000	1.10
  +++ ChainingCacheLoaderFullTest.java	11 Jan 2007 13:49:06 -0000	1.11
  @@ -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.factories.XmlConfigurationParser;
  @@ -49,7 +50,7 @@
   
      protected void startCache(boolean ignoreMods1, boolean ignoreMods2) throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(loc1, loc2, ignoreMods1, ignoreMods2));
         cache.getConfiguration().setCacheMode("local");
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  @@ -223,14 +224,14 @@
         Assert.assertEquals(value, loader2.get(fqn).get(key));
   
         // remove - not in a tx, see http://jira.jboss.com/jira/browse/JBCACHE-352
  -//        mgr.begin();
  +      //        mgr.begin();
         cache.remove(fqn);
   
  -//        Assert.assertNull(cache.get(fqn, key));
  -//        Assert.assertEquals(value + 2, chainingCacheLoader.get(fqn).get(key));
  -//        Assert.assertEquals(value + 2, loader1.get(fqn).get(key));
  -//        Assert.assertEquals(value, loader2.get(fqn).get(key));
  -//        mgr.commit();
  +      //        Assert.assertNull(cache.get(fqn, key));
  +      //        Assert.assertEquals(value + 2, chainingCacheLoader.get(fqn).get(key));
  +      //        Assert.assertEquals(value + 2, loader1.get(fqn).get(key));
  +      //        Assert.assertEquals(value, loader2.get(fqn).get(key));
  +      //        mgr.commit();
         Assert.assertEquals(value, chainingCacheLoader.get(fqn).get(key));
         Assert.assertNull(loader1.get(fqn));
         Assert.assertEquals(value, loader2.get(fqn).get(key));
  @@ -271,13 +272,13 @@
         Assert.assertEquals(value, cache.get(fqn, key));
   
         // remove - not in a tx, see http://jira.jboss.com/jira/browse/JBCACHE-352
  -//        mgr.begin();
  +      //        mgr.begin();
         cache.remove(fqn);
  -//        Assert.assertEquals(value, chainingCacheLoader.get(fqn).get(key));
  -//        Assert.assertEquals(value, loader1.get(fqn).get(key));
  -//        Assert.assertEquals(value, loader2.get(fqn).get(key));
  -//        Assert.assertNull(value, cache.get(fqn, key));
  -//        mgr.commit();
  +      //        Assert.assertEquals(value, chainingCacheLoader.get(fqn).get(key));
  +      //        Assert.assertEquals(value, loader1.get(fqn).get(key));
  +      //        Assert.assertEquals(value, loader2.get(fqn).get(key));
  +      //        Assert.assertNull(value, cache.get(fqn, key));
  +      //        mgr.commit();
         Assert.assertNull(value, cache.get(fqn, key));
         Assert.assertNull(value, chainingCacheLoader.get(fqn));
         Assert.assertNull(value, loader1.get(fqn));
  
  
  
  1.9       +4 -3      JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderPurgingTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoaderPurgingTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderPurgingTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- CacheLoaderPurgingTest.java	2 Jan 2007 17:15:30 -0000	1.8
  +++ CacheLoaderPurgingTest.java	11 Jan 2007 13:49:06 -0000	1.9
  @@ -8,6 +8,7 @@
   
   import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.factories.XmlConfigurationParser;
  @@ -35,7 +36,7 @@
   
      public void testSingleLoaderNoPurge() throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         Configuration c = new Configuration();
         cache.setConfiguration(c);
         c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "location=" + System.getProperty("java.io.tmpdir", "/tmp") + "/" + "CacheLoaderPurgingTest", false, false, false));
  @@ -59,7 +60,7 @@
   
      public void testSingleLoaderPurge() throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         Configuration c = new Configuration();
         cache.setConfiguration(c);
         c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "location=" + System.getProperty("java.io.tmpdir", "/tmp") + "/" + "CacheLoaderPurgingTest", false, false, false, true));
  @@ -86,7 +87,7 @@
   
      public void testTwoLoadersPurge() throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
   
         String xml = "<config>\n" +
                 "<passivation>false</passivation>\n" +
  
  
  
  1.16      +2 -1      JBossCache/tests/functional/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalDelegatingCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- LocalDelegatingCacheLoaderTest.java	30 Dec 2006 17:49:57 -0000	1.15
  +++ LocalDelegatingCacheLoaderTest.java	11 Jan 2007 13:49:06 -0000	1.16
  @@ -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;
   
   /**
  @@ -17,7 +18,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      +10 -9     JBossCache/tests/functional/org/jboss/cache/loader/RpcDelegatingCacheLoaderTests.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RpcDelegatingCacheLoaderTests.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/RpcDelegatingCacheLoaderTests.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- RpcDelegatingCacheLoaderTests.java	30 Dec 2006 17:49:57 -0000	1.9
  +++ RpcDelegatingCacheLoaderTests.java	11 Jan 2007 13:49:06 -0000	1.10
  @@ -1,6 +1,7 @@
   package org.jboss.cache.loader;
   
   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;
  @@ -11,7 +12,7 @@
   
   /**
    * @author Bela Ban
  - * @version $Id: RpcDelegatingCacheLoaderTests.java,v 1.9 2006/12/30 17:49:57 msurtani Exp $
  + * @version $Id: RpcDelegatingCacheLoaderTests.java,v 1.10 2007/01/11 13:49:06 msurtani Exp $
    */
   public class RpcDelegatingCacheLoaderTests
   {
  @@ -56,7 +57,7 @@
   
      private void start(boolean client) throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setClusterName("test-cluster");
         cache.getConfiguration().setInitialStateRetrievalTimeout(3000);
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
  @@ -86,13 +87,13 @@
   
         System.out.println("started as CLIENT");
         System.out.println("initial cache (fetched from SERVER) is " + cache.printLockInfo());
  -//      int i=1;
  -//      while(true) {
  -//         cache.put("/elements/" + i, "key", "value");
  -//         TestingUtil.sleepThread(1000);
  -//         cache.evict(Fqn.fromString("/elements/" + i));
  -//         i++;
  -//      }
  +      //      int i=1;
  +      //      while(true) {
  +      //         cache.put("/elements/" + i, "key", "value");
  +      //         TestingUtil.sleepThread(1000);
  +      //         cache.evict(Fqn.fromString("/elements/" + i));
  +      //         i++;
  +      //      }
   
         // TestingUtil.sleepThread a bit, because we use async repl, changes from the server may not yet have arrived
         TestingUtil.sleepThread(1000);
  
  
  
  1.43      +3 -2      JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderTestsBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoaderTestsBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderTestsBase.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -b -r1.42 -r1.43
  --- CacheLoaderTestsBase.java	10 Jan 2007 03:55:40 -0000	1.42
  +++ CacheLoaderTestsBase.java	11 Jan 2007 13:49:06 -0000	1.43
  @@ -4,6 +4,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;
  @@ -29,7 +30,7 @@
    * Commons tests for all CacheLoaders
    *
    * @author Bela Ban
  - * @version $Id: CacheLoaderTestsBase.java,v 1.42 2007/01/10 03:55:40 msurtani Exp $
  + * @version $Id: CacheLoaderTestsBase.java,v 1.43 2007/01/11 13:49:06 msurtani Exp $
    */
   abstract public class CacheLoaderTestsBase extends AbstractCacheLoaderTestBase
   {
  @@ -62,7 +63,7 @@
      {
         super.setUp();
         log.debug("\nTest " + getName() + "\n");
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         Configuration c = new Configuration();
         cache.setConfiguration(c);
         c.setCacheMode(Configuration.CacheMode.LOCAL);
  
  
  
  1.19      +2 -1      JBossCache/tests/functional/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AsyncFileCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- AsyncFileCacheLoaderTest.java	2 Jan 2007 17:15:30 -0000	1.18
  +++ AsyncFileCacheLoaderTest.java	11 Jan 2007 13:49:06 -0000	1.19
  @@ -5,6 +5,7 @@
   import junit.framework.TestSuite;
   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.config.Configuration;
  @@ -29,7 +30,7 @@
   
      protected void configureCache(String props) throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         // cache.setCacheLoaderConfiguration(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader",
         cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader",
  
  
  
  1.9       +3 -2      JBossCache/tests/functional/org/jboss/cache/loader/SharedCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SharedCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/SharedCacheLoaderTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- SharedCacheLoaderTest.java	30 Dec 2006 17:49:57 -0000	1.8
  +++ SharedCacheLoaderTest.java	11 Jan 2007 13:49:06 -0000	1.9
  @@ -7,6 +7,7 @@
   package org.jboss.cache.loader;
   
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.interceptors.CacheStoreInterceptor;
   import org.jboss.cache.interceptors.Interceptor;
   
  @@ -27,8 +28,8 @@
         if (cache1 != null || cache2 != null) tearDown();
   
         // set up 2 instances of CacheImpl with shared CacheLoaders.
  -      cache1 = new CacheImpl();
  -      cache2 = new CacheImpl();
  +      cache1 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
  +      cache2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
   
         cache1.getConfiguration().setCacheMode("REPL_SYNC");
         cache2.getConfiguration().setCacheMode("REPL_SYNC");
  
  
  
  1.13      +6 -5      JBossCache/tests/functional/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClusteredCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/ClusteredCacheLoaderTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- ClusteredCacheLoaderTest.java	2 Jan 2007 17:15:29 -0000	1.12
  +++ ClusteredCacheLoaderTest.java	11 Jan 2007 13:49:06 -0000	1.13
  @@ -10,6 +10,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   
  @@ -32,8 +33,8 @@
      protected void setUp() throws Exception
      {
         if (cache1 != null || cache2 != null) tearDown();
  -      cache1 = new CacheImpl();
  -      cache2 = new CacheImpl();
  +      cache1 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
  +      cache2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
   
         cache1.getConfiguration().setClusterName("CCL-Test");
         cache1.getConfiguration().setInitialStateRetrievalTimeout(2000);
  @@ -84,10 +85,10 @@
         // loader1 looks at cache2 while loader2 looks at cache1
         Assert.assertEquals("value", loader1.get(fqn).get(key));
         Assert.assertNull("Expecting null", loader2.get(fqn));
  -//        // calling a get on cache1 should cause the loader to retrieve the node from cache2
  +      //        // calling a get on cache1 should cause the loader to retrieve the node from cache2
         Assert.assertEquals("value", cache1.get(fqn, key));
  -//        // and now loader2 should see it
  -//        Assert.assertEquals("value", loader2.get(fqn).get(key));
  +      //        // and now loader2 should see it
  +      //        Assert.assertEquals("value", loader2.get(fqn).get(key));
      }
   
      public void testGet() throws Exception
  
  
  
  1.27      +3 -2      JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoaderWithReplicationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -b -r1.26 -r1.27
  --- CacheLoaderWithReplicationTest.java	2 Jan 2007 17:15:29 -0000	1.26
  +++ CacheLoaderWithReplicationTest.java	11 Jan 2007 13:49:06 -0000	1.27
  @@ -12,6 +12,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.misc.TestingUtil;
  @@ -52,11 +53,11 @@
   
      public void setUp() throws Exception
      {
  -      cache1 = new CacheImpl();
  +      cache1 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", "location=" + tmpLocation1, false, true, false));
         cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
   
  -      cache2 = new CacheImpl();
  +      cache2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", "location=" + tmpLocation2, false, true, false));
         cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
      }
  
  
  
  1.7       +5 -4      JBossCache/tests/functional/org/jboss/cache/loader/InterceptorSynchronizationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: InterceptorSynchronizationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/InterceptorSynchronizationTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- InterceptorSynchronizationTest.java	30 Dec 2006 17:49:57 -0000	1.6
  +++ InterceptorSynchronizationTest.java	11 Jan 2007 13:49:06 -0000	1.7
  @@ -3,6 +3,7 @@
   import junit.framework.TestCase;
   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.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
  @@ -28,14 +29,14 @@
   public class InterceptorSynchronizationTest extends TestCase
   {
   
  -   final int CACHELOADER_WAITTIME = 2000; // lets say loading a node takes 2 seconds
  -   final int numThreadsPerTopLevelNode = 5; // we'll have 5 requests for nodes within a branch
  +   final int CACHELOADER_WAITTIME = 2000;// lets say loading a node takes 2 seconds
  +   final int numThreadsPerTopLevelNode = 5;// we'll have 5 requests for nodes within a branch
   
   
      public void testBlockingProblem() throws Exception
      {
   
  -      CacheImpl cache = new CacheImpl();
  +      CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.setCacheLoader(new TestSlowCacheLoader());
         cache.start();
   
  @@ -74,7 +75,7 @@
         *
         * In this test, NONE of the threads operate in parallel once entered into CacheLoaderInterceptor.
         */
  -      int totalTimeExpectedToWaitIfNotSerialized = 3 * CACHELOADER_WAITTIME;  // i'm being very generous here.   3 times the wait time for each node is more than enough if it was in parallel.
  +      int totalTimeExpectedToWaitIfNotSerialized = 3 * CACHELOADER_WAITTIME;// i'm being very generous here.   3 times the wait time for each node is more than enough if it was in parallel.
         assertTrue("If it was parallel, it should have finished quicker than this:" + timeTaken, timeTaken < totalTimeExpectedToWaitIfNotSerialized);
      }
   
  
  
  
  1.12      +2 -1      JBossCache/tests/functional/org/jboss/cache/loader/DataSourceIntegrationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DataSourceIntegrationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/DataSourceIntegrationTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- DataSourceIntegrationTest.java	2 Jan 2007 17:15:30 -0000	1.11
  +++ DataSourceIntegrationTest.java	11 Jan 2007 13:49:06 -0000	1.12
  @@ -7,6 +7,7 @@
   package org.jboss.cache.loader;
   
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.config.CacheLoaderConfig;
   import org.jboss.cache.transaction.DummyTransactionManager;
   
  @@ -59,7 +60,7 @@
         {
            // expected
         }
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode("local");
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(JNDI_NAME));
  
  
  
  1.9       +8 -7      JBossCache/tests/functional/org/jboss/cache/loader/TxCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TxCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/TxCacheLoaderTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- TxCacheLoaderTest.java	30 Dec 2006 17:49:57 -0000	1.8
  +++ TxCacheLoaderTest.java	11 Jan 2007 13:49:06 -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.Fqn;
   import org.jboss.cache.misc.TestingUtil;
   import org.jboss.cache.transaction.DummyTransactionManager;
  @@ -16,7 +17,7 @@
   
   /**
    * @author Bela Ban
  - * @version $Id: TxCacheLoaderTest.java,v 1.8 2006/12/30 17:49:57 msurtani Exp $
  + * @version $Id: TxCacheLoaderTest.java,v 1.9 2007/01/11 13:49:06 msurtani Exp $
    */
   public class TxCacheLoaderTest extends AbstractCacheLoaderTestBase
   {
  @@ -30,7 +31,7 @@
         String tmpLoc = System.getProperty("java.io.tmpdir", "/tmp");
         String location = tmpLoc + File.separator + "TxCacheLoaderTest1";
   
  -      cache1 = new CacheImpl();
  +      cache1 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache1.getConfiguration().setCacheMode("repl_sync");
         cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
   
  @@ -41,7 +42,7 @@
   
         location = tmpLoc + File.separator + "TxCacheLoaderTest2";
   
  -      cache2 = new CacheImpl();
  +      cache2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache2.getConfiguration().setCacheMode("repl_sync");
         cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "location=" + location, false, false, false));
  @@ -106,7 +107,7 @@
               {
                  mgr.begin();
                  tx2 = mgr.getTransaction();
  -               cache2.put(fqn, "block-key1", "block-val1"); // acquires a lock on cache2./one/two/three
  +               cache2.put(fqn, "block-key1", "block-val1");// acquires a lock on cache2./one/two/three
                  TestingUtil.sleepThread(5000);
               }
               catch (Exception e)
  @@ -138,7 +139,7 @@
   
         try
         {
  -         tx1.commit(); // prepare() on cache2 will fail due to lock held by locker thread
  +         tx1.commit();// prepare() on cache2 will fail due to lock held by locker thread
            fail("commit() should fail because we cannot acquire the lock on cache2");
         }
         catch (RollbackException rollback)
  @@ -163,7 +164,7 @@
         assertTrue(cache1.exists(fqn));
         tx.commit();
         assertTrue(cache1.exists(fqn));
  -      cache1.put("/a/b/c", null); // should be run outside a TX !
  +      cache1.put("/a/b/c", null);// should be run outside a TX !
         assertTrue(cache1.exists("/a/b/c"));
      }
   
  @@ -178,7 +179,7 @@
         tx.rollback();
         assertFalse(cache1.getCacheLoader().exists(fqn));
         assertFalse(cache1.exists(fqn));
  -      cache1.put("/a/b/c", null); // should be run outside a TX !
  +      cache1.put("/a/b/c", null);// should be run outside a TX !
         assertTrue(cache1.exists("/a/b/c"));
      }
   
  
  
  
  1.14      +4 -1      JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoaderMethodCallCounterTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- CacheLoaderMethodCallCounterTest.java	2 Jan 2007 17:15:29 -0000	1.13
  +++ CacheLoaderMethodCallCounterTest.java	11 Jan 2007 13:49:06 -0000	1.14
  @@ -8,6 +8,7 @@
   
   import junit.textui.TestRunner;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   
   /**
    * A simple non-failing unit test to measure how many times each method on a cache loader is called.
  @@ -27,7 +28,7 @@
      protected void setUp() throws Exception
      {
         if (cache != null) tearDown();
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCacheLoader.class.getName(), "", false, false, false));
         cache.start();
         dummyLoader = (DummyCacheLoader) cache.getCacheLoaderManager().getCacheLoader();
  @@ -36,7 +37,9 @@
      protected void tearDown()
      {
         if (cache != null)
  +      {
            cache.stop();
  +      }
         cache.destroy();
         cache = null;
      }
  
  
  
  1.17      +28 -26    JBossCache/tests/functional/org/jboss/cache/loader/BdbjeTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BdbjeTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/BdbjeTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- BdbjeTest.java	30 Dec 2006 19:48:47 -0000	1.16
  +++ BdbjeTest.java	11 Jan 2007 13:49:06 -0000	1.17
  @@ -9,6 +9,8 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.CacheSPI;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
   import org.jboss.cache.loader.bdbje.BdbjeCacheLoaderConfig;
  @@ -35,7 +37,7 @@
    * directory.  Any scratch directory will do, but beware that all files in
    * the directory will be deleted by setUp().</p>
    *
  - * @version $Revision: 1.16 $
  + * @version $Revision: 1.17 $
    */
   public class BdbjeTest extends TestCase
   {
  @@ -138,7 +140,7 @@
          * name and TransactionManagerLookupClass (transactional) propertes only.
          * the CacheImpl object is not used otherwise during testing.
          */
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setClusterName("myCluster");
         if (transactional)
         {
  @@ -784,28 +786,28 @@
      /**
       * Test exception cases and create/destroy/create/destroy sequence.
       */
  -//   public void testBasicExceptions()
  -//      throws Exception {
  -//
  -//      instantiateLoader();
  -//      checkPreCreateExceptions();
  -//
  -//      startLoader(false, null);
  -//      checkPostCreateExceptions();
  -//      loader.put(FQN, "one", "two");
  -//      assertEquals("two", loader.get(FQN).get("one"));
  -//
  -//      stopLoader();
  -//      checkPreCreateExceptions();
  -//
  -//      startLoader(false, null);
  -//      checkPostCreateExceptions();
  -//      loader.put(FQN, "one", "two");
  -//      assertEquals("two", loader.get(FQN).get("one"));
  -//
  -//      stopLoader();
  -//      checkPreCreateExceptions();
  -//   }
  +   //   public void testBasicExceptions()
  +   //      throws Exception {
  +   //
  +   //      instantiateLoader();
  +   //      checkPreCreateExceptions();
  +   //
  +   //      startLoader(false, null);
  +   //      checkPostCreateExceptions();
  +   //      loader.put(FQN, "one", "two");
  +   //      assertEquals("two", loader.get(FQN).get("one"));
  +   //
  +   //      stopLoader();
  +   //      checkPreCreateExceptions();
  +   //
  +   //      startLoader(false, null);
  +   //      checkPostCreateExceptions();
  +   //      loader.put(FQN, "one", "two");
  +   //      assertEquals("two", loader.get(FQN).get("one"));
  +   //
  +   //      stopLoader();
  +   //      checkPreCreateExceptions();
  +   //   }
   
      /**
       * Check exception cases that occur before create().
  @@ -814,7 +816,7 @@
              throws Exception
      {
   
  -      loader.setCache(new CacheImpl());
  +      loader.setCache((CacheSPI) DefaultCacheFactory.getInstance().createCache(false));
         loader.setConfig(null);
         try
         {
  @@ -838,7 +840,7 @@
         {
         }
   
  -      loader.setCache(new CacheImpl());
  +      loader.setCache((CacheSPI) DefaultCacheFactory.getInstance().createCache(false));
         config = new BdbjeCacheLoaderConfig();
         config.setLocation("directory_that_does_not_exist");
         loader.setConfig(config);
  
  
  
  1.6       +4 -3      JBossCache/tests/functional/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SingletonStoreCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- SingletonStoreCacheLoaderTest.java	2 Jan 2007 17:15:30 -0000	1.5
  +++ SingletonStoreCacheLoaderTest.java	11 Jan 2007 13:49:06 -0000	1.6
  @@ -10,6 +10,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheImpl;
   import org.jboss.cache.CacheSPI;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.CacheLoaderConfig;
   import org.jboss.cache.config.Configuration;
  @@ -31,9 +32,9 @@
      {
         log.info("*** test:" + getName() + " ***");
   
  -      cache1 = new CacheImpl();
  -      cache2 = new CacheImpl();
  -      cache3 = new CacheImpl();
  +      cache1 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
  +      cache2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
  +      cache3 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
   
         cache1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
         cache2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
  
  
  



More information about the jboss-cvs-commits mailing list