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

Manik Surtani msurtani at jboss.com
Thu Jul 20 04:53:08 EDT 2006


  User: msurtani
  Date: 06/07/20 04:53:08

  Modified:    tests/perf/org/jboss/cache    LocalPerfTest.java
                        ReplicatedSyncPerfTest.java Server.java
  Log:
  Fixed some broken UTs to use the new xml parsers, cache factories, etc.
  
  Revision  Changes    Path
  1.3       +6 -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.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- LocalPerfTest.java	31 May 2006 14:08:39 -0000	1.2
  +++ LocalPerfTest.java	20 Jul 2006 08:53:08 -0000	1.3
  @@ -15,6 +15,7 @@
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.LockStrategyFactory;
   import org.jboss.cache.transaction.DummyTransactionManager;
  +import org.jboss.cache.config.Configuration;
   
   import javax.naming.Context;
   import javax.naming.InitialContext;
  @@ -27,13 +28,13 @@
   /**
    * Local mode performance test for TreeCache.
    *
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
    */
   public class LocalPerfTest extends TestCase
   {
      TreeCache cache_;
  -   int cachingMode_ = TreeCache.LOCAL;
  +   Configuration.CacheMode cachingMode_ = Configuration.CacheMode.LOCAL;
      final static Properties p_;
   //   final static Log log_=LogFactory.getLog(LocalPerfAopTest.class);
      String oldFactory_ = null;
  @@ -62,7 +63,7 @@
         System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
   
         DummyTransactionManager.getInstance();
  -      initCaches(TreeCache.LOCAL);
  +      initCaches(Configuration.CacheMode.LOCAL);
         nodeList_ = nodeGen(depth_, children_);
         tm_ = new DummyTransactionManager();
   
  @@ -83,13 +84,13 @@
   
      }
   
  -   void initCaches(int caching_mode) throws Exception
  +   void initCaches(Configuration.CacheMode caching_mode) throws Exception
      {
         cachingMode_ = caching_mode;
         cache_ = new TreeCache();
         PropertyConfigurator config = new PropertyConfigurator();
         config.configure(cache_, "META-INF/local-service.xml"); // read in generic local xml
  -      cache_.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache_.startService();
      }
   
  
  
  
  1.3       +13 -12    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.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ReplicatedSyncPerfTest.java	31 May 2006 14:08:39 -0000	1.2
  +++ ReplicatedSyncPerfTest.java	20 Jul 2006 08:53:08 -0000	1.3
  @@ -14,6 +14,8 @@
   import junit.framework.TestSuite;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.transaction.DummyTransactionManager;
  +import org.jboss.cache.factories.XmlConfigurationParser;
  +import org.jboss.cache.config.Configuration;
   import org.jgroups.util.Util;
   
   import javax.transaction.Transaction;
  @@ -25,7 +27,7 @@
    * Replicated synchronous mode performance test for transactional TreeCache.
    *
    * @author Bela Ban
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    * @author <a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
    */
   public class ReplicatedSyncPerfTest extends TestCase {
  @@ -59,13 +61,12 @@
   
      TreeCache createCache(IsolationLevel level) throws Exception {
         TreeCache cache=new TreeCache();
  -      PropertyConfigurator config=new PropertyConfigurator();
  -      config.configure(cache, "META-INF/replSync-service.xml"); // use generic syncRepl xml
  -      cache.setIsolationLevel(level);
  -      cache.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  -      cache.setSyncCommitPhase(true);
  -      cache.setSyncRollbackPhase(true);
  -      cache.setLockAcquisitionTimeout(2000);
  +      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/replSync-service.xml"));
  +      cache.getConfiguration().setIsolationLevel(level);
  +      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      cache.getConfiguration().setSyncCommitPhase(true);
  +      cache.getConfiguration().setSyncRollbackPhase(true);
  +      cache.getConfiguration().setLockAcquisitionTimeout(2000);
         return cache;
      }
   
  @@ -89,7 +90,7 @@
      public void testPuts() throws Exception {
         log("=== 1 cache with transaction (no concurrent access) many puts ===");
         cache1_=createCache(IsolationLevel.REPEATABLE_READ);
  -      cache1_.setCacheMode(TreeCache.REPL_SYNC);
  +      cache1_.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
         cache1_.startService();
   
         int nOps=10000, realOps=0, failedOps=0;
  @@ -125,7 +126,7 @@
   
      public void testRandomPuts() throws Exception {
         cache1_=createCache(IsolationLevel.REPEATABLE_READ);
  -      cache1_.setCacheMode(TreeCache.REPL_SYNC);
  +      cache1_.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
         cache1_.startService();
   
         int nOps=5000, realOps=0, failedOps=0;
  @@ -175,8 +176,8 @@
         boolean hasTx=true;
         boolean oneTxOnly=false;
   
  -      System.out.println("sync comm phase: " + cache1_.getSyncCommitPhase() + ", sync rollback phase: " +
  -                         cache1_.getSyncRollbackPhase());
  +      System.out.println("sync comm phase: " + cache1_.getConfiguration().isSyncCommitPhase() + ", sync rollback phase: " +
  +                         cache1_.getConfiguration().isSyncRollbackPhase());
   
         // Step 1. Add entries to the cache
         System.out.println("-- before add: number of locks held is " + cache1_.getNumberOfLocksHeld());
  
  
  
  1.52      +6 -3      JBossCache/tests/perf/org/jboss/cache/Server.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Server.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/Server.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -b -r1.51 -r1.52
  --- Server.java	18 Jul 2006 10:50:47 -0000	1.51
  +++ Server.java	20 Jul 2006 08:53:08 -0000	1.52
  @@ -16,6 +16,8 @@
   import org.jboss.cache.data.RandomString;
   import org.jboss.cache.data.Student;
   import org.jboss.cache.transaction.DummyTransactionManager;
  +import org.jboss.cache.factories.XmlConfigurationParser;
  +import org.jboss.cache.config.Configuration;
   import org.jgroups.View;
   
   import javax.transaction.SystemException;
  @@ -57,14 +59,15 @@
   
      void initCache() throws Exception {
         cache_ = new PojoCache();
  -      PropertyConfigurator config = new PropertyConfigurator();
         String file = (String)props_.get("cache_config");
         if(file==null)
         {
            throw new RuntimeException("Cache config xml is not specified.");
         }
  -      config.configure(cache_, file); // read in generic replAsync xml
  -      cache_.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      XmlConfigurationParser parser = new XmlConfigurationParser();
  +      Configuration c = parser.parseFile(file);
  +      cache_.setConfiguration(c);
  +      c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
      }
   
      void destroyCache() throws Exception {
  
  
  



More information about the jboss-cvs-commits mailing list