[infinispan-commits] Infinispan SVN: r1025 - trunk/core/src/test/java/org/infinispan/profiling.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Oct 26 16:20:42 EDT 2009


Author: manik.surtani at jboss.com
Date: 2009-10-26 16:20:42 -0400 (Mon, 26 Oct 2009)
New Revision: 1025

Modified:
   trunk/core/src/test/java/org/infinispan/profiling/AbstractProfileTest.java
   trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java
Log:
Tx handling capabilities

Modified: trunk/core/src/test/java/org/infinispan/profiling/AbstractProfileTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/profiling/AbstractProfileTest.java	2009-10-26 19:53:07 UTC (rev 1024)
+++ trunk/core/src/test/java/org/infinispan/profiling/AbstractProfileTest.java	2009-10-26 20:20:42 UTC (rev 1025)
@@ -8,6 +8,7 @@
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.util.concurrent.WithinThreadExecutor;
+import org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup;
 import org.testng.annotations.Test;
 
 import java.util.Properties;
@@ -35,6 +36,7 @@
    private Configuration getBaseCfg() {
       Configuration cfg = new Configuration();
       cfg.setConcurrencyLevel(5000);
+      cfg.setTransactionManagerLookupClass(JBossStandaloneJTAManagerLookup.class.getName());
       return cfg;
    }
 

Modified: trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java	2009-10-26 19:53:07 UTC (rev 1024)
+++ trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java	2009-10-26 20:20:42 UTC (rev 1025)
@@ -35,13 +35,14 @@
    protected static final boolean SKIP_WARMUP = true;
 
    private List<Object> keys = new ArrayList<Object>(MAX_OVERALL_KEYS);
+   protected static boolean USE_TRANSACTIONS = false;
 
    public static void main(String[] args) throws Exception {
       ProfileTest pst = new ProfileTest();
       pst.startedInCmdLine = true;
 
       String mode = args[0];
-      if (args.length > 1) NUM_OPERATIONS = Integer.parseInt(args[1]);
+      if (args.length > 1) USE_TRANSACTIONS = Boolean.parseBoolean(args[1]);
       
       try {
          if (args.length > 1) pst.clusterNameOverride = args[1];
@@ -228,17 +229,23 @@
                case PUT:
                   Object value = Generator.getRandomString();
                   st = System.nanoTime();
+                  if (USE_TRANSACTIONS) TestingUtil.getTransactionManager(cache).begin();
                   cache.put(key, value);
+                  if (USE_TRANSACTIONS) TestingUtil.getTransactionManager(cache).commit();
                   d = System.nanoTime() - st;
                   break;
                case GET:
                   st = System.nanoTime();
+                  if (USE_TRANSACTIONS) TestingUtil.getTransactionManager(cache).begin();
                   cache.get(key);
+                  if (USE_TRANSACTIONS) TestingUtil.getTransactionManager(cache).commit();
                   d = System.nanoTime() - st;
                   break;
                case REMOVE:
                   st = System.nanoTime();
+                  if (USE_TRANSACTIONS) TestingUtil.getTransactionManager(cache).begin();
                   cache.remove(key);
+                  if (USE_TRANSACTIONS) TestingUtil.getTransactionManager(cache).commit();
                   d = System.nanoTime() - st;
                   break;
             }



More information about the infinispan-commits mailing list