[jboss-cvs] JBossAS SVN: r61557 - in projects/aop/trunk/aop/src: resources/test/stress/methodinvocation and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 21 17:31:58 EDT 2007
Author: kabir.khan at jboss.com
Date: 2007-03-21 17:31:58 -0400 (Wed, 21 Mar 2007)
New Revision: 61557
Added:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainAspect.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainInterceptor.java
Modified:
projects/aop/trunk/aop/src/resources/test/stress/config.properties
projects/aop/trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml
projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java
Log:
More stress tests
Modified: projects/aop/trunk/aop/src/resources/test/stress/config.properties
===================================================================
--- projects/aop/trunk/aop/src/resources/test/stress/config.properties 2007-03-21 20:03:52 UTC (rev 61556)
+++ projects/aop/trunk/aop/src/resources/test/stress/config.properties 2007-03-21 21:31:58 UTC (rev 61557)
@@ -1,5 +1,5 @@
-loops=10
-threads=20
+loops=50000000
+threads=1
random_sleep_interval=false
sleeptime_millis=0
logging=false
Modified: projects/aop/trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml 2007-03-21 20:03:52 UTC (rev 61556)
+++ projects/aop/trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml 2007-03-21 21:31:58 UTC (rev 61557)
@@ -1,4 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<aop>
+ <interceptor name="Int1" class="org.jboss.test.aop.stress.methodinvocation.PlainInterceptor"/>
+ <interceptor name="Int2" class="org.jboss.test.aop.stress.methodinvocation.PlainInterceptor"/>
+ <interceptor name="Int3" class="org.jboss.test.aop.stress.methodinvocation.PlainInterceptor"/>
+ <interceptor name="Int4" class="org.jboss.test.aop.stress.methodinvocation.PlainInterceptor"/>
+ <interceptor name="Int5" class="org.jboss.test.aop.stress.methodinvocation.PlainInterceptor"/>
+
+ <aspect name="plain" class="org.jboss.test.aop.stress.methodinvocation.PlainAspect"/>
+
<prepare expr="all(org.jboss.test.aop.stress.methodinvocation.POJO)"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.stress.methodinvocation.POJO->oneInterceptor())">
+ <interceptor-ref name="Int1"/>
+ </bind>
+
+ <bind pointcut="execution(* org.jboss.test.aop.stress.methodinvocation.POJO->fiveInterceptors())">
+ <interceptor-ref name="Int1"/>
+ <interceptor-ref name="Int2"/>
+ <interceptor-ref name="Int3"/>
+ <interceptor-ref name="Int4"/>
+ <interceptor-ref name="Int5"/>
+ </bind>
+
+ <bind pointcut="execution(* org.jboss.test.aop.stress.methodinvocation.POJO->oneAdvice())">
+ <advice aspect="plain" name="one"/>
+ </bind>
+
+ <bind pointcut="execution(* org.jboss.test.aop.stress.methodinvocation.POJO->fiveAdvices())">
+ <advice aspect="plain" name="one"/>
+ <advice aspect="plain" name="two"/>
+ <advice aspect="plain" name="three"/>
+ <advice aspect="plain" name="four"/>
+ <advice aspect="plain" name="five"/>
+ </bind>
+
</aop>
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java 2007-03-21 20:03:52 UTC (rev 61556)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java 2007-03-21 21:31:58 UTC (rev 61557)
@@ -21,10 +21,6 @@
*/
package org.jboss.test.aop.stress.methodinvocation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.jboss.aop.util.ReflectToJavassist;
import org.jboss.test.aop.stress.Scenario;
import org.jboss.test.aop.stress.ScenarioTest;
@@ -47,20 +43,107 @@
super(name);
}
- public void testMethod() throws Exception
+
+ public void testStaticWovenNoAdvice() throws Exception
{
+ POJO.staticMethodNoAdvice();//in case of generated advisors generate the joinpoint class
+ super.runner.executeScenario(new StaticWovenNoAdviceScenario());
+ }
+
+ private class StaticWovenNoAdviceScenario implements Scenario
+ {
POJO pojo = new POJO();
- pojo.method();//in case of generated advisors generate the joinpoint class
- super.runner.executeScenario(new ExceptionScenario());
+ public void execute(int thread, int loop) throws Exception
+ {
+ POJO.staticMethodNoAdvice();
+ }
}
- private class ExceptionScenario implements Scenario
+ public void testNonStaticWovenNoAdvice() throws Exception
{
POJO pojo = new POJO();
+ pojo.nonStaticMethodNoAdvice();//in case of generated advisors generate the joinpoint class
+ super.runner.executeScenario(new NonStaticWovenNoAdviceScenario());
+ }
+
+ private class NonStaticWovenNoAdviceScenario implements Scenario
+ {
+ POJO pojo = new POJO();
public void execute(int thread, int loop) throws Exception
{
- pojo.method();
+ pojo.nonStaticMethodNoAdvice();
}
-
}
+
+ public void testNonStaticWithOneInterceptor() throws Exception
+ {
+ POJO pojo = new POJO();
+ PlainInterceptor.called = 0;
+ pojo.oneInterceptor();//in case of generated advisors generate the joinpoint class
+ assertEquals(1, PlainInterceptor.called);
+ super.runner.executeScenario(new NonStaticWithOneInterceptorScenario());
+ }
+
+ private class NonStaticWithOneInterceptorScenario implements Scenario
+ {
+ POJO pojo = new POJO();
+ public void execute(int thread, int loop) throws Exception
+ {
+ pojo.oneInterceptor();
+ }
+ }
+
+ public void testNonStaticWithFiveInterceptors() throws Exception
+ {
+ POJO pojo = new POJO();
+ PlainInterceptor.called = 0;
+ pojo.fiveInterceptors();//in case of generated advisors generate the joinpoint class
+ assertEquals(5, PlainInterceptor.called);
+ super.runner.executeScenario(new NonStaticWithFiveInterceptorsScenario());
+ }
+
+ private class NonStaticWithFiveInterceptorsScenario implements Scenario
+ {
+ POJO pojo = new POJO();
+ public void execute(int thread, int loop) throws Exception
+ {
+ pojo.fiveInterceptors();
+ }
+ }
+
+ public void testNonStaticWithOneAdvice() throws Exception
+ {
+ POJO pojo = new POJO();
+ PlainAspect.called = 0;
+ pojo.oneAdvice();//in case of generated advisors generate the joinpoint class
+ assertEquals(1, PlainAspect.called);
+ super.runner.executeScenario(new NonStaticWithOneAdviceScenario());
+ }
+
+ private class NonStaticWithOneAdviceScenario implements Scenario
+ {
+ POJO pojo = new POJO();
+ public void execute(int thread, int loop) throws Exception
+ {
+ pojo.oneAdvice();
+ }
+ }
+
+ public void testNonStaticWithFiveAdvices() throws Exception
+ {
+ POJO pojo = new POJO();
+ PlainAspect.called = 0;
+ pojo.fiveAdvices();//in case of generated advisors generate the joinpoint class
+ assertEquals(5, PlainAspect.called);
+ super.runner.executeScenario(new NonStaticWithFiveAdvicesScenario());
+ }
+
+ private class NonStaticWithFiveAdvicesScenario implements Scenario
+ {
+ POJO pojo = new POJO();
+ public void execute(int thread, int loop) throws Exception
+ {
+ pojo.fiveAdvices();
+ }
+ }
}
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java 2007-03-21 20:03:52 UTC (rev 61556)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java 2007-03-21 21:31:58 UTC (rev 61557)
@@ -28,8 +28,39 @@
*/
public class POJO
{
- public static void method()
+ public static void staticMethodNoAdvice()
{
}
+
+ public void nonStaticMethodNoAdvice()
+ {
+
+ }
+
+ public void oneInterceptor()
+ {
+
+ }
+
+ public void fiveInterceptors()
+ {
+
+ }
+
+ public void oneAdvice()
+ {
+
+ }
+
+ public void fiveAdvices()
+ {
+
+ }
+
+ public static void generateStackTrace()
+ {
+ //Look at the depth of the call stack for different weaving types
+ new Exception("CALL STACK - INFO ONLY").printStackTrace();
+ }
}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainAspect.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainAspect.java 2007-03-21 21:31:58 UTC (rev 61557)
@@ -0,0 +1,65 @@
+/*
+* 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.aop.stress.methodinvocation;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class PlainAspect
+{
+ public static int called;
+
+ public Object one(Invocation invocation) throws Throwable
+ {
+ called++;
+ return invocation.invokeNext();
+ }
+
+ public Object two(Invocation invocation) throws Throwable
+ {
+ called++;
+ return invocation.invokeNext();
+ }
+
+ public Object three(Invocation invocation) throws Throwable
+ {
+ called++;
+ return invocation.invokeNext();
+ }
+
+ public Object four(Invocation invocation) throws Throwable
+ {
+ called++;
+ return invocation.invokeNext();
+ }
+
+ public Object five(Invocation invocation) throws Throwable
+ {
+ called++;
+ return invocation.invokeNext();
+ }
+
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainInterceptor.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainInterceptor.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/PlainInterceptor.java 2007-03-21 21:31:58 UTC (rev 61557)
@@ -0,0 +1,46 @@
+/*
+* 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.aop.stress.methodinvocation;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class PlainInterceptor implements Interceptor
+{
+ public static int called;
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ called++;
+ return invocation.invokeNext();
+ }
+
+}
More information about the jboss-cvs-commits
mailing list