[jbosscache-commits] JBoss Cache SVN: r5034 - in cache-bench-fwk/trunk: smartfrog and 6 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Jan 7 09:10:03 EST 2008


Author: mircea.markus
Date: 2008-01-07 09:10:02 -0500 (Mon, 07 Jan 2008)
New Revision: 5034

Added:
   cache-bench-fwk/trunk/smartfrog/main_dev.sf
   cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java
   cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/results/
   cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java
Removed:
   cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf
   cache-bench-fwk/trunk/smartfrog/conf.sf
   cache-bench-fwk/trunk/src/org/cachebench/TestResult.java
   cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java
Modified:
   cache-bench-fwk/trunk/conf/cachebench.xml
   cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
   cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
   cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java
   cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java
   cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java
   cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
Log:
added session simulator test + refactoring

Modified: cache-bench-fwk/trunk/conf/cachebench.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench.xml	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/conf/cachebench.xml	2008-01-07 14:10:02 UTC (rev 5034)
@@ -47,7 +47,7 @@
       org.cachebench.warmup.NoCacheWarmup
       -->
       <warmup warmupClass="org.cachebench.warmup.PutGetCacheWarmup">
-         <param name="operationCount" value="100"/>
+         <param name="operationCount" value="10000"/>
       </warmup>
 
       <!--
@@ -63,15 +63,22 @@
          * You can write your own custom testClass.
          * weight is currently unused.
       -->
-       <test name="Strings" testClass="org.cachebench.tests.StringTest" weight="2.0" />
+       <!--<test name="Strings" testClass="org.cachebench.tests.simpletests.StringTest" weight="2.0" />-->
+       
+       <test name="Strings" testClass="org.cachebench.tests.SessionSimulatorTest" weight="2.0" >
+          <param name="numberOfRequest" value="1000000"/>
+          <param name="numberOfAttributes" value="100"/>
+          <param name="writePercentage" value="20"/>
+          <param name="sizeOfAnAttribute" value="1000"/>
+       </test>
 
        <!--
-      <test name="Primitive Wrappers" testClass="org.cachebench.tests.PrimitiveTest" weight="1.0" />
-		<test name="Custom Class Types" testClass="org.cachebench.tests.CustomClassTest" weight="1.0" />
-		<test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.SubclassTest" weight="1.5" />
-		<test name="Custom Types With Transients" testClass="org.cachebench.tests.TransientTest" weight="1.0" />
-		<test name="Custom Types With Statics" testClass="org.cachebench.tests.StaticsTest" weight="1.5" />
-		<test name="Custom Types With Associations" testClass="org.cachebench.tests.AssociationsTest" weight="2.0" />
+      <test name="Primitive Wrappers" testClass="org.cachebench.tests.simpletests.PrimitiveTest" weight="1.0" />
+		<test name="Custom Class Types" testClass="org.cachebench.tests.simpletests.CustomClassTest" weight="1.0" />
+		<test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.simpletests.SubclassTest" weight="1.5" />
+		<test name="Custom Types With Transients" testClass="org.cachebench.tests.simpletests.TransientTest" weight="1.0" />
+		<test name="Custom Types With Statics" testClass="org.cachebench.tests.simpletests.StaticsTest" weight="1.5" />
+		<test name="Custom Types With Associations" testClass="org.cachebench.tests.simpletests.AssociationsTest" weight="2.0" />
 		-->
 
 		<!-- arbitrary params may be passed into the cacheWrapper implementation, typically used to pass in config files for the cache product. -->
@@ -93,7 +100,7 @@
 		own report generators such as XML generators, graphic generators, etc
    -->
    <!-- The CSV report generated can be plugged in to a spreadsheet to generate graphs. If 'outputFile is set to
-   '-generic-' then the name would be generated as follows: 'performance-<clusterSize>.csv' -->
+   '-generic-' then the name would be generated as follows: 'performance-<nodeIndeInCluster>.csv' -->
    <report outputFile="-generic-" generator="org.cachebench.reportgenerators.ClusterReportGenerator"/>
 
 </cachebench>

Deleted: cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf
===================================================================
--- cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,20 +0,0 @@
-#include "org/smartfrog/components.sf"
-
-BaseCacheBenchPrim extends Prim {
-   sfClass "org.cachebench.smartfrog.CacheBenchmarkPrim";
-
-   scriptToExec "./runNode.sh"
-
-   //FQN of the directory where the framework was checked out (noramally is th eparent of the dir that contains this file)
-   //this should be edited
-   cacheBenchmarkHome "c:/projects/jboss/cache/benchmark/cache-bench-fwk";
-
-   //should be the name of a subdirectory of 'cache-products' directory.
-   cacheDistribution "jbosscache-2.0.0";
-
-   //defines on how many nodes the benchmark will run
-   clusterSize 1;
-
-   //might take a value from 0..max_nr_of_nodes, representing the index of the current node in the cluster
-   nodeIndex TBD;
-}
\ No newline at end of file

Deleted: cache-bench-fwk/trunk/smartfrog/conf.sf
===================================================================
--- cache-bench-fwk/trunk/smartfrog/conf.sf	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/smartfrog/conf.sf	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,33 +0,0 @@
-//Most sf files start with this line.  Compound is a sf component that can have children components.
-sfConfig extends Compound
-{
-
-   //The CacheBenchController starts up the slaves, runs the master, then collects the results.
-   controller extends CacheBenchController
-   {
-      //List of cluster sizes to test.  In this case the first cluster would be a single master.  Second cluster would be one master and one slave.
-      clusterConfigs [1,2];
-
-      //Pool of hosts to deploy the slaves onto.
-      slaves [ "cluster02", "cluster03", "cluster04", "cluster05", "cluster06", "cluster07", "cluster08" ];
-
-      //Template used for slave components.  Each slave will be a copy of this component, with the sfHost attribute replaced by one of the hostnames above.
-      slaveTemplate extends LAZY CacheBenchSlave
-      {
-         plugin "jbosscache-1.4.1";
-         //bindAddress "10.1.5.2";
-         homeDir "/home/pthurmond/sandbox/cachebench/CacheBenchFwk";
-      }
-
-      //Master component.
-      master extends LAZY CacheBenchMaster
-      {                             
-        sfHost "localhost";
-        autoStart true;
-        //Which cache provider?  This is based on the directory structure in the CacheBenchFwk cvs.  Sort of fragile imo.  Maybe the classpath could be simplified some?
-        plugin "jbosscache-1.4.1";
-        homeDir "/home/pthurmond/sandbox/cachebench/CacheBenchFwk";
-        //bindAddress "10.1.5.1";
-      }
-   }
-}
\ No newline at end of file

