Author: manik.surtani(a)jboss.com
Date: 2008-05-09 13:06:27 -0400 (Fri, 09 May 2008)
New Revision: 5822
Added:
core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java
Modified:
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
Log:
Added profiling tests
Added: core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java
(rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ConstructionTest.java 2008-05-09
17:06:27 UTC (rev 5822)
@@ -0,0 +1,38 @@
+package org.jboss.cache.profiling;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
+import org.testng.annotations.Test;
+
+/**
+ * Profile LOCAL mode operation
+ *
+ * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
+ * @since 2.2.0
+ */
+@Test(groups = "profiling")
+public class ConstructionTest
+{
+ Cache cache;
+ private static final int WARMUP = 1000;
+ private static final int LOOPS = 5000;
+
+ public void testConstruction() throws InterruptedException
+ {
+ for (int i = 0; i < WARMUP; i++) new DefaultCacheFactory().createCache();
+ System.out.println("Finished warmup.");
+ System.gc();
+ Thread.sleep(1000);
+ System.out.println("Starting test");
+ doConstructionTest();
+ }
+
+ public void doConstructionTest()
+ {
+ for (int i = 0; i < LOOPS; i++)
+ {
+ new DefaultCacheFactory().createCache();
+ if (i % 100 == 0) System.out.println("In loop num " + i);
+ }
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-05-09
17:06:20 UTC (rev 5821)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-05-09
17:06:27 UTC (rev 5822)
@@ -48,6 +48,19 @@
private Log log = LogFactory.getLog(ProfileTest.class);
+ public void testLocalModePess() throws Exception
+ {
+ cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
+ runCompleteTest();
+ }
+
+ public void testLocalModeOpt() throws Exception
+ {
+ cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
+
cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
+ runCompleteTest();
+ }
+
public void testReplSync() throws Exception
{
runCompleteTest();
Show replies by date