[jboss-cvs] JBossAS SVN: r100747 - in projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller: benchmark and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 9 08:27:11 EST 2010


Author: kabir.khan at jboss.com
Date: 2010-02-09 08:27:11 -0500 (Tue, 09 Feb 2010)
New Revision: 100747

Added:
   projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/
   projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/AbstractSimpleBenchmark.java
   projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkCorrectOrder.java
   projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkWrongOrder.java
Removed:
   projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/Benchmark.java
Log:
Move benchmark

Added: projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/AbstractSimpleBenchmark.java
===================================================================
--- projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/AbstractSimpleBenchmark.java	                        (rev 0)
+++ projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/AbstractSimpleBenchmark.java	2010-02-09 13:27:11 UTC (rev 100747)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.dependency.controller.benchmark;
+
+import java.util.List;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.test.dependency.controller.test.AbstractDependencyTest;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractSimpleBenchmark extends AbstractDependencyTest
+{
+   protected final int iterations = 2000;
+   
+   public AbstractSimpleBenchmark(String name)
+   {
+      super(name);
+   }
+
+   public void testBenchmark() throws Throwable
+   {
+      List<ControllerContext> contexts = setupContexts();
+      
+      long start = System.currentTimeMillis();
+      for (ControllerContext context : contexts)
+         install(context);
+
+      System.out.println("----------> " + (System.currentTimeMillis() - start));
+      
+      for (ControllerContext context : contexts)
+      {
+         assertContext(context, ControllerState.INSTALLED);
+      }
+   }
+   
+   protected abstract List<ControllerContext> setupContexts();
+}

Added: projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkCorrectOrder.java
===================================================================
--- projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkCorrectOrder.java	                        (rev 0)
+++ projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkCorrectOrder.java	2010-02-09 13:27:11 UTC (rev 100747)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.dependency.controller.benchmark;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.test.dependency.controller.support.TestControllerContext;
+import org.jboss.test.dependency.controller.support.TestDelegate;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleBenchmarkCorrectOrder extends AbstractSimpleBenchmark
+{
+   public SimpleBenchmarkCorrectOrder(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected List<ControllerContext> setupContexts()
+   {
+      List<ControllerContext> contexts = new ArrayList<ControllerContext>(iterations);
+      for (int i = 0 ; i < iterations ; i++)
+      {
+         TestDelegate delegate = new TestDelegate("Bean" + i);
+         if (i != 0)
+            delegate.addDependency(new AbstractDependencyItem("Bean" + i, "Bean" + (i-1), ControllerState.CONFIGURED, ControllerState.INSTALLED));
+         contexts.add(new TestControllerContext(delegate));
+      }
+      return contexts;
+   }
+}

Added: projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkWrongOrder.java
===================================================================
--- projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkWrongOrder.java	                        (rev 0)
+++ projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/benchmark/SimpleBenchmarkWrongOrder.java	2010-02-09 13:27:11 UTC (rev 100747)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.dependency.controller.benchmark;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.test.dependency.controller.support.TestControllerContext;
+import org.jboss.test.dependency.controller.support.TestDelegate;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleBenchmarkWrongOrder extends AbstractSimpleBenchmark
+{
+   public SimpleBenchmarkWrongOrder(String name)
+   {
+      super(name);
+   }
+
+   protected List<ControllerContext> setupContexts()
+   {
+      List<ControllerContext> contexts = new ArrayList<ControllerContext>(iterations);
+      for (int i = 0 ; i < iterations ; i++)
+      {
+         TestDelegate delegate = new TestDelegate("Bean" + i);
+         if (i != iterations - 1)
+            delegate.addDependency(new AbstractDependencyItem("Bean" + i, "Bean" + (i+1), ControllerState.CONFIGURED, ControllerState.INSTALLED));
+         contexts.add(new TestControllerContext(delegate));
+      }
+      return contexts;
+   }
+}

Deleted: projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/Benchmark.java
===================================================================
--- projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/Benchmark.java	2010-02-09 13:01:15 UTC (rev 100746)
+++ projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/Benchmark.java	2010-02-09 13:27:11 UTC (rev 100747)
@@ -1,94 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.test.dependency.controller.test;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.test.dependency.controller.support.TestControllerContext;
-import org.jboss.test.dependency.controller.support.TestDelegate;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class Benchmark extends AbstractDependencyTest
-{
-   int iterations = 1000;
-   
-   public Benchmark(String name)
-   {
-      super(name);
-   }
-
-   public void testBenchmark() throws Throwable
-   {
-      List<ControllerContext> contexts = correctDependencies();
-//      List<ControllerContext> contexts = reverseDependencies();
-      
-      long start = System.currentTimeMillis();
-      for (ControllerContext context : contexts)
-      {
-         install(context);
-//         System.out.println(context.getName());
-      }
-      System.out.println("----------> " + (System.currentTimeMillis() - start));
-      
-      for (ControllerContext context : contexts)
-      {
-         assertContext(context, ControllerState.INSTALLED);
-      }
-   }
-   
-   private List<ControllerContext> correctDependencies()
-   {
-      List<ControllerContext> contexts = new ArrayList<ControllerContext>(iterations);
-      for (int i = 0 ; i < iterations ; i++)
-      {
-         TestDelegate delegate = new TestDelegate("Bean" + i);
-         if (i != 0)
-            delegate.addDependency(new AbstractDependencyItem("Bean" + i, "Bean" + (i-1), ControllerState.CONFIGURED, ControllerState.INSTALLED));
-         contexts.add(new TestControllerContext(delegate));
-      }
-      return contexts;
-   }
-   
-   private List<ControllerContext> reverseDependencies()
-   {
-      List<ControllerContext> contexts = new ArrayList<ControllerContext>(iterations);
-      for (int i = 0 ; i < iterations ; i++)
-      {
-         TestDelegate delegate = new TestDelegate("Bean" + i);
-         if (i != iterations - 1)
-            delegate.addDependency(new AbstractDependencyItem("Bean" + i, "Bean" + (i+1), ControllerState.CONFIGURED, ControllerState.INSTALLED));
-         contexts.add(new TestControllerContext(delegate));
-      }
-      return contexts;
-   }
-    
-   
-}




More information about the jboss-cvs-commits mailing list