Added: cache-bench-fwk/trunk/smartfrog/main_dev.sf
===================================================================
--- cache-bench-fwk/trunk/smartfrog/main_dev.sf	                        (rev 0)
+++ cache-bench-fwk/trunk/smartfrog/main_dev.sf	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,434 @@
+#include "org/smartfrog/components.sf"
+
+
+BaseCacheBenchPrim extends Prim {
+   sfClass "org.cachebench.smartfrog.CacheBenchmarkPrim";
+
+   scriptToExec "./runNode.sh"
+
+   //FQN of the directory where the framework was checked out (noramally is th eparent of the dir that contains this file)
+   //this should be edited
+   cacheBenchmarkHome "/projects/jboss/cache/benchmark/cache-bench-fwk";
+
+   //should be the name of a subdirectory of 'cache-products' directory.
+   cacheDistribution "jbosscache-2.0.0";
+
+   //might take a value from 0..max_nr_of_nodes, representing the index of the current node in the cluster
+   nodeIndex TBD;
+
+   //defines on how many nodes the benchmark will run
+   clusterSize TBD;
+   minClusterSize TBD;
+   maxClusterSize TBD;
+
+}
+
+sfConfig extends Compound {
+
+   minimumClusterSize 3;
+   maximumClusterSize 5;
+
+   oneClusterSize extends Compound {
+
+      c1FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize 1;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   twoClusterSize extends Compound {
+
+      sizeOfTheCluster 2;
+
+      c2FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c2SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   threeClusterSize extends Compound {
+
+      sizeOfTheCluster 3;
+
+      c3FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c3SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c3ThirdMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 2;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   fourClusterSize extends Compound {
+
+      sizeOfTheCluster 4;
+
+      c4FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c4SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c4ThirdMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 2;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c4ForthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 3;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   fiveClusterSize extends Compound {
+
+      sizeOfTheCluster 5;
+
+      c5FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c5SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c5ThirdMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 2;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c5ForthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 3;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c5FifthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 4;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   sixClusterSize extends Compound {
+
+      sizeOfTheCluster 6;
+
+      c6FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c6SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c6ThirdMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 2;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c6ForthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 3;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c6FifthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 4;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c6SixthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 5;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   sevenClusterSize extends Compound {
+
+      sizeOfTheCluster 7;
+
+      c7FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c7SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c7ThirdMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 2;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c7ForthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 3;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c7FifthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 4;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c7SixthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 5;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c7SeventhMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 6;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   eightClusterSize extends Compound {
+
+      sizeOfTheCluster 8;
+
+      c8FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c8SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c8ThirdMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 2;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c8ForthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 3;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c8FifthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 4;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c8SixthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 5;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c8SeventhMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 6;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c8EighthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 7;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+   nineClusterSize extends Compound {
+
+      sizeOfTheCluster 9;
+
+      c9FirstMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 0;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9SecondMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 1;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9ThirdMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 2;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9ForthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 3;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9FifthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 4;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9SixthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 5;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9SeventhMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 6;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9EighthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 7;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+
+      c9NinthMember extends BaseCacheBenchPrim {
+          sfProcessHost "localhost";
+          nodeIndex 7;
+          clusterSize ATTRIB sizeOfTheCluster;
+          minClusterSize ATTRIB minimumClusterSize;
+          maxClusterSize ATTRIB maximumClusterSize;
+      }
+   }
+
+}

Modified: cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -3,14 +3,15 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.cachebench.cluster.ClusterBarrier;
 import org.cachebench.config.*;
 import org.cachebench.reportgenerators.ReportGenerator;
 import org.cachebench.tests.CacheTest;
-import org.cachebench.cluster.ClusterBarrier;
+import org.cachebench.tests.results.BaseTestResult;
+import org.cachebench.tests.results.TestResult;
 import org.cachebench.utils.Instantiator;
 import org.cachebench.warmup.CacheWarmup;
 
-import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Date;
@@ -200,7 +201,7 @@
             catch (Exception e)
             {
                // The test failed. We should add a test result object with a error message and indicate that it failed.
-               result = new TestResult();
+               result = new BaseTestResult();
                result.setTestName(testCaseName);
                result.setTestTime(new Date());
                result.setTestType(testName);

Deleted: cache-bench-fwk/trunk/src/org/cachebench/TestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/TestResult.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/TestResult.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,188 +0,0 @@
-package org.cachebench;
-
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
-
-import java.io.Serializable;
-import java.util.Date;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- * @version $Id: TestResult.java,v 1.4 2007/04/18 19:09:30 msurtani Exp $
- */
-public class TestResult implements Serializable
-{
-   private String testName;
-   private String testType;
-   private Date testTime;
-   private DescriptiveStatistics putData, getData;
-   private boolean testPassed; // This is to indicate whether the test is passed/failed.
-   private String errorMsg = ""; // This holds the error message if any error had occured in the test.
-   private String footNote = ""; // This is utilized if special notes need to be captured for this test.
-   private int throughputTransactionsPerSecond;
-   private int throughputBytesPerSecond;
-   private int numMembers;
-   private int numThreads;
-   private boolean skipReport;
-
-   public DescriptiveStatistics getGetData()
-   {
-      return getData;
-   }
-
-   public void setGetData(DescriptiveStatistics getData)
-   {
-      this.getData = getData;
-   }
-
-   public DescriptiveStatistics getPutData()
-   {
-      return putData;
-   }
-
-   public void setPutData(DescriptiveStatistics putData)
-   {
-      this.putData = putData;
-   }
-
-   public String getTestName()
-   {
-      return testName;
-   }
-
-   public void setTestName(String testName)
-   {
-      this.testName = testName;
-   }
-
-   public String getTestType()
-   {
-      return testType;
-   }
-
-   public void setTestType(String testType)
-   {
-      this.testType = testType;
-   }
-
-   public Date getTestTime()
-   {
-      return testTime;
-   }
-
-   public void setTestTime(Date testTime)
-   {
-      this.testTime = testTime;
-   }
-
-   public boolean isTestPassed()
-   {
-      return testPassed;
-   }
-
-   public void setTestPassed(boolean testPassed)
-   {
-      this.testPassed = testPassed;
-   }
-
-   public String getErrorMsg()
-   {
-      return errorMsg;
-   }
-
-   public void setErrorMsg(String errorMsg)
-   {
-      this.errorMsg = errorMsg;
-   }
-
-   public String getFootNote()
-   {
-      return footNote;
-   }
-
-   public void setFootNote(String footNote)
-   {
-      this.footNote = footNote;
-   }
-
-   /**
-    * This is only measured on put() operations as it has little meaning for get()s.
-    */
-   public int getThroughputTransactionsPerSecond()
-   {
-      return throughputTransactionsPerSecond;
-   }
-
-   public void setThroughputTransactionsPerSecond(int throughputTransactionsPerSecond)
-   {
-      this.throughputTransactionsPerSecond = throughputTransactionsPerSecond;
-   }
-
-   /**
-    * This is only measured on put() operations as it has little meaning for get()s.  Note that the serialized size of objects
-    * are used to calculate this, not the ACTUAL bytes transmitted, as some cache impls (JBoss Cache >= 1.4) has internal
-    * marshallers that reduce object sizes to smaller than what they would be if serialized.  For the sake of comparing though,
-    * one must still consider that an object of, say, 200 bytes when serialized was transmitted, even if the cache compresses
-    * this to 100 bytes.
-    */
-   public int getThroughputBytesPerSecond()
-   {
-      return throughputBytesPerSecond;
-   }
-
-   public void setThroughputBytesPerSecond(int throughputBytesPerSecond)
-   {
-      this.throughputBytesPerSecond = throughputBytesPerSecond;
-   }
-
-   public int getNumMembers()
-   {
-      return numMembers;
-   }
-
-   public void setNumMembers(int numMembers)
-   {
-      this.numMembers = numMembers;
-   }
-
-   public int getNumThreads()
-   {
-      return numThreads;
-   }
-
-   public void setNumThreads(int numThreads)
-   {
-      this.numThreads = numThreads;
-   }
-
-   public String toString()
-   {
-      return "TestResult{" +
-            "testName='" + testName + '\'' +
-            ", testType='" + testType + '\'' +
-            ", testTime=" + testTime +
-            ", putData=" + putData +
-            ", getData=" + getData +
-            ", testPassed=" + testPassed +
-            ", errorMsg='" + errorMsg + '\'' +
-            ", footNote='" + footNote + '\'' +
-            ", throughputTransactionsPerSecond=" + throughputTransactionsPerSecond +
-            ", throughputBytesPerSecond=" + throughputBytesPerSecond +
-            ", numMembers=" + numMembers +
-            ", numThreads=" + numThreads +
-            '}';
-   }
-
-   /**
-    * If set to true, no reports will be generated from this test result.
-    */
-   public boolean isSkipReport()
-   {
-      return skipReport;
-   }
-
-   public void setSkipReport(boolean skipReport)
-   {
-      this.skipReport = skipReport;
-   }
-}

Modified: cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -31,4 +31,9 @@
    {
       return configParams.get(name);
    }
+
+   public int getIntValue(String name)
+   {
+      return Integer.parseInt(configParams.get(name));
+   }
 }

Modified: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,10 +1,11 @@
 package org.cachebench.reportgenerators;
 
 import org.apache.commons.logging.Log;
-import org.cachebench.TestResult;
 import org.cachebench.config.ClusterConfig;
+import org.cachebench.tests.results.TestResult;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -34,7 +35,8 @@
 
    public void setResults(List<TestResult> results)
    {
-      this.results = results;
+
+      this.results = new ArrayList(results);
    }
 
    public void setClusterConfig(ClusterConfig clusterConfig)

Deleted: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,197 +0,0 @@
-package org.cachebench.reportgenerators;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
-import org.cachebench.TestResult;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- * @version $Id: CSVReportGenerator.java,v 1.5 2007/04/18 19:09:31 msurtani Exp $
- */
-public class CSVReportGenerator extends AbstractReportGenerator
-{
-   private ArrayList footNotes;
-
-
-   public CSVReportGenerator()
-   {
-      log = LogFactory.getLog(this.getClass());
-   }
-
-   public void generate() throws Exception
-   {
-      try
-      {
-         BufferedWriter writer = null;
-         log.debug("Opening output file [" + output + "]");
-         String fileName = output.getAbsolutePath() + ".old." + System.currentTimeMillis();
-         prepareReportFile(fileName);
-         writer = new BufferedWriter(new FileWriter(output));
-         writeHeaderLine(writer); // Write the Header of the Report
-         // Write the results
-         for (TestResult result : results)
-         {
-            writeTestResult(result, writer);
-         }
-         // Write the Footnotes (if available)
-         if (footNotes != null)
-         {
-            writeFoodNotes(writer);
-         }
-
-         writer.close();
-         log.debug("Report complete");
-         if  (output.exists())
-         {
-            log.warn("Expected report file:'" + output.getAbsoluteFile() + "'does not exist!");
-         }
-      } catch (IOException e)
-      {
-         log.error("Error appeared while generatin report:", e);
-      }
-   }
-
-   private void prepareReportFile(String fileName)
-         throws IOException
-   {
-      if (output.exists())
-      {
-         log.info("A file named: '" + output.getAbsolutePath() + "' already exist. Renaming to '" + fileName + "'");
-         if (output.renameTo(new File(fileName))) {
-            log.warn("Could not rename!!!");
-         }
-      } else
-      {
-         if (output.createNewFile()) {
-            log.info("Successfully created report file:" + output.getAbsolutePath());
-         } else {
-            log.warn("Failed to create the report file!");
-         }
-      }
-   }
-
-   /**
-    * Writes out the report.
-    * The method checkes whether the result is passed or failed. And based on the status would generate the report with
-    * appropriate content. The method also checks whether the report has any foot notes attached to the test case. If
-    * any foot note is found, then its added to the <code>footNotes</code> ArrayList for later processing.
-    */
-   private void writeTestResult(TestResult result, BufferedWriter writer) throws IOException
-   {
-      log.debug("Writing the Result to the Report");
-      StringBuffer buf = new StringBuffer();
-      if (result.isTestPassed())
-      {
-         // This test has pased. Lets add this test results to the report.
-         DescriptiveStatistics putData = result.getPutData();
-         DescriptiveStatistics getData = result.getGetData();
-
-         buf.append(result.getTestName());
-         buf.append(",");
-         buf.append(result.getTestTime());
-         buf.append(",");
-         buf.append(result.getTestType());
-         buf.append(",");
-         buf.append(result.getNumMembers());
-         buf.append(",");
-         buf.append(result.getNumThreads());
-         buf.append(",");
-         buf.append(putData.getSum()/1000);
-         buf.append(",");
-         buf.append(getData.getSum()/1000);
-         buf.append(",");
-         buf.append(putData.getMean());
-         buf.append(",");
-         buf.append(getData.getMean());
-         buf.append(",");
-         // medians are the 50th percentile...
-         buf.append(putData.getPercentile(50));
-         buf.append(",");
-         buf.append(getData.getPercentile(50));
-         buf.append(",");
-         buf.append(putData.getStandardDeviation());
-         buf.append(",");
-         buf.append(getData.getStandardDeviation());
-         buf.append(",");
-         buf.append(putData.getMax());
-         buf.append(",");
-         buf.append(getData.getMax());
-         buf.append(",");
-         buf.append(putData.getMin());
-         buf.append(",");
-         buf.append(getData.getMin());
-         buf.append(",");
-         buf.append(result.getThroughputTransactionsPerSecond());
-         buf.append(",");
-         buf.append(result.getThroughputBytesPerSecond());
-      }
-      else
-      {
-         // This test has failed. Need to add this to the report.
-         buf.append(result.getTestName());
-         buf.append(",");
-         buf.append(result.getTestTime());
-         buf.append(",");
-         buf.append(result.getTestType());
-         buf.append(",");
-         buf.append(result.getErrorMsg());
-      }
-
-      // write details of this test to file.
-      writer.write(buf.toString());
-      writer.newLine();
-
-      // Now check if we have foot notes for this error
-      if (!"".equals(result.getFootNote()))
-      {
-         // We hae footnotes
-         if (footNotes == null)
-         {
-            footNotes = new ArrayList();
-         }
-         footNotes.add(result.getFootNote());
-      }
-      log.debug("Completed writing test result");
-   }
-
-   private void writeHeaderLine(BufferedWriter writer) throws IOException
-   {
-      log.debug("Write the Report Header");
-      writer.write("TEST NAME, TEST DATE, TEST TYPE, NUM MEMBERS, NUM THREADS, TOTAL PUT TIME (secs), TOTAL GET TIME (secs), MEAN PUT TIME, MEAN GET TIME, MEDIAN PUT TIME, MEDIAN GET TIME, STANDARD DEVIATION PUT TIME, STANDARD DEVIATION GET TIME, MAX PUT TIME, MAX GET TIME, MIN PUT TIME, MIN GET TIME, THROUGHPUT TRANSACTIONS PER SEC, THROUGHPUT BYTES PER SEC");
-      writer.newLine();
-      log.debug("Complted the Report Header");
-   }
-
-   private void writeFoodNotes(BufferedWriter writer) throws IOException
-   {
-      log.debug("Writing the Footnotes");
-      writer.newLine();
-      writer.newLine();
-      writer.newLine();
-      writer.newLine();
-      writer.write("Report FootNotes");
-      writer.newLine();
-      int footNoteSize = footNotes.size();
-      for (int i = 0; i < footNoteSize; i++)
-      {
-         writer.write((String) footNotes.get(i));
-         writer.newLine();
-      }
-      log.debug("Complted the Footnotes");
-   }
-
-   public void setConfigParams(Map configParams)
-   {
-      //we are not intereseted in any params, yet (e.g. may be we want to change separator from comma to tab)
-   }
-}

Modified: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -2,8 +2,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.cachebench.TestResult;
 import org.cachebench.cluster.ClusterBarrier;
+import org.cachebench.tests.results.TestResult;
 
 import java.net.SocketAddress;
 import java.util.ArrayList;
@@ -20,10 +20,12 @@
 public class ClusterReportGenerator extends AbstractReportGenerator
 {
    private static Log log = LogFactory.getLog(ClusterReportGenerator.class);
+   private String reportGeneratorClassName;
 
    public void setConfigParams(Map<String, String> configParams)
    {
       log.trace("Received config params: " + configParams);
+      reportGeneratorClassName = configParams.get("generatorClassName");
    }
 
    public void generate() throws Exception
@@ -41,10 +43,11 @@
             log.trace("Received following results: " + results);
             generateReport(barrier.getReceivedMessages());
          }
-         barrierUntilReportIsGenerated();
       } catch (Exception e)
       {
          log.error("Error while generating report!", e);
+      } finally {
+         barrierUntilReportIsGenerated();
       }
    }
 
@@ -73,12 +76,32 @@
 
    private void generateReportFile(List<TestResult> mergedResults) throws Exception
    {
-      CSVReportGenerator generator = new CSVReportGenerator();
+      if (mergedResults.isEmpty())
+      {
+         log.warn("Result list is emty, not generating any report");
+         return;
+      }
+      String genClassName = mergedResults.get(0).getReportGeneratorClassName();
+      AbstractReportGenerator generator = instantiateReportGenerator(genClassName);
       generator.setResults(mergedResults);
+      log.debug("Generating reports to file: " + output);
       generator.output = output;
       generator.generate();
    }
 
+   private AbstractReportGenerator instantiateReportGenerator(String genClassName)
+   {
+      try
+      {
+         log.debug("Using generator class: " + genClassName);
+         return (AbstractReportGenerator) Class.forName(genClassName).newInstance();
+      } catch (Exception e)
+      {
+         log.error("Could not instantiate report generators", e);
+         throw new IllegalStateException(e);
+      }
+   }
+
    private List<TestResult> mergerTestResultsAndGenerateReport(List<List<TestResult>> results)
    {
       List<TestResult> mergedResults = new ArrayList<TestResult>();

Added: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,120 @@
+package org.cachebench.reportgenerators;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.cachebench.tests.results.TestResult;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public abstract class CsvBaseReportGenerator extends AbstractReportGenerator
+{
+   protected static Log log = LogFactory.getLog(CsvBaseReportGenerator.class); 
+
+   protected Map<String,String> configParams;
+   private ArrayList footNotes;
+
+   public void setConfigParams(Map<String, String> configParams)
+   {
+      this.configParams = configParams;
+   }
+
+   public void generate() throws Exception
+   {
+      try
+      {
+         BufferedWriter writer = null;
+
+         log.debug("Opening output file [" + output + "]");
+         prepareReportFile();
+         writer = new BufferedWriter(new FileWriter(output));
+         writeHeaderLine(writer);
+
+         for (TestResult result : results)
+         {
+            writeTestResult(result, writer);
+            checkForFootnotes(result);
+         }
+         // Write the Footnotes (if available)
+         if (footNotes != null)
+         {
+            writeFoodNotes(writer);
+         }
+         writer.close();
+         log.debug("Report complete");
+         if  (output.exists())
+         {
+            log.warn("Expected report file:'" + output.getAbsoluteFile() + "'does not exist!");
+         }
+      } catch (IOException e)
+      {
+         log.error("Error appeared while generatin report:", e);
+      }
+   }
+
+   private void checkForFootnotes(TestResult result)
+   {
+      // Now check if we have foot notes for this error
+      if (!"".equals(result.getFootNote()))
+      {
+         // We hae footnotes
+         if (footNotes == null)
+         {
+            footNotes = new ArrayList();
+         }
+         footNotes.add(result.getFootNote());
+         log.debug("Foot node found, added " + result.getFootNote());
+      }
+   }
+
+   protected abstract void writeTestResult(TestResult result, BufferedWriter writer) throws IOException;
+
+   protected abstract void writeHeaderLine(BufferedWriter writer) throws IOException;
+
+   private void prepareReportFile() throws IOException
+   {
+      String fileName = output.getAbsolutePath() + ".old." + System.currentTimeMillis();
+      if (output.exists())
+      {
+         log.info("A file named: '" + output.getAbsolutePath() + "' already exist. Renaming to '" + fileName + "'");
+         if (output.renameTo(new File(fileName))) {
+            log.warn("Could not rename!!!");
+         }
+      } else
+      {
+         if (output.createNewFile()) {
+            log.info("Successfully created report file:" + output.getAbsolutePath());
+         } else {
+            log.warn("Failed to create the report file!");
+         }
+      }
+   }
+
+   private void writeFoodNotes(BufferedWriter writer) throws IOException
+   {
+      log.debug("Writing the Footnotes");
+      writer.newLine();
+      writer.newLine();
+      writer.newLine();
+      writer.newLine();
+      writer.write("Report FootNotes");
+      writer.newLine();
+      int footNoteSize = footNotes.size();
+      for (int i = 0; i < footNoteSize; i++)
+      {
+         writer.write((String) footNotes.get(i));
+         writer.newLine();
+      }
+      log.debug("Complted the Footnotes");
+   }
+
+
+}

Added: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,65 @@
+package org.cachebench.reportgenerators;
+
+import org.cachebench.tests.SessionSimulatorTestResult;
+import org.cachebench.tests.results.TestResult;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class CsvSessionSimlatorReportGenerator extends CsvBaseReportGenerator
+{
+   protected void writeTestResult(TestResult result, BufferedWriter writer) throws IOException
+   {
+      SessionSimulatorTestResult ssResult = (SessionSimulatorTestResult) result;
+      log.debug("Writing the Result to the Report");
+      StringBuffer buf = new StringBuffer();
+      if (ssResult.isTestPassed())
+      {
+         buf.append(ssResult.getTestName());
+         buf.append(",");
+         buf.append(ssResult.getTestTime());
+         buf.append(",");
+         buf.append(ssResult.getNoRequestPerSec());
+         buf.append(",");
+         buf.append(ssResult.getBytesRead());
+         buf.append(",");
+         buf.append(ssResult.getBytesWritten());
+         buf.append(",");
+         buf.append(ssResult.getDurration());
+         buf.append(",");
+         buf.append(ssResult.getTotalOperationCount());
+         buf.append(",");
+         buf.append(ssResult.getReadCount());
+         buf.append(",");
+         buf.append(ssResult.getWriteCount());
+      }
+      else
+      {
+         // This test has failed. Need to add this to the report.
+         buf.append(ssResult.getTestName());
+         buf.append(",");
+         buf.append(ssResult.getTestTime());
+         buf.append(",");
+         buf.append(ssResult.getTestType());
+         buf.append(",");
+         buf.append(ssResult.getErrorMsg());
+      }
+
+      // write details of this test to file.
+      writer.write(buf.toString());
+      writer.newLine();
+   }
+
+   protected void writeHeaderLine(BufferedWriter writer) throws IOException
+   {
+      log.debug("Write the Report Header");
+      writer.write("TEST NAME, TEST DATE, REQ PER SEC, BYTES READ, BYTES WRITTEN, DURRATION, TOTOAL OPERATION COUNT, READ COUNT, WRITE COUNT" );
+      writer.newLine();
+      log.debug("Complted the Report Header");
+
+   }
+}

Modified: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,9 +1,8 @@
 package org.cachebench.reportgenerators;
 
-import org.cachebench.TestResult;
 import org.cachebench.config.ClusterConfig;
+import org.cachebench.tests.results.TestResult;
 
-import java.io.File;
 import java.util.List;
 import java.util.Map;
 

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeWithAssocs;
-import org.cachebench.testobjects.SerializableCustomTypeWithAssocs;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public class AssociationsTest extends SimpleTest
-{
-
-   /* (non-Javadoc)
-   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
-   */
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
-   {
-      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithAssocs.class : CustomTypeWithAssocs.class, testCaseName, sampleSize, numThreads);
-
-   }
-
-}

Modified: cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,8 +1,8 @@
 package org.cachebench.tests;
 
 import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
 import org.cachebench.config.Configuration;
+import org.cachebench.tests.results.TestResult;
 
 
 /**

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomType;
-import org.cachebench.testobjects.SerializableCustomType;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public class CustomClassTest extends SimpleTest
-{
-
-   /* (non-Javadoc)
-   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
-   */
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
-   {
-      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomType.class : CustomType.class, testCaseName, sampleSize, numThreads);
-
-   }
-
-}

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,23 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public class PrimitiveTest extends SimpleTest
-{
-
-   /* (non-Javadoc)
-   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
-   */
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
-   {
-      return performTestWithObjectType(testName, cache, Integer.class, testCaseName, sampleSize, numThreads);
-
-   }
-
-}

Modified: cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -3,7 +3,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
+import org.cachebench.tests.results.StatisticTestResult;
 import org.cachebench.cluster.ClusterBarrier;
 import org.cachebench.config.Configuration;
 import org.cachebench.config.TestCase;
@@ -31,7 +31,7 @@
       this.conf = configuration;
    }
 
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
    {
       log.trace("TestCase = '" + testCaseName + "', TestName = " + testName);
       barrierBeforeReplicationTest();
@@ -43,7 +43,7 @@
       if (conf.getClusterConfig().getClusterSize() == 1)
       {
          log.info("Cluster size is one, no replication expected");
-         TestResult result = new TestResult();
+         StatisticTestResult result = new StatisticTestResult();
          result.setTestPassed(true);
          result.setSkipReport(true);
          return result;
@@ -76,9 +76,9 @@
       barrier.barrier("BEFORE_REPLICATION_OCCURS_BARRIER");
    }
 
-   private TestResult allReplicatedFine(Map<SocketAddress, Object> receivedValues)
+   private StatisticTestResult allReplicatedFine(Map<SocketAddress, Object> receivedValues)
    {
-      TestResult result = new TestResult();
+      StatisticTestResult result = new StatisticTestResult();
       result.setSkipReport(true);
       for (Object value : receivedValues.values())
       {

Added: cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,145 @@
+package org.cachebench.tests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.cachebench.CacheWrapper;
+import org.cachebench.config.Configuration;
+import org.cachebench.config.TestCase;
+import org.cachebench.config.TestConfig;
+import org.cachebench.tests.results.TestResult;
+
+import java.util.Random;
+import java.util.Date;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class SessionSimulatorTest implements CacheTest
+{
+   private static final Log log = LogFactory.getLog(SessionSimulatorTest.class);
+
+   public static final String SESSION_PREFIX = "SESSION_";
+   Configuration configuration;
+   private TestConfig thisTestConfig;
+   private String sessionId;
+   private CacheWrapper cacheWrapper;
+
+   /**
+    * total number of request to be made against this session: reads + writes
+    */
+   private int numberOfRequests;
+
+   /**
+    * for each session there will be created fixed number of attributes. On those attributes all the GETs and PUTs
+    * are performed (for PUT is overwrite)
+    */
+   private int numberOfAttributes;
+
+   /**
+    * Each attribute will be a byte[] of this size
+    */
+   private int sizeOfAnAttribute;
+
+   /**
+    * Out of the total number of request, this define the frequency of writes (percentage)
+    */
+   private int writePercentage;
+
+   public void setConfiguration(Configuration configuration)
+   {
+      this.configuration = configuration;
+   }
+
+   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      this.cacheWrapper = cache;
+      TestCase testCase = configuration.getTestCase(testCaseName);
+      thisTestConfig = testCase.getTest(testName);
+      readParams();
+      initSession();
+      return stressSession(testName, testCaseName);
+   }
+
+   private SessionSimulatorTestResult stressSession(String testName, String testCaseName) throws Exception
+   {
+
+      long totalBytesRead = 0;
+      long totalBytesWritten = 0;
+      long reads = 0;
+      long writes = 0;
+      int readPercentage = 100 - writePercentage;
+      Random r = new Random();
+      int randomAction;
+      int randomAttribute;
+      long start=System.currentTimeMillis();
+      for (int i = 0; i < numberOfRequests; i++)
+      {
+         randomAction = r.nextInt(100);
+         randomAttribute = r.nextInt(numberOfAttributes - 1);
+         byte[] buf;
+         if (randomAction < readPercentage)
+         { // read
+            try
+            {
+               buf = (byte[]) cacheWrapper.get(getSessionEntry(randomAttribute));
+               totalBytesRead += buf.length;
+               reads++;
+            } catch (Exception e)
+            {
+               log.trace("Error appeared whilst reading from cache:" + e.getMessage());
+            }
+         } else
+         {             // write
+            buf = new byte[this.sizeOfAnAttribute];
+            try
+            {
+               cacheWrapper.put(getSessionEntry(randomAttribute), buf);
+               totalBytesWritten += buf.length;
+               writes++;
+            } catch (Exception e)
+            {
+               log.trace("Error appeared whilst writing to cache:" + e.getMessage());
+            }
+         }
+      }
+      long durration = System.currentTimeMillis() - start;
+      SessionSimulatorTestResult result = new SessionSimulatorTestResult(reads, writes, durration, totalBytesRead, totalBytesWritten);
+      result.setTestPassed(true);
+      result.setTestName(testCaseName + getNodeIndex());
+      result.setTestTime(new Date());
+      result.setTestType(testName);
+      log.trace("Returning result:" + result);
+      return result;
+   }
+
+   private void initSession() throws Exception
+   {
+      for (int i = 0; i < numberOfAttributes; i++)
+      {
+         cacheWrapper.put(getSessionEntry(i), new byte[sizeOfAnAttribute]);
+      }
+   }
+
+   private String getSessionEntry(int i)
+   {
+      return sessionId + i;
+   }
+
+   private void readParams ()
+   {
+      sessionId = SESSION_PREFIX + configuration.getClusterConfig().getCurrentNodeIndex();
+      log.debug("Session id is: " + sessionId);
+      numberOfRequests = thisTestConfig.getIntValue("numberOfRequest");
+      numberOfAttributes = thisTestConfig.getIntValue("numberOfAttributes");
+      writePercentage = thisTestConfig.getIntValue("writePercentage");
+      sizeOfAnAttribute = thisTestConfig.getIntValue("sizeOfAnAttribute");
+      log.debug("recieved follosing params[ numberOfRequests=" + numberOfRequests + ", numberOfAttributes="
+            + numberOfAttributes + ", writePercentage=" + writePercentage + ", sizeOfAnAttribute=" + sizeOfAnAttribute + " ]");
+   }
+
+   public String getNodeIndex()
+   {
+      return configuration.getClusterConfig().getCurrentNodeIndex() + "";
+   }
+}

Added: cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,68 @@
+package org.cachebench.tests;
+
+import org.cachebench.tests.results.BaseTestResult;
+import org.cachebench.reportgenerators.CsvSessionSimlatorReportGenerator;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class SessionSimulatorTestResult extends BaseTestResult
+{
+
+   long readCount;
+   long writeCount;
+   long durration;
+   long bytesRead;
+   long bytesWritten;
+
+
+   public SessionSimulatorTestResult(long readCount, long writeCount, long durration, long bytesRead, long bytesWritten)
+   {
+      this.readCount = readCount;
+      this.writeCount = writeCount;
+      this.durration = durration;
+      this.bytesRead = bytesRead;
+      this.bytesWritten = bytesWritten;
+   }
+
+   public long getTotalOperationCount()
+   {
+      return readCount + writeCount;
+   }
+
+   public long getReadCount()
+   {
+      return readCount;
+   }
+
+   public long getWriteCount()
+   {
+      return writeCount;
+   }
+
+   public double getNoRequestPerSec()
+   {
+      return getTotalOperationCount() / (durration / 1000.0);
+   }
+
+   public long getBytesRead()
+   {
+      return bytesRead;
+   }
+
+   public long getBytesWritten()
+   {
+      return bytesWritten;
+   }
+
+   public long getDurration()
+   {
+      return durration;
+   }
+
+   public String getReportGeneratorClassName()
+   {
+      return CsvSessionSimlatorReportGenerator.class.getName();
+   }
+}

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,296 +0,0 @@
-package org.cachebench.tests;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.config.Configuration;
-
-import java.io.Serializable;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.util.Date;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicLong;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public abstract class SimpleTest implements CacheTest
-{
-   protected Log log = LogFactory.getLog(this.getClass());
-   protected AtomicLong numberOfBytesPut = new AtomicLong(0);
-   protected long elapsedSecondsForAllPuts = 0;
-   protected ExecutorService executor;
-   private static final int EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS = 60;
-   protected Configuration configuration;
-   protected final int LOG_FREQUENCY = 5000;
-
-   protected TestResult performTestWithObjectType(String testCaseName, CacheWrapper cache, Class valueClass, String testName, int sampleSize, int numThreads) throws Exception
-   {
-      log.info("Number of threads " + numThreads);
-      executor = Executors.newFixedThreadPool(numThreads);
-
-      TestResult result = new TestResult();
-      result.setTestName(testCaseName + getNodeIndex());
-      result.setTestTime(new Date());
-      result.setTestType(testName);
-
-      log.info("Performing '" + sampleSize + "' PUTs");
-      DescriptiveStatistics putStats = doPuts(cache, valueClass, sampleSize);
-      executor = Executors.newFixedThreadPool(numThreads);
-      log.info("Performing GETs");
-      DescriptiveStatistics getStats = doGets(cache, sampleSize);
-
-      result.setGetData(getStats);
-      result.setPutData(putStats);
-      result.setTestPassed(true); // The test is passed. The report would make use of this attribute.
-
-      // calculate throughput, in transactions per second.
-      // we only measure put operations for throughput.
-
-      // calc tps.
-
-      System.out.println("*** sum of time: " + elapsedSecondsForAllPuts);
-      System.out.println("*** num puts occured: " + putStats.getN());
-
-      try
-      {
-         result.setThroughputTransactionsPerSecond((int) (sampleSize / elapsedSecondsForAllPuts));
-      }
-      catch (ArithmeticException ae)
-      {
-         log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
-         result.setThroughputTransactionsPerSecond(-999);
-      }
-
-      try
-      {
-         result.setThroughputBytesPerSecond((int) (numberOfBytesPut.longValue() / elapsedSecondsForAllPuts));
-      }
-      catch (ArithmeticException ae)
-      {
-         log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
-         result.setThroughputBytesPerSecond(-999);
-      }
-
-
-      // set the number of members in the cluster
-      result.setNumMembers(cache.getNumMembers());
-      result.setNumThreads(numThreads);
-
-      return result;
-   }
-
-   /**
-    * @param cache      The Cachewrapper on which the bechmark is conducted.
-    * @param sampleSize The size of the cache.
-    * @return The Descriptive statistics of the cache benchmarking.
-    */
-   private DescriptiveStatistics doGets(final CacheWrapper cache, int sampleSize) throws Exception
-   {
-      log.debug("Inside doGets for : " + cache);
-      final String key = "baseKey";
-      final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
-      final boolean useSerializable = cache instanceof SerializableCacheWrapper;
-
-      for (int i = 0; i < sampleSize; i++)
-      {
-         final int cycleNumber = i;
-         Runnable r = new Runnable()
-         {
-            public void run()
-            {
-               try
-               {
-                  if (!useSerializable)
-                  {
-                     // start your timer...
-                     long startTime = System.currentTimeMillis();
-                     cache.get(key + cycleNumber);
-                     long statValue = (System.currentTimeMillis() - startTime);
-                     stats.addValue(statValue);
-                     log.debug("The Get stat : " + statValue);
-                  }
-                  else
-                  {
-                     SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
-                     long startTime = System.currentTimeMillis();
-                     sCache.getSerializable(key + cycleNumber);
-                     long statValue = (System.currentTimeMillis() - startTime);
-                     stats.addValue(statValue);
-                     log.debug("The Get stat : " + statValue);
-                  }
-                  logOperation(cycleNumber, "GETS");
-               }
-               catch (Exception e)
-               {
-                  // how should we handle this?  Log for now...
-                  log.error("Operation failed!", e);
-               }
-            }
-         };
-
-         // submit task to be executed
-         executor.execute(r);
-      }
-
-      // only leave once the task queue is empty!!
-      blockTillTasksComplete();
-
-      // return the raw data
-      log.debug("Leaving doGets for : " + cache);
-      return stats;
-   }
-
-   private void logOperation(int i, String s)
-   {
-      if ((i + 1) % LOG_FREQUENCY == 0)
-      {
-         log.info((i + 1) + " " + s + " were performed");
-      }
-   }
-
-   /**
-    * @param cache      The Cachewrapper on which the bechmark is conducted.
-    * @param valueClass The value class instance which is going to be inserted into the Cache.
-    * @param sampleSize The size of the cache.
-    * @return The Descriptive statistics of the cache benchmarking.
-    */
-   private DescriptiveStatistics doPuts(final CacheWrapper cache, final Class valueClass, int sampleSize) throws Exception
-   {
-      log.debug("Inside doPuts for " + cache);
-      final String key = "baseKey";
-      final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
-      final boolean useSerializable = cache instanceof SerializableCacheWrapper;
-      numberOfBytesPut.set(0);
-      elapsedSecondsForAllPuts = 0;
-      long startElapsedTime = System.currentTimeMillis();
-
-      for (int i = 0; i < sampleSize; i++)
-      {
-         final int cycleNumber = i;
-         Runnable r = new Runnable()
-         {
-            public void run()
-            {
-               try
-               {
-                  // generate some value
-                  Object value;
-                  if (valueClass == null) value = null;
-                  else if (valueClass.getName().equals("java.lang.String")) value = "value" + cycleNumber;
-                  else if (valueClass.getName().equals("java.lang.Integer")) value = cycleNumber;
-                  else value = valueClass.newInstance();
-
-                  // even though some impls may use special marshalling to reduce the amount of data transmitted (such as JBoss Cache's
-                  // CacheMarshaller) we still want to measure the serialized size of objects for this metric.
-
-                  numberOfBytesPut.getAndAdd(calculateSerializedSize(value));
-
-                  if (!useSerializable)
-                  {
-                     // start your timer...
-                     long startTime = System.currentTimeMillis();
-                     cache.put(key + cycleNumber, value);
-                     long statValue = (System.currentTimeMillis() - startTime);
-                     stats.addValue(statValue);
-                  }
-                  else
-                  {
-                     SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
-                     Serializable sValue = (Serializable) value;
-                     long startTime = System.currentTimeMillis();
-                     sCache.putSerializable(key + cycleNumber, sValue);
-                     long statValue = (System.currentTimeMillis() - startTime);
-                     stats.addValue(statValue);
-                  }
-                  logOperation(cycleNumber,"PUTS");
-               }
-               catch (Exception e)
-               {
-                  // how should we handle this?  Log for now...
-                  log.error("Operation failed!", e);
-               }
-            }
-         };
-         // submit task to be executed
-         executor.execute(r);
-      }
-
-      // only leave once the task queue is empty!!
-      blockTillTasksComplete();
-      elapsedSecondsForAllPuts = (System.currentTimeMillis() - startElapsedTime) / 1000;
-
-      // return the raw data
-      log.debug("Leaving doPuts for " + cache);
-      return stats;
-   }
-
-   private void blockTillTasksComplete()
-   {
-      // now that just told us that all the tasks have been submitted.  Lets check that the executor has finished everything.
-      executor.shutdown();
-      while (!executor.isTerminated())
-      {
-         try
-         {
-            executor.awaitTermination(EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS, TimeUnit.SECONDS);
-         }
-         catch (InterruptedException e)
-         {
-            // do nothing?
-         }
-      }
-   }
-
-   private long calculateSerializedSize(Object value)
-   {
-      ByteArrayOutputStream baos = null;
-      ObjectOutputStream oos = null;
-      try
-      {
-         baos = new ByteArrayOutputStream();
-         oos = new ObjectOutputStream(baos);
-         oos.writeObject(value);
-         oos.close();
-         baos.close();
-         return baos.size();
-      }
-      catch (Exception e)
-      {
-         log.warn("Unable to calculate serialized size of object " + value, e);
-         try
-         {
-            if (oos != null) oos.close();
-            if (baos != null) baos.close();
-         }
-         catch (Exception e2)
-         {
-            log.warn("Unable to close streams", e2);
-         }
-      }
-      return 0;
-   }
-
-   public String getNodeIndex()
-   {
-      try
-      {
-         return " - " + Integer.parseInt(System.getProperty("currentIndex"));
-      } catch (Exception e) {
-         return "";
-      }
-   }
-
-   public void setConfiguration(Configuration configuration)
-   {
-      this.configuration = configuration;
-   }
-}

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,25 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeWithStatics;
-import org.cachebench.testobjects.SerializableCustomTypeWithStatics;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public class StaticsTest extends SimpleTest
-{
-
-   /* (non-Javadoc)
-   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
-   */
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
-   {
-      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithStatics.class : CustomTypeWithStatics.class, testCaseName, sampleSize, numThreads);
-   }
-
-}

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,23 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public class StringTest extends SimpleTest
-{
-
-   /* (non-Javadoc)
-   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
-   */
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
-   {
-      return performTestWithObjectType(testName, cache, String.class, testCaseName, sampleSize, numThreads);
-
-   }
-
-}

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeSubclassOfAbstract;
-import org.cachebench.testobjects.SerializableCustomTypeSubclassOfAbstract;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public class SubclassTest extends SimpleTest
-{
-
-   /* (non-Javadoc)
-   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
-   */
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
-   {
-      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeSubclassOfAbstract.class : CustomTypeSubclassOfAbstract.class, testCaseName, sampleSize, numThreads);
-
-   }
-
-}

Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java	2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeWithTransient;
-import org.cachebench.testobjects.SerializableCustomTypeWithTransient;
-
-
-/**
- * @author Manik Surtani (manik at surtani.org)
- *         (C) Manik Surtani, 2004
- */
-public class TransientTest extends SimpleTest
-{
-
-   /* (non-Javadoc)
-   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
-   */
-   public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
-   {
-      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithTransient.class : CustomTypeWithTransient.class, testCaseName, sampleSize, numThreads);
-
-   }
-
-}

Added: cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,99 @@
+package org.cachebench.tests.results;
+
+import java.util.Date;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class BaseTestResult implements TestResult
+{
+
+   protected String testName;
+   protected String testType;
+   protected Date testTime;
+   protected boolean testPassed;
+   protected String errorMsg;
+   protected boolean skipReport;
+   protected String footNote = ""; // This is utilized if special notes need to be captured for this test.
+
+
+   public void setTestName(String testName)
+   {
+      this.testName = testName;
+   }
+
+   public void setTestType(String testType)
+   {
+      this.testType = testType;
+   }
+
+   public void setTestTime(Date testTime)
+   {
+      this.testTime = testTime;
+   }
+
+   public boolean isTestPassed()
+   {
+      return testPassed;
+   }
+
+   public void setTestPassed(boolean testPassed)
+   {
+      this.testPassed = testPassed;
+   }
+
+   public void setErrorMsg(String errorMsg)
+   {
+      this.errorMsg = errorMsg;
+   }
+   /**
+    * If set to true, no reports will be generated from this test result.
+    */
+   public boolean isSkipReport()
+   {
+      return skipReport;
+   }
+
+   public void setSkipReport(boolean skipReport)
+   {
+      this.skipReport = skipReport;
+   }
+
+
+   public String getTestName()
+   {
+      return testName;
+   }
+
+   public String getTestType()
+   {
+      return testType;
+   }
+
+   public Date getTestTime()
+   {
+      return testTime;
+   }
+
+   public String getErrorMsg()
+   {
+      return errorMsg;
+   }
+
+   public String getFootNote()
+   {
+      return footNote;
+   }
+
+   public void setFootNote(String footNote)
+   {
+      this.footNote = footNote;
+   }
+
+
+   public String getReportGeneratorClassName()
+   {
+      return null;
+   }
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/TestResult.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,112 @@
+package org.cachebench.tests.results;
+
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.cachebench.reportgenerators.CsvStatisticReportGenerator;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ * @version $Id: StatisticTestResult.java,v 1.4 2007/04/18 19:09:30 msurtani Exp $
+ */
+public class StatisticTestResult extends BaseTestResult
+{
+   private DescriptiveStatistics putData, getData;
+   private int throughputTransactionsPerSecond;
+   private int throughputBytesPerSecond;
+   private int numMembers;
+   private int numThreads;
+
+   public DescriptiveStatistics getGetData()
+   {
+      return getData;
+   }
+
+   public void setGetData(DescriptiveStatistics getData)
+   {
+      this.getData = getData;
+   }
+
+   public DescriptiveStatistics getPutData()
+   {
+      return putData;
+   }
+
+   public void setPutData(DescriptiveStatistics putData)
+   {
+      this.putData = putData;
+   }
+
+
+   /**
+    * This is only measured on put() operations as it has little meaning for get()s.
+    */
+   public int getThroughputTransactionsPerSecond()
+   {
+      return throughputTransactionsPerSecond;
+   }
+
+   public void setThroughputTransactionsPerSecond(int throughputTransactionsPerSecond)
+   {
+      this.throughputTransactionsPerSecond = throughputTransactionsPerSecond;
+   }
+
+   /**
+    * This is only measured on put() operations as it has little meaning for get()s.  Note that the serialized size of objects
+    * are used to calculate this, not the ACTUAL bytes transmitted, as some cache impls (JBoss Cache >= 1.4) has internal
+    * marshallers that reduce object sizes to smaller than what they would be if serialized.  For the sake of comparing though,
+    * one must still consider that an object of, say, 200 bytes when serialized was transmitted, even if the cache compresses
+    * this to 100 bytes.
+    */
+   public int getThroughputBytesPerSecond()
+   {
+      return throughputBytesPerSecond;
+   }
+
+   public void setThroughputBytesPerSecond(int throughputBytesPerSecond)
+   {
+      this.throughputBytesPerSecond = throughputBytesPerSecond;
+   }
+
+   public int getNumMembers()
+   {
+      return numMembers;
+   }
+
+   public void setNumMembers(int numMembers)
+   {
+      this.numMembers = numMembers;
+   }
+
+   public int getNumThreads()
+   {
+      return numThreads;
+   }
+
+   public void setNumThreads(int numThreads)
+   {
+      this.numThreads = numThreads;
+   }
+
+   public String toString()
+   {
+      return "StatisticTestResult{" +
+            "testName='" + testName + '\'' +
+            ", testType='" + testType + '\'' +
+            ", testTime=" + testTime +
+            ", putData=" + putData +
+            ", getData=" + getData +
+            ", testPassed=" + testPassed +
+            ", errorMsg='" + errorMsg + '\'' +
+            ", footNote='" + footNote + '\'' +
+            ", throughputTransactionsPerSecond=" + throughputTransactionsPerSecond +
+            ", throughputBytesPerSecond=" + throughputBytesPerSecond +
+            ", numMembers=" + numMembers +
+            ", numThreads=" + numThreads +
+            '}';
+   }
+
+   public String getReportGeneratorClassName()
+   {
+      return CsvStatisticReportGenerator.class.getName();
+   }
+}

Added: cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,36 @@
+package org.cachebench.tests.results;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public interface TestResult extends Serializable
+{
+
+   public String getReportGeneratorClassName();
+
+   void setTestName(String testCaseName);
+
+   void setTestTime(Date date);
+
+   void setTestType(String testName);
+
+   void setTestPassed(boolean b);
+
+   void setErrorMsg(String s);
+
+   boolean isTestPassed();
+
+   boolean isSkipReport();
+
+   String getTestName();
+
+   String getTestType();
+
+   void setFootNote(String s);
+
+   String getFootNote();
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeWithAssocs;
+import org.cachebench.testobjects.SerializableCustomTypeWithAssocs;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public class AssociationsTest extends SimpleTest
+{
+
+   /* (non-Javadoc)
+   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+   */
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithAssocs.class : CustomTypeWithAssocs.class, testCaseName, sampleSize, numThreads);
+
+   }
+
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomType;
+import org.cachebench.testobjects.SerializableCustomType;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public class CustomClassTest extends SimpleTest
+{
+
+   /* (non-Javadoc)
+   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+   */
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomType.class : CustomType.class, testCaseName, sampleSize, numThreads);
+
+   }
+
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,23 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public class PrimitiveTest extends SimpleTest
+{
+
+   /* (non-Javadoc)
+   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+   */
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      return performTestWithObjectType(testName, cache, Integer.class, testCaseName, sampleSize, numThreads);
+
+   }
+
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java (from rev 5007, cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,297 @@
+package org.cachebench.tests.simpletests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.tests.CacheTest;
+import org.cachebench.config.Configuration;
+
+import java.io.Serializable;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.Date;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.atomic.AtomicLong;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public abstract class SimpleTest implements CacheTest
+{
+   protected Log log = LogFactory.getLog(this.getClass());
+   protected AtomicLong numberOfBytesPut = new AtomicLong(0);
+   protected long elapsedSecondsForAllPuts = 0;
+   protected ExecutorService executor;
+   private static final int EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS = 60;
+   protected Configuration configuration;
+   protected final int LOG_FREQUENCY = 5000;
+
+   protected StatisticTestResult performTestWithObjectType(String testCaseName, CacheWrapper cache, Class valueClass, String testName, int sampleSize, int numThreads) throws Exception
+   {
+      log.info("Number of threads " + numThreads);
+      executor = Executors.newFixedThreadPool(numThreads);
+
+      StatisticTestResult result = new StatisticTestResult();
+      result.setTestName(testCaseName + getNodeIndex());
+      result.setTestTime(new Date());
+      result.setTestType(testName);
+
+      log.info("Performing '" + sampleSize + "' PUTs");
+      DescriptiveStatistics putStats = doPuts(cache, valueClass, sampleSize);
+      executor = Executors.newFixedThreadPool(numThreads);
+      log.info("Performing GETs");
+      DescriptiveStatistics getStats = doGets(cache, sampleSize);
+
+      result.setGetData(getStats);
+      result.setPutData(putStats);
+      result.setTestPassed(true); // The test is passed. The report would make use of this attribute.
+
+      // calculate throughput, in transactions per second.
+      // we only measure put operations for throughput.
+
+      // calc tps.
+
+      System.out.println("*** sum of time: " + elapsedSecondsForAllPuts);
+      System.out.println("*** num puts occured: " + putStats.getN());
+
+      try
+      {
+         result.setThroughputTransactionsPerSecond((int) (sampleSize / elapsedSecondsForAllPuts));
+      }
+      catch (ArithmeticException ae)
+      {
+         log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
+         result.setThroughputTransactionsPerSecond(-999);
+      }
+
+      try
+      {
+         result.setThroughputBytesPerSecond((int) (numberOfBytesPut.longValue() / elapsedSecondsForAllPuts));
+      }
+      catch (ArithmeticException ae)
+      {
+         log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
+         result.setThroughputBytesPerSecond(-999);
+      }
+
+
+      // set the number of members in the cluster
+      result.setNumMembers(cache.getNumMembers());
+      result.setNumThreads(numThreads);
+
+      return result;
+   }
+
+   /**
+    * @param cache      The Cachewrapper on which the bechmark is conducted.
+    * @param sampleSize The size of the cache.
+    * @return The Descriptive statistics of the cache benchmarking.
+    */
+   private DescriptiveStatistics doGets(final CacheWrapper cache, int sampleSize) throws Exception
+   {
+      log.debug("Inside doGets for : " + cache);
+      final String key = "baseKey";
+      final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
+      final boolean useSerializable = cache instanceof SerializableCacheWrapper;
+
+      for (int i = 0; i < sampleSize; i++)
+      {
+         final int cycleNumber = i;
+         Runnable r = new Runnable()
+         {
+            public void run()
+            {
+               try
+               {
+                  if (!useSerializable)
+                  {
+                     // start your timer...
+                     long startTime = System.currentTimeMillis();
+                     cache.get(key + cycleNumber);
+                     long statValue = (System.currentTimeMillis() - startTime);
+                     stats.addValue(statValue);
+                     log.debug("The Get stat : " + statValue);
+                  }
+                  else
+                  {
+                     SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
+                     long startTime = System.currentTimeMillis();
+                     sCache.getSerializable(key + cycleNumber);
+                     long statValue = (System.currentTimeMillis() - startTime);
+                     stats.addValue(statValue);
+                     log.debug("The Get stat : " + statValue);
+                  }
+                  logOperation(cycleNumber, "GETS");
+               }
+               catch (Exception e)
+               {
+                  // how should we handle this?  Log for now...
+                  log.error("Operation failed!", e);
+               }
+            }
+         };
+
+         // submit task to be executed
+         executor.execute(r);
+      }
+
+      // only leave once the task queue is empty!!
+      blockTillTasksComplete();
+
+      // return the raw data
+      log.debug("Leaving doGets for : " + cache);
+      return stats;
+   }
+
+   private void logOperation(int i, String s)
+   {
+      if ((i + 1) % LOG_FREQUENCY == 0)
+      {
+         log.info((i + 1) + " " + s + " were performed");
+      }
+   }
+
+   /**
+    * @param cache      The Cachewrapper on which the bechmark is conducted.
+    * @param valueClass The value class instance which is going to be inserted into the Cache.
+    * @param sampleSize The size of the cache.
+    * @return The Descriptive statistics of the cache benchmarking.
+    */
+   private DescriptiveStatistics doPuts(final CacheWrapper cache, final Class valueClass, int sampleSize) throws Exception
+   {
+      log.debug("Inside doPuts for " + cache);
+      final String key = "baseKey";
+      final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
+      final boolean useSerializable = cache instanceof SerializableCacheWrapper;
+      numberOfBytesPut.set(0);
+      elapsedSecondsForAllPuts = 0;
+      long startElapsedTime = System.currentTimeMillis();
+
+      for (int i = 0; i < sampleSize; i++)
+      {
+         final int cycleNumber = i;
+         Runnable r = new Runnable()
+         {
+            public void run()
+            {
+               try
+               {
+                  // generate some value
+                  Object value;
+                  if (valueClass == null) value = null;
+                  else if (valueClass.getName().equals("java.lang.String")) value = "value" + cycleNumber;
+                  else if (valueClass.getName().equals("java.lang.Integer")) value = cycleNumber;
+                  else value = valueClass.newInstance();
+
+                  // even though some impls may use special marshalling to reduce the amount of data transmitted (such as JBoss Cache's
+                  // CacheMarshaller) we still want to measure the serialized size of objects for this metric.
+
+                  numberOfBytesPut.getAndAdd(calculateSerializedSize(value));
+
+                  if (!useSerializable)
+                  {
+                     // start your timer...
+                     long startTime = System.currentTimeMillis();
+                     cache.put(key + cycleNumber, value);
+                     long statValue = (System.currentTimeMillis() - startTime);
+                     stats.addValue(statValue);
+                  }
+                  else
+                  {
+                     SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
+                     Serializable sValue = (Serializable) value;
+                     long startTime = System.currentTimeMillis();
+                     sCache.putSerializable(key + cycleNumber, sValue);
+                     long statValue = (System.currentTimeMillis() - startTime);
+                     stats.addValue(statValue);
+                  }
+                  logOperation(cycleNumber,"PUTS");
+               }
+               catch (Exception e)
+               {
+                  // how should we handle this?  Log for now...
+                  log.error("Operation failed!", e);
+               }
+            }
+         };
+         // submit task to be executed
+         executor.execute(r);
+      }
+
+      // only leave once the task queue is empty!!
+      blockTillTasksComplete();
+      elapsedSecondsForAllPuts = (System.currentTimeMillis() - startElapsedTime) / 1000;
+
+      // return the raw data
+      log.debug("Leaving doPuts for " + cache);
+      return stats;
+   }
+
+   private void blockTillTasksComplete()
+   {
+      // now that just told us that all the tasks have been submitted.  Lets check that the executor has finished everything.
+      executor.shutdown();
+      while (!executor.isTerminated())
+      {
+         try
+         {
+            executor.awaitTermination(EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS, TimeUnit.SECONDS);
+         }
+         catch (InterruptedException e)
+         {
+            // do nothing?
+         }
+      }
+   }
+
+   private long calculateSerializedSize(Object value)
+   {
+      ByteArrayOutputStream baos = null;
+      ObjectOutputStream oos = null;
+      try
+      {
+         baos = new ByteArrayOutputStream();
+         oos = new ObjectOutputStream(baos);
+         oos.writeObject(value);
+         oos.close();
+         baos.close();
+         return baos.size();
+      }
+      catch (Exception e)
+      {
+         log.warn("Unable to calculate serialized size of object " + value, e);
+         try
+         {
+            if (oos != null) oos.close();
+            if (baos != null) baos.close();
+         }
+         catch (Exception e2)
+         {
+            log.warn("Unable to close streams", e2);
+         }
+      }
+      return 0;
+   }
+
+   public String getNodeIndex()
+   {
+      try
+      {
+         return " - " + Integer.parseInt(System.getProperty("currentIndex"));
+      } catch (Exception e) {
+         return "";
+      }
+   }
+
+   public void setConfiguration(Configuration configuration)
+   {
+      this.configuration = configuration;
+   }
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,25 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeWithStatics;
+import org.cachebench.testobjects.SerializableCustomTypeWithStatics;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public class StaticsTest extends SimpleTest
+{
+
+   /* (non-Javadoc)
+   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+   */
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithStatics.class : CustomTypeWithStatics.class, testCaseName, sampleSize, numThreads);
+   }
+
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,23 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public class StringTest extends SimpleTest
+{
+
+   /* (non-Javadoc)
+   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+   */
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      return performTestWithObjectType(testName, cache, String.class, testCaseName, sampleSize, numThreads);
+
+   }
+
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeSubclassOfAbstract;
+import org.cachebench.testobjects.SerializableCustomTypeSubclassOfAbstract;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public class SubclassTest extends SimpleTest
+{
+
+   /* (non-Javadoc)
+   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+   */
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeSubclassOfAbstract.class : CustomTypeSubclassOfAbstract.class, testCaseName, sampleSize, numThreads);
+
+   }
+
+}

Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java	                        (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java	2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeWithTransient;
+import org.cachebench.testobjects.SerializableCustomTypeWithTransient;
+
+
+/**
+ * @author Manik Surtani (manik at surtani.org)
+ *         (C) Manik Surtani, 2004
+ */
+public class TransientTest extends SimpleTest
+{
+
+   /* (non-Javadoc)
+   * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+   */
+   public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+   {
+      return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithTransient.class : CustomTypeWithTransient.class, testCaseName, sampleSize, numThreads);
+
+   }
+
+}




More information about the jbosscache-commits mailing list