[jboss-cvs] JBossAS SVN: r65126 - in projects/aop/trunk/aop: src/resources/test/args and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Sep 5 16:26:48 EDT 2007
Author: flavia.rainone at jboss.com
Date: 2007-09-05 16:26:47 -0400 (Wed, 05 Sep 2007)
New Revision: 65126
Added:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/Arg2TestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect2.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgPOJOInterface.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgsPOJO2.java
Removed:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgAspect.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgPOJOInterface.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgTestCase.java
Modified:
projects/aop/trunk/aop/base-tests.xml
projects/aop/trunk/aop/build-tests-jdk50.xml
projects/aop/trunk/aop/src/resources/test/args/jboss-aop.xml
projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml
projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationAspect.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgTestCase.java
Log:
[JBAOP-382] Moved arg annotated tests to beforeafterArgs package. Package args now runs on all instrumentation modes.
Modified: projects/aop/trunk/aop/base-tests.xml
===================================================================
--- projects/aop/trunk/aop/base-tests.xml 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/base-tests.xml 2007-09-05 20:26:47 UTC (rev 65126)
@@ -1,11 +1,9 @@
<project name="code-generation" default="help">
<target name="_base-tests">
- <!-- only used with generated advisors
<antcall target="${test-target}" inheritRefs="true">
<param name="test" value="args"/>
</antcall>
- -->
<antcall target="${test-target}" inheritRefs="true">
<param name="test" value="packagedotdot"/>
</antcall>
Modified: projects/aop/trunk/aop/build-tests-jdk50.xml
===================================================================
--- projects/aop/trunk/aop/build-tests-jdk50.xml 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/build-tests-jdk50.xml 2007-09-05 20:26:47 UTC (rev 65126)
@@ -383,10 +383,6 @@
<param name="exclude" value="**/OverrideTestCase.class"/>
</antcall>
<antcall target="_run-javaagent-test" inheritRefs="true">
- <param name="test" value="args"/>
- <param name="caller" value="javaagent-genadvisor-tests"/>
- </antcall>
- <antcall target="_run-javaagent-test" inheritRefs="true">
<param name="test" value="dynamicgenadvisor"/>
<param name="caller" value="javaagent-genadvisor-tests"/>
</antcall>
@@ -577,10 +573,6 @@
<param name="caller" value="precompiled-genadvisor-tests"/>
</antcall>
<antcall target="_run-precompiled-test" inheritRefs="true">
- <param name="test" value="args"/>
- <param name="caller" value="precompiled-genadvisor-tests"/>
- </antcall>
- <antcall target="_run-precompiled-test" inheritRefs="true">
<param name="test" value="beforeafter"/>
<param name="caller" value="precompiled-genadvisor-tests"/>
</antcall>
Modified: projects/aop/trunk/aop/src/resources/test/args/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/args/jboss-aop.xml 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/resources/test/args/jboss-aop.xml 2007-09-05 20:26:47 UTC (rev 65126)
@@ -65,51 +65,13 @@
<advice name="getAndChangeArgumentsAdvice" aspect="org.jboss.test.aop.args.ArgumentsAspect"/>
</bind>
- <!-- @Arg test -->
- <aspect class="org.jboss.test.aop.args.ArgAspect" scope="PER_VM"/>
-
- <bind pointcut="execution(* org.jboss.test.aop.args.POJO->bunchArgs(..))">
- <advice name="bunchArgs" aspect="org.jboss.test.aop.args.ArgAspect"/>
- </bind>
-
- <bind pointcut="execution(* org.jboss.test.aop.args.POJO->bunchArgsWithInvocation(..))">
- <advice name="bunchArgsWithInvocation" aspect="org.jboss.test.aop.args.ArgAspect"/>
- </bind>
-
- <bind pointcut="execution(* org.jboss.test.aop.args.POJO->bunchWrapped(..))">
- <advice name="wrap" aspect="org.jboss.test.aop.args.ArgAspect"/>
- </bind>
-
- <bind pointcut="execution(* org.jboss.test.aop.args.POJO->bunch(..))">
- <advice name="bunch" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="bunch1" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="arg1" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="arg2" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="arg3" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="arg4" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="arg15" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="arg24" aspect="org.jboss.test.aop.args.ArgAspect"/>
- <advice name="emptyArg" aspect="org.jboss.test.aop.args.ArgAspect"/>
- </bind>
-
- <bind pointcut="execution(java.lang.String org.jboss.test.aop.args.POJO->echo(java.lang.String))">
- <advice name="echo" aspect="org.jboss.test.aop.args.ArgAspect"/>
- </bind>
-
<!-- @Invocation test -->
<aspect class="org.jboss.test.aop.args.InvocationAspect" scope="PER_VM"/>
<bind pointcut="execution(* org.jboss.test.aop.args.POJO->method1(..))">
-<!-- <before name="before" aspect="org.jboss.test.aop.args.InvocationAspect"/> -->
<advice name="aroundMethodExecution1" aspect="org.jboss.test.aop.args.InvocationAspect"/>
-<!-- <after name="after" aspect="org.jboss.test.aop.args.InvocationAspect"/> -->
-<!-- <throwing name="throwing" aspect="org.jboss.test.aop.args.InvocationAspect"/> -->
</bind>
-<!-- <bind pointcut="execution(* org.jboss.test.aop.args.POJO->method2(..))">
- <advice name="aroundMethodExecution2" aspect="org.jboss.test.aop.args.InvocationAspect"/>
- </bind> -->
-
<bind pointcut="get(* org.jboss.test.aop.args.POJO->number)">
<advice name="aroundFieldRead" aspect="org.jboss.test.aop.args.InvocationAspect"/>
</bind>
Modified: projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml 2007-09-05 20:26:47 UTC (rev 65126)
@@ -4,8 +4,9 @@
<aop>
<!-- @Arg test -->
- <aspect class="org.jboss.test.aop.beforeafterArgs.ArgAspect" scope="PER_VM"/>
+ <aspect class="org.jboss.test.aop.beforeafterArgs.ArgAspect" scope="PER_VM"/>
+
<bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.ArgsPOJO->bunch1(..))">
<before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect"/>
<before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect"/>
@@ -224,6 +225,36 @@
<after name="after5" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect"/>
</bind>
+ <aspect class="org.jboss.test.aop.beforeafterArgs.ArgAspect2" scope="PER_VM"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.ArgsPOJO2->bunchArgs(..))">
+ <advice name="bunchArgs" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ </bind>
+
+ <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.ArgsPOJO2->bunchArgsWithInvocation(..))">
+ <advice name="bunchArgsWithInvocation" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ </bind>
+
+ <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.ArgsPOJO2->bunchWrapped(..))">
+ <advice name="wrap" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ </bind>
+
+ <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.ArgsPOJO2->bunch(..))">
+ <advice name="bunch" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="bunch1" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="arg1" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="arg2" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="arg3" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="arg4" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="arg15" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="arg24" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ <advice name="emptyArg" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ </bind>
+
+ <bind pointcut="execution(java.lang.String org.jboss.test.aop.beforeafterArgs.ArgsPOJO2->echo(java.lang.String))">
+ <advice name="echo" aspect="org.jboss.test.aop.beforeafterArgs.ArgAspect2"/>
+ </bind>
+
<aspect class="org.jboss.test.aop.beforeafterArgs.ArgAspectInterfaces" scope="PER_VM"/>
<bind pointcut="execution(void org.jboss.test.aop.beforeafterArgs.ArgsPOJO->*(org.jboss.test.aop.beforeafterArgs.Interface))">
Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgAspect.java 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgAspect.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -1,193 +0,0 @@
-/*
- * 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.args;
-
-import junit.framework.Assert;
-
-import org.jboss.aop.advice.annotation.Arg;
-import org.jboss.aop.advice.annotation.JoinPoint;
-import org.jboss.aop.joinpoint.CurrentInvocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-
-/**
- * Aspect used on @Arg parameter tests.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class ArgAspect implements ArgPOJOInterface
-{
- public static boolean echoCalled = false;
- public static boolean wrapped = false;
- public static boolean args = false;
- public static boolean argsWithInvocation = false;
- public static boolean bunchCalled = false;
- public static boolean bunch2Called = false;
- public static boolean arg1Called = false;
- public static boolean arg2Called = false;
- public static boolean arg3Called = false;
- public static boolean arg4Called = false;
- public static boolean arg15Called = false;
- public static boolean arg24Called = false;
- public static boolean emptyArgCalled = false;
-
- public static void clear()
- {
- echoCalled = false;
- wrapped = false;
- args = false;
- argsWithInvocation = false;
- bunchCalled = false;
- bunch2Called = false;
- arg1Called = false;
- arg2Called = false;
- arg3Called = false;
- arg4Called = false;
- arg15Called = false;
- arg24Called = false;
- emptyArgCalled = false;
- }
-
- public String echo(@Arg String arg)
- {
- echoCalled = true;
-
- Assert.assertEquals("Args don't match", "hello", arg);
-
- try
- {
- return (String) CurrentInvocation.proceed();
- }
- catch (Throwable throwable)
- {
-
- throw new RuntimeException(throwable);
- }
- }
-
- public Object wrap(MethodInvocation invocation) throws Throwable
- {
- wrapped = true;
- return invocation.invokeNext();
- }
-
- public Object bunchArgs(@Arg int x, @Arg double y, @Arg float z,
- @Arg String str, @Arg int q) throws Throwable
- {
- args = true;
- return (Integer)CurrentInvocation.proceed();
- }
-
- public int bunchArgsWithInvocation(
- @JoinPoint MethodInvocation invocation,
- @Arg int x, @Arg double y, @Arg float z, @Arg String str, @Arg int q) throws Throwable
- {
- argsWithInvocation = true;
- return (Integer) invocation.invokeNext();
- }
-
- public int bunch(@Arg int x, @Arg double y, @Arg float z, @Arg String str, @Arg int q)
- {
- bunchCalled = true;
-
- Assert.assertEquals("Arguments don't match", 1, x);
- Assert.assertEquals("Arguments don't match", 2.2, y);
- Assert.assertEquals("Arguments don't match", 3.3F, z);
- Assert.assertEquals("Arguments don't match", "four", str);
- try
- {
- return ((Integer) CurrentInvocation.proceed()).intValue();
- }
- catch (Throwable throwable)
- {
- throw new RuntimeException(throwable);
- }
- }
-
- public int bunch1(@Arg int x, @Arg int q, @Arg String str, @Arg double y, @Arg float z)
- {
- bunch2Called = true;
-
- Assert.assertEquals("Arguments don't match", 1, x);
- Assert.assertEquals("Arguments don't match", 2.2, y);
- Assert.assertEquals("Arguments don't match", 3.3F, z);
- Assert.assertEquals("Arguments don't match", "four", str);
- try
- {
- return ((Integer) CurrentInvocation.proceed()).intValue();
- }
- catch (Throwable throwable)
- {
- throw new RuntimeException(throwable);
- }
- }
-
- public Object arg1(@Arg int x) throws Throwable
- {
- arg1Called = true;
- Assert.assertEquals("Arguments don't match", 1, x);
- return CurrentInvocation.proceed();
- }
-
- public int arg2(@Arg double y) throws Throwable
- {
- arg2Called = true;
- Assert.assertEquals("Arguments don't match", 2.2, y);
- return (Integer) CurrentInvocation.proceed();
- }
-
- public Object arg3(@Arg float z) throws Throwable
- {
- arg3Called = true;
- Assert.assertEquals("Arguments don't match", 3.3F, z);
- return CurrentInvocation.proceed();
- }
-
- public Object arg4(@Arg Object str) throws Throwable
- {
- arg4Called = true;
- Assert.assertEquals("Arguments don't match", "four", str);
- return (Integer) CurrentInvocation.proceed();
- }
-
- public Object arg15(@Arg int x, @Arg int q) throws Throwable
- {
- arg15Called = true;
- Assert.assertEquals("Arguments don't match", 1, x);
- Assert.assertEquals("Arguments don't match", 5, q);
- return CurrentInvocation.proceed();
- }
-
- public int arg24(@Arg String str, @Arg double y) throws Throwable
- {
- arg24Called = true;
- Assert.assertEquals("Arguments don't match", 2.2, y);
- Assert.assertEquals("Arguments don't match", "four", str);
- return (Integer) CurrentInvocation.proceed();
- }
-
- public Object emptyArg() throws Throwable
- {
- emptyArgCalled = true;
- return CurrentInvocation.proceed();
- }
-}
\ No newline at end of file
Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgPOJOInterface.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgPOJOInterface.java 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgPOJOInterface.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -1,36 +0,0 @@
-/*
- * 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.args;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface ArgPOJOInterface
-{
- String echo(String echo);
-
- int bunch(int x, double y, float z, String str, int q);
-
-}
Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgTestCase.java 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgTestCase.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -1,120 +0,0 @@
-/*
- * 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.args;
-
-import org.jboss.test.aop.AOPTestWithSetup;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-
-/**
- * Tests the use of @Arg parameters.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class ArgTestCase extends AOPTestWithSetup
-{
- POJO pojo;
-
- public static void main(String[] args)
- {
- TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("ArgTestCase");
- suite.addTestSuite(ArgTestCase.class);
- return suite;
- }
-
- public ArgTestCase(String name)
- {
- super(name);
- }
-
- public void setUp() throws Exception
- {
- super.setUp();
- pojo = new POJO();
- ArgAspect.clear();
- }
-
- public void testBench()
- {
- {
- long start = System.currentTimeMillis();
- for (int i = 0; i < 1000000; i++)
- {
- pojo.bunchArgs(1, 2.2, 3.3F, "four", 5);
- }
- long end = System.currentTimeMillis() - start;
- System.out.println("bunchArgs: " + end);
- }
-
- {
- long start = System.currentTimeMillis();
- for (int i = 0; i < 1000000; i++)
- {
- pojo.bunchWrapped(1, 2.2, 3.3F, "four", 5);
- }
- long end = System.currentTimeMillis() - start;
- System.out.println("bunchWrapped: " + end);
- }
-
- {
- long start = System.currentTimeMillis();
- for (int i = 0; i < 1000000; i++)
- {
- pojo.bunchArgsWithInvocation(1, 2.2, 3.3F, "four", 5);
- }
- long end = System.currentTimeMillis() - start;
- System.out.println("bunchArgsWithInvocation: " + end);
- }
- assertTrue(ArgAspect.argsWithInvocation);
- assertTrue(ArgAspect.args);
- assertTrue(ArgAspect.wrapped);
- }
-
- public void testEcho()
- {
- pojo.echo("hello");
- assertTrue(ArgAspect.echoCalled);
- }
-
- public void testBunch()
- {
- pojo.bunch(1, 2.2, 3.3F, "four", 5);
- assertTrue(ArgAspect.bunchCalled);
- assertTrue(ArgAspect.bunch2Called);
- assertTrue(ArgAspect.arg1Called);
- assertTrue(ArgAspect.arg2Called);
- assertTrue(ArgAspect.arg3Called);
- assertTrue(ArgAspect.arg4Called);
- assertTrue(ArgAspect.arg15Called);
- assertTrue(ArgAspect.arg24Called);
- assertTrue(ArgAspect.emptyArgCalled);
- }
-}
\ No newline at end of file
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationAspect.java 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationAspect.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -21,10 +21,7 @@
*/
package org.jboss.test.aop.args;
-import junit.framework.Assert;
-
import org.jboss.aop.advice.annotation.JoinPoint;
-import org.jboss.aop.joinpoint.ConstructorInvocation;
import org.jboss.aop.joinpoint.FieldInvocation;
import org.jboss.aop.joinpoint.FieldReadInvocation;
import org.jboss.aop.joinpoint.Invocation;
@@ -52,11 +49,10 @@
return "aroundMethodExecution1";
}
- public int aroundMethodExecution2(@JoinPoint ConstructorInvocation invocation)
- throws Throwable
+ public Object aroundMethodExecution2(@JoinPoint MethodInvocation invocation)
{
- Assert.fail("This advice should never be executed");
- return 0;
+ advice = "aroundMethodExecution1";
+ return "aroundMethodExecution1";
}
public Object aroundMethodCalledByMethod(@JoinPoint Invocation invocation)
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationTestCase.java 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/InvocationTestCase.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -21,12 +21,12 @@
*/
package org.jboss.test.aop.args;
-import org.jboss.test.aop.AOPTestWithSetup;
-
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
+import org.jboss.test.aop.AOPTestWithSetup;
+
/**
* Tests the use of @org.jboss.aop.advice.annotation.Invocation parameters.
*
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/Arg2TestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/Arg2TestCase.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/Arg2TestCase.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -0,0 +1,122 @@
+/*
+ * 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.beforeafterArgs;
+
+import org.jboss.test.aop.AOPTestWithSetup;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+
+/**
+ * Tests the use of @Arg parameters (with around advices only).
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 64564 $
+ *
+ * @see ArgTestCase
+ */
+public class Arg2TestCase extends AOPTestWithSetup
+{
+ ArgsPOJO2 pojo;
+
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Arg2TestCase");
+ suite.addTestSuite(Arg2TestCase.class);
+ return suite;
+ }
+
+ public Arg2TestCase(String name)
+ {
+ super(name);
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ pojo = new ArgsPOJO2();
+ ArgAspect.clear();
+ }
+
+ public void testBench()
+ {
+ {
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < 1000000; i++)
+ {
+ pojo.bunchArgs(1, 2.2, 3.3F, "four", 5);
+ }
+ long end = System.currentTimeMillis() - start;
+ System.out.println("bunchArgs: " + end);
+ }
+
+ {
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < 1000000; i++)
+ {
+ pojo.bunchWrapped(1, 2.2, 3.3F, "four", 5);
+ }
+ long end = System.currentTimeMillis() - start;
+ System.out.println("bunchWrapped: " + end);
+ }
+
+ {
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < 1000000; i++)
+ {
+ pojo.bunchArgsWithInvocation(1, 2.2, 3.3F, "four", 5);
+ }
+ long end = System.currentTimeMillis() - start;
+ System.out.println("bunchArgsWithInvocation: " + end);
+ }
+ assertTrue(ArgAspect2.argsWithInvocation);
+ assertTrue(ArgAspect2.args);
+ assertTrue(ArgAspect2.wrapped);
+ }
+
+ public void testEcho()
+ {
+ pojo.echo("hello");
+ assertTrue(ArgAspect2.echoCalled);
+ }
+
+ public void testBunch()
+ {
+ pojo.bunch(1, 2.2, 3.3F, "four", 5);
+ assertTrue(ArgAspect2.bunchCalled);
+ assertTrue(ArgAspect2.bunch2Called);
+ assertTrue(ArgAspect2.arg1Called);
+ assertTrue(ArgAspect2.arg2Called);
+ assertTrue(ArgAspect2.arg3Called);
+ assertTrue(ArgAspect2.arg4Called);
+ assertTrue(ArgAspect2.arg15Called);
+ assertTrue(ArgAspect2.arg24Called);
+ assertTrue(ArgAspect2.emptyArgCalled);
+ }
+}
\ No newline at end of file
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect.java 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -36,7 +36,7 @@
* only with generated advisors).
*
* @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- * @see org.jboss.test.aop.args.ArgAspect
+ * @see org.jboss.test.aop.beforeafterArgs.ArgAspect
*/
public class ArgAspect
{
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect2.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect2.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgAspect2.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -0,0 +1,193 @@
+/*
+ * 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.beforeafterArgs;
+
+import junit.framework.Assert;
+
+import org.jboss.aop.advice.annotation.Arg;
+import org.jboss.aop.advice.annotation.JoinPoint;
+import org.jboss.aop.joinpoint.CurrentInvocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ * Aspect used on @Arg parameter tests.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 64564 $
+ */
+public class ArgAspect2 implements ArgPOJOInterface
+{
+ public static boolean echoCalled = false;
+ public static boolean wrapped = false;
+ public static boolean args = false;
+ public static boolean argsWithInvocation = false;
+ public static boolean bunchCalled = false;
+ public static boolean bunch2Called = false;
+ public static boolean arg1Called = false;
+ public static boolean arg2Called = false;
+ public static boolean arg3Called = false;
+ public static boolean arg4Called = false;
+ public static boolean arg15Called = false;
+ public static boolean arg24Called = false;
+ public static boolean emptyArgCalled = false;
+
+ public static void clear()
+ {
+ echoCalled = false;
+ wrapped = false;
+ args = false;
+ argsWithInvocation = false;
+ bunchCalled = false;
+ bunch2Called = false;
+ arg1Called = false;
+ arg2Called = false;
+ arg3Called = false;
+ arg4Called = false;
+ arg15Called = false;
+ arg24Called = false;
+ emptyArgCalled = false;
+ }
+
+ public String echo(@Arg String arg)
+ {
+ echoCalled = true;
+
+ Assert.assertEquals("Args don't match", "hello", arg);
+
+ try
+ {
+ return (String) CurrentInvocation.proceed();
+ }
+ catch (Throwable throwable)
+ {
+
+ throw new RuntimeException(throwable);
+ }
+ }
+
+ public Object wrap(MethodInvocation invocation) throws Throwable
+ {
+ wrapped = true;
+ return invocation.invokeNext();
+ }
+
+ public Object bunchArgs(@Arg int x, @Arg double y, @Arg float z,
+ @Arg String str, @Arg int q) throws Throwable
+ {
+ args = true;
+ return (Integer)CurrentInvocation.proceed();
+ }
+
+ public int bunchArgsWithInvocation(
+ @JoinPoint MethodInvocation invocation,
+ @Arg int x, @Arg double y, @Arg float z, @Arg String str, @Arg int q) throws Throwable
+ {
+ argsWithInvocation = true;
+ return (Integer) invocation.invokeNext();
+ }
+
+ public int bunch(@Arg int x, @Arg double y, @Arg float z, @Arg String str, @Arg int q)
+ {
+ bunchCalled = true;
+
+ Assert.assertEquals("Arguments don't match", 1, x);
+ Assert.assertEquals("Arguments don't match", 2.2, y);
+ Assert.assertEquals("Arguments don't match", 3.3F, z);
+ Assert.assertEquals("Arguments don't match", "four", str);
+ try
+ {
+ return ((Integer) CurrentInvocation.proceed()).intValue();
+ }
+ catch (Throwable throwable)
+ {
+ throw new RuntimeException(throwable);
+ }
+ }
+
+ public int bunch1(@Arg int x, @Arg int q, @Arg String str, @Arg double y, @Arg float z)
+ {
+ bunch2Called = true;
+
+ Assert.assertEquals("Arguments don't match", 1, x);
+ Assert.assertEquals("Arguments don't match", 2.2, y);
+ Assert.assertEquals("Arguments don't match", 3.3F, z);
+ Assert.assertEquals("Arguments don't match", "four", str);
+ try
+ {
+ return ((Integer) CurrentInvocation.proceed()).intValue();
+ }
+ catch (Throwable throwable)
+ {
+ throw new RuntimeException(throwable);
+ }
+ }
+
+ public Object arg1(@Arg int x) throws Throwable
+ {
+ arg1Called = true;
+ Assert.assertEquals("Arguments don't match", 1, x);
+ return CurrentInvocation.proceed();
+ }
+
+ public int arg2(@Arg double y) throws Throwable
+ {
+ arg2Called = true;
+ Assert.assertEquals("Arguments don't match", 2.2, y);
+ return (Integer) CurrentInvocation.proceed();
+ }
+
+ public Object arg3(@Arg float z) throws Throwable
+ {
+ arg3Called = true;
+ Assert.assertEquals("Arguments don't match", 3.3F, z);
+ return CurrentInvocation.proceed();
+ }
+
+ public Object arg4(@Arg Object str) throws Throwable
+ {
+ arg4Called = true;
+ Assert.assertEquals("Arguments don't match", "four", str);
+ return (Integer) CurrentInvocation.proceed();
+ }
+
+ public Object arg15(@Arg int x, @Arg int q) throws Throwable
+ {
+ arg15Called = true;
+ Assert.assertEquals("Arguments don't match", 1, x);
+ Assert.assertEquals("Arguments don't match", 5, q);
+ return CurrentInvocation.proceed();
+ }
+
+ public int arg24(@Arg String str, @Arg double y) throws Throwable
+ {
+ arg24Called = true;
+ Assert.assertEquals("Arguments don't match", 2.2, y);
+ Assert.assertEquals("Arguments don't match", "four", str);
+ return (Integer) CurrentInvocation.proceed();
+ }
+
+ public Object emptyArg() throws Throwable
+ {
+ emptyArgCalled = true;
+ return CurrentInvocation.proceed();
+ }
+}
\ No newline at end of file
Copied: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgPOJOInterface.java (from rev 65089, projects/aop/trunk/aop/src/test/org/jboss/test/aop/args/ArgPOJOInterface.java)
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgPOJOInterface.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgPOJOInterface.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -0,0 +1,36 @@
+/*
+ * 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.beforeafterArgs;
+
+/**
+ * Interface implemented by {@link ArgsPOJO2}.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public interface ArgPOJOInterface
+{
+ String echo(String echo);
+
+ int bunch(int x, double y, float z, String str, int q);
+
+}
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgTestCase.java 2007-09-05 20:24:20 UTC (rev 65125)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgTestCase.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -41,7 +41,7 @@
* @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
*
* @see ArgsTestCase
- * @see org.jboss.test.aop.args.ArgTestCase
+ * @see org.jboss.test.aop.beforeafterArgs.Arg2TestCase
* @see org.jboss.test.aop.args.ArgumentsTestCase
*/
public class ArgTestCase extends AOPTestWithSetup
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgsPOJO2.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgsPOJO2.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/ArgsPOJO2.java 2007-09-05 20:26:47 UTC (rev 65126)
@@ -0,0 +1,62 @@
+/*
+ * 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.beforeafterArgs;
+
+
+
+/**
+ * Plain old java object used on @Args parameter tests.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 64564 $
+ *
+ * @see ArgsPOJO
+ */
+public class ArgsPOJO2 implements ArgPOJOInterface
+{
+ /* ArgTestCase */
+
+ public String echo(String echo)
+ {
+ return echo;
+ }
+
+ public int bunch(int x, double y, float z, String str, int q)
+ {
+ return x + (int) y + (int) z + q;
+ }
+
+ public int bunchArgs(int x, double y, float z, String str, int q)
+ {
+ return x + (int) y + (int) z + q;
+ }
+
+ public int bunchArgsWithInvocation(int x, double y, float z, String str, int q)
+ {
+ return x + (int) y + (int) z + q;
+ }
+
+ public int bunchWrapped(int x, double y, float z, String str, int q)
+ {
+ return x + (int) y + (int) z + q;
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list