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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 16 10:32:33 EST 2010


Author: kabir.khan at jboss.com
Date: 2010-02-16 10:32:32 -0500 (Tue, 16 Feb 2010)
New Revision: 101025

Added:
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/ObjectWithLotsOfProperties.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/SomeAnnotation.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/ObjectWithLotsOfPropertiesBenchmark.java
Modified:
   projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/AbstractBenchmark.java
Log:
[JBKERNEL-99][JBKERNEL-95] Cleanup + some more benchmarks

Modified: projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java
===================================================================
--- projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java	2010-02-16 15:31:03 UTC (rev 101024)
+++ projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java	2010-02-16 15:32:32 UTC (rev 101025)
@@ -201,20 +201,13 @@
    {
       private static final long serialVersionUID = 1L;
       
-      final ControllerState state;
       volatile int index;
       volatile ControllerStateWrapper before;
       volatile ControllerStateWrapper after;
       
-      ControllerStateWrapper(ControllerState state)
-      {
-         super(state.getStateString(), false);
-         this.state = state;
-      }
-      
       public ControllerStateWrapper(ControllerState state, int index, ControllerStateWrapper before, ControllerStateWrapper after)
       {
-         this(state);
+         super(state.getStateString(), false);
          this.index = index;
          this.before = before;
          this.after = after;

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/ObjectWithLotsOfProperties.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/ObjectWithLotsOfProperties.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/ObjectWithLotsOfProperties.java	2010-02-16 15:32:32 UTC (rev 101025)
@@ -0,0 +1,582 @@
+/*
+* 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.kernel.benchmark.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ObjectWithLotsOfProperties
+{
+   String property1;
+   String property2;
+   String property3;
+   String property4;
+   String property5;
+   String property6;
+   String property7;
+   String property8;
+   String property9;
+   String property10;
+   String property11;
+   String property12;
+   String property13;
+   String property14;
+   String property15;
+   String property16;
+   String property17;
+   String property18;
+   String property19;
+   String property20;
+   String property21;
+   String property22;
+   String property23;
+   String property24;
+   String property25;
+   String property26;
+   String property27;
+   String property28;
+   String property29;
+   String property30;
+   String property31;
+   String property32;
+   String property33;
+   String property34;
+   String property35;
+   String property36;
+   String property37;
+   String property38;
+   String property39;
+   String property40;
+   String property41;
+   String property42;
+   String property43;
+   String property44;
+   String property45;
+   String property46;
+   String property47;
+   String property48;
+   String property49;
+   String property50;
+   
+   @SomeAnnotation
+   public String getProperty1()
+   {
+      return property1;
+   }
+   @SomeAnnotation
+   public void setProperty1(String property1)
+   {
+      this.property1 = property1;
+   }
+   @SomeAnnotation
+   public String getProperty2()
+   {
+      return property2;
+   }
+   @SomeAnnotation
+   public void setProperty2(String property2)
+   {
+      this.property2 = property2;
+   }
+   @SomeAnnotation
+   public String getProperty3()
+   {
+      return property3;
+   }
+   @SomeAnnotation
+   public void setProperty3(String property3)
+   {
+      this.property3 = property3;
+   }
+   @SomeAnnotation
+   public String getProperty4()
+   {
+      return property4;
+   }
+   @SomeAnnotation
+   public void setProperty4(String property4)
+   {
+      this.property4 = property4;
+   }
+   @SomeAnnotation
+   public String getProperty5()
+   {
+      return property5;
+   }
+   @SomeAnnotation
+   public void setProperty5(String property5)
+   {
+      this.property5 = property5;
+   }
+   @SomeAnnotation
+   public String getProperty6()
+   {
+      return property6;
+   }
+   @SomeAnnotation
+   public void setProperty6(String property6)
+   {
+      this.property6 = property6;
+   }
+   @SomeAnnotation
+   public String getProperty7()
+   {
+      return property7;
+   }
+   @SomeAnnotation
+   public void setProperty7(String property7)
+   {
+      this.property7 = property7;
+   }
+   @SomeAnnotation
+   public String getProperty8()
+   {
+      return property8;
+   }
+   @SomeAnnotation
+   public void setProperty8(String property8)
+   {
+      this.property8 = property8;
+   }
+   @SomeAnnotation
+   public String getProperty9()
+   {
+      return property9;
+   }
+   @SomeAnnotation
+   public void setProperty9(String property9)
+   {
+      this.property9 = property9;
+   }
+   @SomeAnnotation
+   public String getProperty10()
+   {
+      return property10;
+   }
+   @SomeAnnotation
+   public void setProperty10(String property10)
+   {
+      this.property10 = property10;
+   }
+   @SomeAnnotation
+   public String getProperty11()
+   {
+      return property11;
+   }
+   @SomeAnnotation
+   public void setProperty11(String property11)
+   {
+      this.property11 = property11;
+   }
+   @SomeAnnotation
+   public String getProperty12()
+   {
+      return property12;
+   }
+   @SomeAnnotation
+   public void setProperty12(String property12)
+   {
+      this.property12 = property12;
+   }
+   @SomeAnnotation
+   public String getProperty13()
+   {
+      return property13;
+   }
+   @SomeAnnotation
+   public void setProperty13(String property13)
+   {
+      this.property13 = property13;
+   }
+   @SomeAnnotation
+   public String getProperty14()
+   {
+      return property14;
+   }
+   @SomeAnnotation
+   public void setProperty14(String property14)
+   {
+      this.property14 = property14;
+   }
+   @SomeAnnotation
+   public String getProperty15()
+   {
+      return property15;
+   }
+   @SomeAnnotation
+   public void setProperty15(String property15)
+   {
+      this.property15 = property15;
+   }
+   @SomeAnnotation
+   public String getProperty16()
+   {
+      return property16;
+   }
+   @SomeAnnotation
+   public void setProperty16(String property16)
+   {
+      this.property16 = property16;
+   }
+   @SomeAnnotation
+   public String getProperty17()
+   {
+      return property17;
+   }
+   @SomeAnnotation
+   public void setProperty17(String property17)
+   {
+      this.property17 = property17;
+   }
+   @SomeAnnotation
+   public String getProperty18()
+   {
+      return property18;
+   }
+   @SomeAnnotation
+   public void setProperty18(String property18)
+   {
+      this.property18 = property18;
+   }
+   @SomeAnnotation
+   public String getProperty19()
+   {
+      return property19;
+   }
+   @SomeAnnotation
+   public void setProperty19(String property19)
+   {
+      this.property19 = property19;
+   }
+   @SomeAnnotation
+   public String getProperty20()
+   {
+      return property20;
+   }
+   @SomeAnnotation
+   public void setProperty20(String property20)
+   {
+      this.property20 = property20;
+   }
+   @SomeAnnotation
+   public String getProperty21()
+   {
+      return property21;
+   }
+   @SomeAnnotation
+   public void setProperty21(String property21)
+   {
+      this.property21 = property21;
+   }
+   @SomeAnnotation
+   public String getProperty22()
+   {
+      return property22;
+   }
+   @SomeAnnotation
+   public void setProperty22(String property22)
+   {
+      this.property22 = property22;
+   }
+   @SomeAnnotation
+   public String getProperty23()
+   {
+      return property23;
+   }
+   @SomeAnnotation
+   public void setProperty23(String property23)
+   {
+      this.property23 = property23;
+   }
+   @SomeAnnotation
+   public String getProperty24()
+   {
+      return property24;
+   }
+   @SomeAnnotation
+   public void setProperty24(String property24)
+   {
+      this.property24 = property24;
+   }
+   @SomeAnnotation
+   public String getProperty25()
+   {
+      return property25;
+   }
+   @SomeAnnotation
+   public void setProperty25(String property25)
+   {
+      this.property25 = property25;
+   }
+   @SomeAnnotation
+   public String getProperty26()
+   {
+      return property26;
+   }
+   @SomeAnnotation
+   public void setProperty26(String property26)
+   {
+      this.property26 = property26;
+   }
+   @SomeAnnotation
+   public String getProperty27()
+   {
+      return property27;
+   }
+   @SomeAnnotation
+   public void setProperty27(String property27)
+   {
+      this.property27 = property27;
+   }
+   @SomeAnnotation
+   public String getProperty28()
+   {
+      return property28;
+   }
+   @SomeAnnotation
+   public void setProperty28(String property28)
+   {
+      this.property28 = property28;
+   }
+   @SomeAnnotation
+   public String getProperty29()
+   {
+      return property29;
+   }
+   @SomeAnnotation
+   public void setProperty29(String property29)
+   {
+      this.property29 = property29;
+   }
+   @SomeAnnotation
+   public String getProperty30()
+   {
+      return property30;
+   }
+   @SomeAnnotation
+   public void setProperty30(String property30)
+   {
+      this.property30 = property30;
+   }
+   @SomeAnnotation
+   public String getProperty31()
+   {
+      return property31;
+   }
+   @SomeAnnotation
+   public void setProperty31(String property31)
+   {
+      this.property31 = property31;
+   }
+   @SomeAnnotation
+   public String getProperty32()
+   {
+      return property32;
+   }
+   @SomeAnnotation
+   public void setProperty32(String property32)
+   {
+      this.property32 = property32;
+   }
+   @SomeAnnotation
+   public String getProperty33()
+   {
+      return property33;
+   }
+   @SomeAnnotation
+   public void setProperty33(String property33)
+   {
+      this.property33 = property33;
+   }
+   @SomeAnnotation
+   public String getProperty34()
+   {
+      return property34;
+   }
+   @SomeAnnotation
+   public void setProperty34(String property34)
+   {
+      this.property34 = property34;
+   }
+   @SomeAnnotation
+   public String getProperty35()
+   {
+      return property35;
+   }
+   @SomeAnnotation
+   public void setProperty35(String property35)
+   {
+      this.property35 = property35;
+   }
+   @SomeAnnotation
+   public String getProperty36()
+   {
+      return property36;
+   }
+   @SomeAnnotation
+   public void setProperty36(String property36)
+   {
+      this.property36 = property36;
+   }
+   @SomeAnnotation
+   public String getProperty37()
+   {
+      return property37;
+   }
+   @SomeAnnotation
+   public void setProperty37(String property37)
+   {
+      this.property37 = property37;
+   }
+   @SomeAnnotation
+   public String getProperty38()
+   {
+      return property38;
+   }
+   @SomeAnnotation
+   public void setProperty38(String property38)
+   {
+      this.property38 = property38;
+   }
+   @SomeAnnotation
+   public String getProperty39()
+   {
+      return property39;
+   }
+   @SomeAnnotation
+   public void setProperty39(String property39)
+   {
+      this.property39 = property39;
+   }
+   @SomeAnnotation
+   public String getProperty40()
+   {
+      return property40;
+   }
+   @SomeAnnotation
+   public void setProperty40(String property40)
+   {
+      this.property40 = property40;
+   }
+   @SomeAnnotation
+   public String getProperty41()
+   {
+      return property41;
+   }
+   @SomeAnnotation
+   public void setProperty41(String property41)
+   {
+      this.property41 = property41;
+   }
+   @SomeAnnotation
+   public String getProperty42()
+   {
+      return property42;
+   }
+   @SomeAnnotation
+   public void setProperty42(String property42)
+   {
+      this.property42 = property42;
+   }
+   @SomeAnnotation
+   public String getProperty43()
+   {
+      return property43;
+   }
+   @SomeAnnotation
+   public void setProperty43(String property43)
+   {
+      this.property43 = property43;
+   }
+   @SomeAnnotation
+   public String getProperty44()
+   {
+      return property44;
+   }
+   @SomeAnnotation
+   public void setProperty44(String property44)
+   {
+      this.property44 = property44;
+   }
+   @SomeAnnotation
+   public String getProperty45()
+   {
+      return property45;
+   }
+   @SomeAnnotation
+   public void setProperty45(String property45)
+   {
+      this.property45 = property45;
+   }
+   @SomeAnnotation
+   public String getProperty46()
+   {
+      return property46;
+   }
+   @SomeAnnotation
+   public void setProperty46(String property46)
+   {
+      this.property46 = property46;
+   }
+   @SomeAnnotation
+   public String getProperty47()
+   {
+      return property47;
+   }
+   @SomeAnnotation
+   public void setProperty47(String property47)
+   {
+      this.property47 = property47;
+   }
+   @SomeAnnotation
+   public String getProperty48()
+   {
+      return property48;
+   }
+   @SomeAnnotation
+   public void setProperty48(String property48)
+   {
+      this.property48 = property48;
+   }
+   @SomeAnnotation
+   public String getProperty49()
+   {
+      return property49;
+   }
+   @SomeAnnotation
+   public void setProperty49(String property49)
+   {
+      this.property49 = property49;
+   }
+   @SomeAnnotation
+   public String getProperty50()
+   {
+      return property50;
+   }
+   @SomeAnnotation
+   public void setProperty50(String property50)
+   {
+      this.property50 = property50;
+   }
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/SomeAnnotation.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/SomeAnnotation.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/SomeAnnotation.java	2010-02-16 15:32:32 UTC (rev 101025)
@@ -0,0 +1,36 @@
+/*
+* 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.kernel.benchmark.support;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface SomeAnnotation
+{
+
+}

Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/AbstractBenchmark.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/AbstractBenchmark.java	2010-02-16 15:31:03 UTC (rev 101024)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/AbstractBenchmark.java	2010-02-16 15:32:32 UTC (rev 101025)
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.test.kernel.junit.MicrocontainerTest;
 
@@ -44,6 +45,7 @@
    public void testBenchmark() throws Throwable
    {
       List<BeanMetaData> metaDatas = setupContexts();
+      assertEquals(iterations, metaDatas.size());
       
       long start = System.currentTimeMillis();
       for (BeanMetaData bmd : metaDatas)
@@ -53,10 +55,17 @@
       
       for (BeanMetaData bmd : metaDatas)
       {
-         assertNotNull(getControllerContext(bmd.getName(), ControllerState.INSTALLED));
+         ControllerContext ctx = getControllerContext(bmd.getName(), ControllerState.INSTALLED); 
+         assertNotNull(ctx);
+         extraCheck(ctx);
       }
    }
    
    protected abstract List<BeanMetaData> setupContexts();
    
+   protected void extraCheck(ControllerContext context)
+   {
+      
+   }
+   
 }

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/ObjectWithLotsOfPropertiesBenchmark.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/ObjectWithLotsOfPropertiesBenchmark.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/ObjectWithLotsOfPropertiesBenchmark.java	2010-02-16 15:32:32 UTC (rev 101025)
@@ -0,0 +1,71 @@
+   
+/*
+* 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.kernel.benchmark.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.test.kernel.benchmark.support.ObjectWithLotsOfProperties;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ObjectWithLotsOfPropertiesBenchmark extends AbstractBenchmark
+{
+   public ObjectWithLotsOfPropertiesBenchmark(String name)
+   {
+      super(name);
+      super.iterations = 1000;
+   }
+
+   @Override
+   protected List<BeanMetaData> setupContexts()
+   {
+      List<BeanMetaData> beans = new ArrayList<BeanMetaData>(iterations);
+      for (int i = 0 ; i < iterations ; i++)
+      {
+         BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean" + i, ObjectWithLotsOfProperties.class.getName());
+         for (int j = 1 ; j <= 50 ; j++)
+            builder.addPropertyMetaData("property" + j, "Bean" + + i + j);
+         beans.add(builder.getBeanMetaData());
+      }
+      return beans;
+   }
+   
+   @Override
+   protected void extraCheck(ControllerContext ctx)
+   {
+      ObjectWithLotsOfProperties obj = (ObjectWithLotsOfProperties)ctx.getTarget();
+      assertEquals(ctx.getName() + "1", obj.getProperty1());
+      assertEquals(ctx.getName() + "5", obj.getProperty5());
+      assertEquals(ctx.getName() + "25", obj.getProperty25());
+      assertEquals(ctx.getName() + "37", obj.getProperty37());
+      assertEquals(ctx.getName() + "48", obj.getProperty48());
+      assertEquals(ctx.getName() + "50", obj.getProperty50());
+   }
+}




More information about the jboss-cvs-commits mailing list