[jbosscache-commits] JBoss Cache SVN: r6728 - core/trunk/src/test/java/org/jboss/cache/profiling.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Sep 15 12:13:06 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-09-15 12:13:06 -0400 (Mon, 15 Sep 2008)
New Revision: 6728

Modified:
   core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
   core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
Log:
Updated tests

Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java	2008-09-15 15:56:56 UTC (rev 6727)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java	2008-09-15 16:13:06 UTC (rev 6728)
@@ -22,6 +22,7 @@
       System.in.read();
    }
 
+   @Test(enabled = false)
    public void testReplSync() throws Exception
    {
       cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
@@ -30,6 +31,7 @@
       waitForTest();
    }
 
+   @Test(enabled = true)
    public void testReplAsync() throws Exception
    {
       cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
@@ -42,6 +44,7 @@
       waitForTest();
    }
 
+   @Test(enabled = false)
    public void testReplSyncOptimistic() throws Exception
    {
       cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
@@ -50,6 +53,7 @@
       waitForTest();
    }
 
+   @Test(enabled = false)
    public void testReplAsyncOptimistic() throws Exception
    {
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
@@ -59,6 +63,7 @@
       waitForTest();
    }
 
+   @Test(enabled = false)
    public void testReplSyncBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -67,6 +72,7 @@
       testReplSync();
    }
 
+   @Test(enabled = false)
    public void testReplAsyncBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -79,6 +85,7 @@
       testReplAsync();
    }
 
+   @Test(enabled = false)
    public void testReplSyncOptBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -87,6 +94,7 @@
       testReplSyncOptimistic();
    }
 
+   @Test(enabled = false)
    public void testReplAsyncOptBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -95,21 +103,25 @@
       testReplAsyncOptimistic();
    }
 
+   @Test(enabled = false)
    public void testStateTransfer() throws Exception
    {
       throw new Exception("Implement me");
    }
 
+   @Test(enabled = false)
    public void testStartup() throws Exception
    {
       throw new Exception("Implement me");
    }
 
+   @Test(enabled = false)
    public void testCacheLoading() throws Exception
    {
       throw new Exception("Implement me");
    }
 
+   @Test(enabled = false)
    public void testPassivation() throws Exception
    {
       throw new Exception("Implement me");

Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java	2008-09-15 15:56:56 UTC (rev 6727)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java	2008-09-15 16:13:06 UTC (rev 6728)
@@ -37,7 +37,7 @@
    /*
       Test configuration options
     */
-   protected static final long DURATION = 60 * 1000; // 1 min of GENERATION = a lot of processing.  :-)
+   protected static final long NUM_OPERATIONS = 1000000; // DURATION is replaced with a fixed number of operations instead.
    protected static final int NUM_THREADS = 15;
    protected static final int MAX_RANDOM_SLEEP_MILLIS = 1;
    protected static final int MAX_DEPTH = 3;
@@ -50,6 +50,7 @@
 
    private Log log = LogFactory.getLog(ProfileTest.class);
 
+   @Test(enabled = false)
    public void testLocalModePess() throws Exception
    {
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
@@ -60,6 +61,7 @@
       runCompleteTest();
    }
 
+   @Test(enabled = false)
    public void testLocalModeOpt() throws Exception
    {
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
@@ -67,12 +69,14 @@
       runCompleteTest();
    }
 
+   @Test(enabled = false)
    public void testReplSync() throws Exception
    {
       cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
       runCompleteTest();
    }
 
+   @Test(enabled = true)
    public void testReplAsync() throws Exception
    {
       cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
@@ -84,6 +88,7 @@
       runCompleteTest();
    }
 
+   @Test(enabled = false)
    public void testReplSyncOptimistic() throws Exception
    {
       cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
@@ -91,6 +96,7 @@
       runCompleteTest();
    }
 
+   @Test(enabled = false)
    public void testReplAsyncOptimistic() throws Exception
    {
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
@@ -99,6 +105,7 @@
       runCompleteTest();
    }
 
+   @Test(enabled = false)
    public void testReplSyncBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -107,6 +114,7 @@
       testReplSync();
    }
 
+   @Test(enabled = false)
    public void testReplAsyncBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -119,6 +127,7 @@
       testReplAsync();
    }
 
+   @Test(enabled = false)
    public void testReplSyncOptBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -127,6 +136,7 @@
       testReplSyncOptimistic();
    }
 
+   @Test(enabled = false)
    public void testReplAsyncOptBR() throws Exception
    {
       BuddyReplicationConfig brc = new BuddyReplicationConfig();
@@ -238,23 +248,22 @@
    private void doTest() throws Exception
    {
       ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS);
-      long end = System.currentTimeMillis() + DURATION;
       long startTime = System.currentTimeMillis();
       log.warn("Starting test");
-      int i = 0;
-      while (System.currentTimeMillis() < end)
+      int i;
+      for (i = 0; i < NUM_OPERATIONS; i++)
       {
          MyRunnable r = null;
          switch (i % 3)
          {
             case 0:
-               r = new Putter(i++);
+               r = new Putter(i);
                break;
             case 1:
-               r = new Getter(i++);
+               r = new Getter(i);
                break;
             case 2:
-               r = new Remover(i++);
+               r = new Remover(i);
                break;
          }
          exec.execute(r);
@@ -267,6 +276,7 @@
       exec.awaitTermination(((long) i), TimeUnit.SECONDS);  // wait up to 1 sec for each call?
       long duration = System.currentTimeMillis() - startTime;
       log.warn("Finished test.  " + printDuration(duration));
+      log.warn("Throughput: " + (NUM_OPERATIONS * 1000 / duration) + " operations per second (roughly equal numbers of PUT, GET and REMOVE)");
    }
 
    enum Mode
@@ -351,21 +361,25 @@
       }
    }
 
+   @Test(enabled = false)
    public void testStateTransfer() throws Exception
    {
       throw new Exception("Implement me");
    }
 
+   @Test(enabled = false)
    public void testStartup() throws Exception
    {
       throw new Exception("Implement me");
    }
 
+   @Test(enabled = false)
    public void testCacheLoading() throws Exception
    {
       throw new Exception("Implement me");
    }
 
+   @Test(enabled = false)
    public void testPassivation() throws Exception
    {
       throw new Exception("Implement me");




More information about the jbosscache-commits mailing list