[jboss-cvs] JBossAS SVN: r57349 - in trunk/aop/src: resources/test/stress resources/test/stress/methodinvocation test/org/jboss/test/aop/stress test/org/jboss/test/aop/stress/methodinvocation test/org/jboss/test/aop/stress/simple
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 2 08:59:41 EDT 2006
Author: kabir.khan at jboss.com
Date: 2006-10-02 08:59:36 -0400 (Mon, 02 Oct 2006)
New Revision: 57349
Added:
trunk/aop/src/resources/test/stress/methodinvocation/
trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml
trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/
trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java
trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java
Modified:
trunk/aop/src/resources/test/stress/config.properties
trunk/aop/src/test/org/jboss/test/aop/stress/ScenarioRunner.java
trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java
Log:
Add some more stress tests
Modified: trunk/aop/src/resources/test/stress/config.properties
===================================================================
--- trunk/aop/src/resources/test/stress/config.properties 2006-10-02 12:08:42 UTC (rev 57348)
+++ trunk/aop/src/resources/test/stress/config.properties 2006-10-02 12:59:36 UTC (rev 57349)
@@ -1,5 +1,5 @@
-loops=30
-threads=10
-random_sleep_interval=true
-sleeptime_millis=100
+loops=1000000
+threads=20
+random_sleep_interval=false
+sleeptime_millis=0
logging=false
Added: trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml
===================================================================
--- trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml 2006-10-02 12:08:42 UTC (rev 57348)
+++ trunk/aop/src/resources/test/stress/methodinvocation/jboss-aop.xml 2006-10-02 12:59:36 UTC (rev 57349)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+ <prepare expr="all(org.jboss.test.aop.stress.methodinvocation.POJO)"/>
+</aop>
Modified: trunk/aop/src/test/org/jboss/test/aop/stress/ScenarioRunner.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/stress/ScenarioRunner.java 2006-10-02 12:08:42 UTC (rev 57348)
+++ trunk/aop/src/test/org/jboss/test/aop/stress/ScenarioRunner.java 2006-10-02 12:59:36 UTC (rev 57349)
@@ -21,11 +21,8 @@
*/
package org.jboss.test.aop.stress;
-import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -102,6 +99,7 @@
public void executeScenarios(Scenario[] scenarios) throws Exception
{
System.out.println("Starting run with Scenarios " + Arrays.asList(scenarios));
+ long start = System.currentTimeMillis();
ScenarioLoader[] loaders = new ScenarioLoader[threads];
for (int thread = 0 ; thread < threads ; thread++)
@@ -120,6 +118,7 @@
loaders[thread].join();
}
+ long end = System.currentTimeMillis();
boolean hadExceptions = false;
for (int thread = 0 ; thread < loaders.length ; thread++)
{
@@ -133,7 +132,7 @@
}
}
- System.out.println("--- DONE ---");
+ System.out.println("--- DONE --- test took " + (end - start) + " ms");
if (hadExceptions)
{
Added: trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java 2006-10-02 12:08:42 UTC (rev 57348)
+++ trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/MethodInvocationTestCase.java 2006-10-02 12:59:36 UTC (rev 57349)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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 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;
+
+/**
+ * Primarily to make sure I got everything right for the generated advisors
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 45109 $
+ */
+public class MethodInvocationTestCase extends ScenarioTest
+{
+
+ public static void main(String[] args)
+ {
+ junit.textui.TestRunner.run(MethodInvocationTestCase.class);
+ }
+
+
+ public MethodInvocationTestCase(String name) throws Exception
+ {
+ super(name);
+ }
+
+ public void testMethod() throws Exception
+ {
+ POJO pojo = new POJO();
+ pojo.method();//in case of generated advisors generate the joinpoint class
+ super.runner.executeScenario(new ExceptionScenario());
+ }
+
+ private class ExceptionScenario implements Scenario
+ {
+ POJO pojo = new POJO();
+ public void execute(int thread, int loop) throws Exception
+ {
+ pojo.method();
+ }
+
+ }
+}
Added: trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java 2006-10-02 12:08:42 UTC (rev 57348)
+++ trunk/aop/src/test/org/jboss/test/aop/stress/methodinvocation/POJO.java 2006-10-02 12:59:36 UTC (rev 57349)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJO
+{
+ public static void method()
+ {
+
+ }
+}
Modified: trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java 2006-10-02 12:08:42 UTC (rev 57348)
+++ trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java 2006-10-02 12:59:36 UTC (rev 57349)
@@ -64,21 +64,16 @@
public void testAnnotationsUnderStress() throws Exception
{
-// Class pojo = LargePojo.class;
-// Method m = pojo.getMethod("method", new Class[0]);
-// Field f = pojo.getField("field");
-
Scenario[] scenarios = new Scenario[] {
- new SimpleClassToJavassistScenario(/*pojo*/),
- new SimpleFieldToJavassistScenario(/*f*/),
- new SimpleMethodToJavassistScenario(/*m*/)};
+ new SimpleClassToJavassistScenario(),
+ new SimpleFieldToJavassistScenario(),
+ new SimpleMethodToJavassistScenario()};
super.runner.executeScenarios(scenarios);
}
private class ExceptionScenario implements Scenario
{
-
public void execute(int thread, int loop) throws Exception
{
if (thread == 0 && loop == 1)
@@ -91,14 +86,6 @@
}
private class SimpleClassToJavassistScenario implements Scenario
{
-// Class pojo;
-//
-// public SimpleClassToJavassistScenario(Class pojo)
-// {
-// this.pojo = pojo;
-// }
-
-
public void execute(int thread, int loop) throws Exception
{
Class pojo = LargePojo.class;
@@ -108,14 +95,6 @@
private class SimpleMethodToJavassistScenario implements Scenario
{
-// Method m;
-//
-// public SimpleMethodToJavassistScenario(Method m)
-// {
-// this.m = m;
-// }
-
-
public void execute(int thread, int loop) throws Exception
{
Class pojo = LargePojo.class;
@@ -126,14 +105,6 @@
private class SimpleFieldToJavassistScenario implements Scenario
{
-// Field f;
-//
-// public SimpleFieldToJavassistScenario(Field f)
-// {
-// this.f = f;
-// }
-
-
public void execute(int thread, int loop) throws Exception
{
Class pojo = LargePojo.class;
More information about the jboss-cvs-commits
mailing list