[jboss-cvs] JBossAS SVN: r59247 - in projects/aop/trunk/aop/src: resources/test/beforeafterArgs test/org/jboss/test/aop/beforeafterArgs
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 29 19:06:59 EST 2006
Author: flavia.rainone
Date: 2006-12-29 19:06:51 -0500 (Fri, 29 Dec 2006)
New Revision: 59247
Added:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetAspect.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java
Modified:
projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml
Log:
[JBAOP-326] First Target parameter test
Modified: projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml 2006-12-29 23:52:03 UTC (rev 59246)
+++ projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml 2006-12-30 00:06:51 UTC (rev 59247)
@@ -60,7 +60,7 @@
<after name="after8" aspect="org.jboss.test.aop.beforeafterArgs.ArgsAspect" />
<throwing name="throwing" aspect="org.jboss.test.aop.beforeafterArgs.ArgsAspect" />
</bind>
-
+
<!-- @JoinPoint test -->
<aspect class="org.jboss.test.aop.beforeafterArgs.JoinPointAspect" scope="PER_VM"/>
@@ -168,6 +168,15 @@
<after name="after11" aspect="org.jboss.test.aop.beforeafterArgs.ReturnAspect"/>
</bind>
+ <!-- @Target test -->
+ <aspect class="org.jboss.test.aop.beforeafterArgs.TargetAspect" scope="PER_VM"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.TargetPOJO->method1(..))">
+ <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ <before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ </bind>
+
+
<!-- @Thrown test -->
<aspect class="org.jboss.test.aop.beforeafterArgs.ThrownAspect" scope="PER_VM"/>
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetAspect.java 2006-12-29 23:52:03 UTC (rev 59246)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetAspect.java 2006-12-30 00:06:51 UTC (rev 59247)
@@ -0,0 +1,55 @@
+/*
+ * 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.aop.advice.annotation.Target;
+
+/**
+ * Aspect used on @Args parameter tests.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class TargetAspect
+{
+ static boolean before1 = false;
+ static boolean before2 = false;
+
+ static Object before2Target = null;
+
+ public static void clear()
+ {
+ before1 = false;
+ before2 = false;
+ before2Target = null;
+ }
+
+ public void before1()
+ {
+ before1 = true;
+ }
+
+ public void before2(@Target Object target)
+ {
+ before2 = true;
+ before2Target = target;
+ }
+}
\ No newline at end of file
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java 2006-12-29 23:52:03 UTC (rev 59246)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java 2006-12-30 00:06:51 UTC (rev 59247)
@@ -0,0 +1,33 @@
+/*
+ * 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 @Target parameter tests.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class TargetPOJO
+{
+ public void method1(){}
+}
\ No newline at end of file
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java 2006-12-29 23:52:03 UTC (rev 59246)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java 2006-12-30 00:06:51 UTC (rev 59247)
@@ -0,0 +1,70 @@
+/*
+ * 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.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.aop.AOPTestWithSetup;
+
+/**
+ * Tests the use of @Target parameters.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class TargetTestCase extends AOPTestWithSetup
+{
+ private TargetPOJO pojo;
+
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("TargetTestCase");
+ suite.addTestSuite(TargetTestCase.class);
+ return suite;
+ }
+
+ public TargetTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ TargetAspect.clear();
+ this.pojo = new TargetPOJO();
+ }
+
+ public void test1()
+ {
+ pojo.method1();
+ assertTrue(TargetAspect.before1);
+ assertTrue(TargetAspect.before2);
+ assertSame(pojo, TargetAspect.before2Target);
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list