[jboss-cvs] JBossCache/tests/perf/org/jboss/cache ...

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/perf/org/jboss/cache       
                        ReplicatedSyncPerfTest.java
                        ReplicatedAsyncPerfTest.java
                        ReplicatedSyncMapPerfTest.java
                        ConcurrentEvictAndRemoveTest.java
                        LocalPerfTest.java ReplicatedAsyncMapPerfTest.java
                        LocalMapPerfTest.java
  Log:
  Changed CacheImpl ctor to be protected, and changed cache factories accordingly
  
  Revision  Changes    Path
  1.8       +17 -8     JBossCache/tests/perf/org/jboss/cache/ReplicatedSyncPerfTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedSyncPerfTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/ReplicatedSyncPerfTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- ReplicatedSyncPerfTest.java	10 Jan 2007 16:44:14 -0000	1.7
  +++ ReplicatedSyncPerfTest.java	11 Jan 2007 13:49:06 -0000	1.8
  @@ -15,7 +15,6 @@
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheFactory;
  -import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.transaction.DummyTransactionManager;
   import org.jgroups.util.Util;
  @@ -30,7 +29,7 @@
    *
    * @author Bela Ban
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class ReplicatedSyncPerfTest extends TestCase
   {
  @@ -62,12 +61,14 @@
         destroyCache(cache2_);
         destroyCache(cache3_);
         if (tx != null)
  +      {
            tx.rollback();
      }
  +   }
   
      CacheImpl createCache(IsolationLevel level) throws Exception
      {
  -      CacheImpl cache = new CacheImpl();
  +      CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC));
         cache.getConfiguration().setIsolationLevel(level);
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  @@ -112,7 +113,9 @@
            for (int i = 0; i < nOps; i++)
            {
               if (i % 1000 == 0 && i > 0)
  +            {
                  System.out.println(i);
  +            }
               tx = startTransaction();
               cache1_.put("/hello/world", "name", "Bela Ban");
               tx.commit();
  @@ -125,8 +128,10 @@
            t.printStackTrace();
            System.out.println("cache is " + cache1_.printLockInfo());
            if (tx != null)
  +         {
               tx.rollback();
         }
  +      }
         long time2 = System.currentTimeMillis();
         assertEquals("failedOps=" + failedOps, nOps, realOps);
   
  @@ -154,7 +159,9 @@
            for (int i = 0; i < nOps; i++)
            {
               if (i % 1000 == 0 && i > 0)
  +            {
                  System.out.println(i);
  +            }
               tx = startTransaction();
               key = Util.random(nOps);
               fqn = "/random/" + key;
  @@ -170,8 +177,10 @@
            t.printStackTrace();
            System.out.println("cache1_ locks: " + cache1_.printLockInfo());
            if (tx != null)
  +         {
               tx.rollback();
         }
  +      }
         long time2 = System.currentTimeMillis();
         assertEquals("failedOps=" + failedOps, nOps, realOps);
   
  @@ -269,7 +278,7 @@
   
         // Step 3. Remove entries from the cache
         time1 = System.currentTimeMillis();
  -      nOps = remove(cache2_, hasTx, oneTxOnly);  // Note we remove nodes from cache2.
  +      nOps = remove(cache2_, hasTx, oneTxOnly);// Note we remove nodes from cache2.
         time2 = System.currentTimeMillis();
         d = (double) (time2 - time1) / nOps;
         log("Time elapsed for _remove is " + (time2 - time1) + " with " + nOps
  @@ -314,7 +323,7 @@
   
         // Step 3. Remove entries from the cache
         time1 = System.currentTimeMillis();
  -      nOps = remove(cache2_, hasTx, oneTxOnly);  // Note we remove nodes from cache2.
  +      nOps = remove(cache2_, hasTx, oneTxOnly);// Note we remove nodes from cache2.
         time2 = System.currentTimeMillis();
         d = (double) (time2 - time1) / nOps;
         log("Time elapsed for _remove is " + (time2 - time1) + " with " + nOps
  @@ -351,7 +360,7 @@
   
         // Step 2. Query the cache
         time1 = System.currentTimeMillis();
  -      nOps = get(cache2_, hasTx, oneTxOnly);   // Note query is from cache2
  +      nOps = get(cache2_, hasTx, oneTxOnly);// Note query is from cache2
         time2 = System.currentTimeMillis();
         d = (double) (time2 - time1) / nOps;
         log("Time elapsed for _get is " + (time2 - time1) + " with " + nOps
  @@ -361,7 +370,7 @@
   
         // Step 3. Remove entries from the cache
         time1 = System.currentTimeMillis();
  -      nOps = remove(cache3_, hasTx, oneTxOnly);   // Note remove is from cache3
  +      nOps = remove(cache3_, hasTx, oneTxOnly);// Note remove is from cache3
         time2 = System.currentTimeMillis();
         d = (double) (time2 - time1) / nOps;
         log("Time elapsed for _remove is " + (time2 - time1) + " with " + nOps
  @@ -549,7 +558,7 @@
   
      private void log(String str)
      {
  -//     System.out.println(this.getClass().getLastElementAsString() +": " +str);
  +      //     System.out.println(this.getClass().getLastElementAsString() +": " +str);
         System.out.println(str);
      }
   
  
  
  
  1.8       +3 -5      JBossCache/tests/perf/org/jboss/cache/ReplicatedAsyncPerfTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedAsyncPerfTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/ReplicatedAsyncPerfTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- ReplicatedAsyncPerfTest.java	10 Jan 2007 16:58:42 -0000	1.7
  +++ ReplicatedAsyncPerfTest.java	11 Jan 2007 13:49:06 -0000	1.8
  @@ -15,7 +15,6 @@
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheFactory;
  -import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.transaction.DummyTransactionManager;
   
  @@ -31,7 +30,7 @@
    * Replicated asynchronous mode performance test for transactional CacheImpl
    *
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class ReplicatedAsyncPerfTest extends TestCase
   {
  @@ -93,8 +92,7 @@
   
      CacheImpl createCache(IsolationLevel level) throws Exception
      {
  -      CacheImpl cache = new CacheImpl();
  -      XmlConfigurationParser parser = new XmlConfigurationParser();
  +      CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         Configuration c = UnitTestCacheFactory.createConfiguration(CacheMode.REPL_ASYNC);
         cache.setConfiguration(c);
         c.setIsolationLevel(level);
  @@ -479,7 +477,7 @@
   
      private void log(String str)
      {
  -//     System.out.println(this.getClass().getLastElementAsString() +": " +str);
  +      //     System.out.println(this.getClass().getLastElementAsString() +": " +str);
         System.out.println(str);
      }
   
  
  
  
  1.9       +6 -7      JBossCache/tests/perf/org/jboss/cache/ReplicatedSyncMapPerfTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedSyncMapPerfTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/ReplicatedSyncMapPerfTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- ReplicatedSyncMapPerfTest.java	10 Jan 2007 16:44:15 -0000	1.8
  +++ ReplicatedSyncMapPerfTest.java	11 Jan 2007 13:49:06 -0000	1.9
  @@ -15,7 +15,6 @@
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheFactory;
  -import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.LockStrategyFactory;
   import org.jboss.cache.transaction.DummyTransactionManager;
  @@ -34,7 +33,7 @@
    * Local mode performance test for CacheImpl.
    *
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public class ReplicatedSyncMapPerfTest extends TestCase
   {
  @@ -143,11 +142,11 @@
      void initCaches(Configuration.CacheMode caching_mode) throws Exception
      {
         cachingMode_ = caching_mode;
  -      cache_ = new CacheImpl();
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache_.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC));
         cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache_.start();
  -//		org.jgroups.log.Trace.init();
  +      //		org.jgroups.log.Trace.init();
      }
   
      void destroyCaches() throws Exception
  @@ -258,14 +257,14 @@
               tx.begin();
               Map map = (Map) cache_.get((String) nodeList_.get(i), key);
               String str = (String) map.get(key);
  -//                log("_get(): key: " + key + " value: " +str);
  +            //                log("_get(): key: " + key + " value: " +str);
               tx.commit();
            }
            else
            {
               Map map = (Map) cache_.get((String) nodeList_.get(i), key);
               String str = (String) map.get(key);
  -//                log("_get(): key: " + key + " value: " +str);
  +            //                log("_get(): key: " + key + " value: " +str);
            }
         }
   
  @@ -351,7 +350,7 @@
   
      private void log(String str)
      {
  -//     System.out.println(this.getClass().getLastElementAsString() +": " +str);
  +      //     System.out.println(this.getClass().getLastElementAsString() +": " +str);
         System.out.println(str);
      }
   
  
  
  
  1.8       +7 -9      JBossCache/tests/perf/org/jboss/cache/ConcurrentEvictAndRemoveTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentEvictAndRemoveTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/ConcurrentEvictAndRemoveTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- ConcurrentEvictAndRemoveTest.java	30 Dec 2006 17:50:00 -0000	1.7
  +++ ConcurrentEvictAndRemoveTest.java	11 Jan 2007 13:49:06 -0000	1.8
  @@ -23,7 +23,7 @@
    * Local mode test for concurrent EvictionTimerTask evicting nodes and Client removing nodes from CacheImpl.
    *
    * @author <a href="mailto:uwe.lamprecht at gmx.de">Uwe Lamprecht</a> July 29 2004
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public final class ConcurrentEvictAndRemoveTest extends TestCase
   {
  @@ -51,11 +51,9 @@
      public void setUp() throws Exception
      {
         super.setUp();
  -      cache = new CacheImpl();
  -      cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
  -      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-mru-eviction-service.xml"));
  -      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  -      cache.start();
  +      Configuration c = new XmlConfigurationParser().parseFile("META-INF/local-mru-eviction-service.xml");
  +      c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(c);
      }
   
      public void tearDown() throws Exception
  @@ -66,7 +64,7 @@
   
      public void test() throws Exception
      {
  -      final long MAX_LOOP_TIME = 4000; // value to experiment;)
  +      final long MAX_LOOP_TIME = 4000;// value to experiment;)
         int numberOfInitialCreatedNodes = 0;
   
         log("*** Start Test: ConcurrentEvictAndRemoveTest ***");
  @@ -134,7 +132,7 @@
         // create/remove nodes (-->queue overflow and blocking)
         {
            log("create put/remove events");
  -         final int SEQUENCE_SIZE = 10000; // number of nodes processed by a single thread
  +         final int SEQUENCE_SIZE = 10000;// number of nodes processed by a single thread
            final long TIMEOUT_DEFAULT = 100000;
            final int MAX_TIMEOUT_FACTOR = 10;
   
  @@ -188,7 +186,7 @@
            startTime = System.currentTimeMillis();
         }
   
  -      private final long startTime;   // Start time of stopwatch.
  +      private final long startTime;// Start time of stopwatch.
         //   (Time is measured in milliseconds.)
   
         public String toString()
  
  
  
  1.8       +3 -5      JBossCache/tests/perf/org/jboss/cache/LocalPerfTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalPerfTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/LocalPerfTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- LocalPerfTest.java	31 Dec 2006 02:08:40 -0000	1.7
  +++ LocalPerfTest.java	11 Jan 2007 13:49:06 -0000	1.8
  @@ -13,7 +13,6 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.config.Configuration;
  -import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.LockStrategyFactory;
   import org.jboss.cache.transaction.DummyTransactionManager;
  @@ -30,7 +29,7 @@
    * Local mode performance test for CacheImpl.
    *
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class LocalPerfTest extends TestCase
   {
  @@ -89,8 +88,7 @@
      void initCaches(Configuration.CacheMode caching_mode) throws Exception
      {
         cachingMode_ = caching_mode;
  -      cache_ = new CacheImpl();
  -      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-service.xml"));
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache("META-INF/local-service.xml", false);
         cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache_.start();
      }
  @@ -327,7 +325,7 @@
   
      private void log(String str)
      {
  -//     System.out.println(this.getClass().getLastElementAsString() +": " +str);
  +      //     System.out.println(this.getClass().getLastElementAsString() +": " +str);
         System.out.println(str);
      }
   
  
  
  
  1.10      +4 -5      JBossCache/tests/perf/org/jboss/cache/ReplicatedAsyncMapPerfTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedAsyncMapPerfTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/ReplicatedAsyncMapPerfTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- ReplicatedAsyncMapPerfTest.java	10 Jan 2007 16:58:42 -0000	1.9
  +++ ReplicatedAsyncMapPerfTest.java	11 Jan 2007 13:49:06 -0000	1.10
  @@ -15,7 +15,6 @@
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheFactory;
  -import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.transaction.DummyTransactionManager;
   
   import javax.naming.Context;
  @@ -32,7 +31,7 @@
    * Local mode performance test for CacheImpl.
    *
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class ReplicatedAsyncMapPerfTest extends TestCase
   {
  @@ -139,8 +138,8 @@
      void initCaches(Configuration.CacheMode caching_mode) throws Exception
      {
         cachingMode_ = caching_mode;
  -      cache_ = new CacheImpl();
  -      cache_.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_ASYNC)); // read in generic replAsync xml
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
  +      cache_.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_ASYNC));// read in generic replAsync xml
         cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache_.start();
      }
  @@ -329,7 +328,7 @@
   
      private void log(String str)
      {
  -//     System.out.println(this.getClass().getLastElementAsString() +": " +str);
  +      //     System.out.println(this.getClass().getLastElementAsString() +": " +str);
         System.out.println(str);
      }
   
  
  
  
  1.8       +5 -7      JBossCache/tests/perf/org/jboss/cache/LocalMapPerfTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalMapPerfTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/LocalMapPerfTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- LocalMapPerfTest.java	31 Dec 2006 02:08:40 -0000	1.7
  +++ LocalMapPerfTest.java	11 Jan 2007 13:49:06 -0000	1.8
  @@ -13,7 +13,6 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.config.Configuration;
  -import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.LockStrategyFactory;
   import org.jboss.cache.transaction.DummyTransactionManager;
  @@ -32,7 +31,7 @@
    * Local mode performance test for CacheImpl.
    *
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class LocalMapPerfTest extends TestCase
   {
  @@ -122,8 +121,7 @@
      void initCaches(Configuration.CacheMode caching_mode) throws Exception
      {
         cachingMode_ = caching_mode;
  -      cache_ = new CacheImpl();
  -      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-service.xml"));
  +      cache_ = (CacheImpl) DefaultCacheFactory.getInstance().createCache("META-INF/local-service.xml", false);
         cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache_.start();
      }
  @@ -229,14 +227,14 @@
               tx.begin();
               Map map = (Map) cache_.get((String) nodeList_.get(i), key);
               String str = (String) map.get(key);
  -//                log("_get(): key: " + key + " value: " +str);
  +            //                log("_get(): key: " + key + " value: " +str);
               tx.commit();
            }
            else
            {
               Map map = (Map) cache_.get((String) nodeList_.get(i), key);
               String str = (String) map.get(key);
  -//                log("_get(): key: " + key + " value: " +str);
  +            //                log("_get(): key: " + key + " value: " +str);
            }
         }
   
  @@ -318,7 +316,7 @@
   
      private void log(String str)
      {
  -//     System.out.println(this.getClass().getLastElementAsString() +": " +str);
  +      //     System.out.println(this.getClass().getLastElementAsString() +": " +str);
         System.out.println(str);
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list