diff options
author | avasseur <avasseur> | 2005-10-27 11:43:16 +0000 |
---|---|---|
committer | avasseur <avasseur> | 2005-10-27 11:43:16 +0000 |
commit | fa21e62717f87e3f84b74dcedc36d79951ec0751 (patch) | |
tree | 2a9232ab0cb358747e2a6b7be627eae90d7e4dcc /tests/java5/ataspectj | |
parent | f202157faad53d040e13da63ef7a3a4472a72ce4 (diff) | |
download | aspectj-fa21e62717f87e3f84b74dcedc36d79951ec0751.tar.gz aspectj-fa21e62717f87e3f84b74dcedc36d79951ec0751.zip |
impl and test for dec precedence in aop.xml without extends
Diffstat (limited to 'tests/java5/ataspectj')
3 files changed, 91 insertions, 0 deletions
diff --git a/tests/java5/ataspectj/ataspectj/ConcreteAtAspectTest.java b/tests/java5/ataspectj/ataspectj/ConcreteAtAspectTest.java index 2d673ca9f..3aa5cea7a 100644 --- a/tests/java5/ataspectj/ataspectj/ConcreteAtAspectTest.java +++ b/tests/java5/ataspectj/ataspectj/ConcreteAtAspectTest.java @@ -17,6 +17,7 @@ import junit.framework.TestSuite; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.Aspects; /** * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> @@ -61,6 +62,15 @@ public class ConcreteAtAspectTest extends TestCase { assertEquals(3, I); } + public void tesCanLoad() { + try { + Class jitAspect = Class.forName("ataspectj.Foo"); + Object aspect = Aspects.aspectOf(jitAspect); + } catch (Throwable t) { + fail(t.toString()); + } + } + public static void main(String[] args) { TestHelper.runAndThrowOnFailure(suite()); } diff --git a/tests/java5/ataspectj/ataspectj/ConcretePrecedenceAspectTest.java b/tests/java5/ataspectj/ataspectj/ConcretePrecedenceAspectTest.java new file mode 100644 index 000000000..c873028b1 --- /dev/null +++ b/tests/java5/ataspectj/ataspectj/ConcretePrecedenceAspectTest.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2005 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package ataspectj; + +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class ConcretePrecedenceAspectTest extends TestCase { + + static String LOG = ""; + + void target() { + LOG = LOG + "target "; + } + + @Aspect + static class TestAspect_1 { + @Before("execution(* ataspectj.ConcretePrecedenceAspectTest.target())") + public void before() { + LOG = LOG + "1 "; + } + } + + @Aspect + static class TestAspect_2 { + @Before("execution(* ataspectj.ConcretePrecedenceAspectTest.target())") + public void before() { + LOG = LOG + "2 "; + } + } + + @Aspect + static class TestAspect_3 { + @Before("execution(* ataspectj.ConcretePrecedenceAspectTest.target())") + public void before() { + LOG = LOG + "3 "; + } + } + + public void testPrecedenceFromXML() { + LOG = ""; + target(); + assertEquals("2 3 1 target ", LOG); + } + + public static void main(String[] args) { + TestHelper.runAndThrowOnFailure(suite()); + } + + public static Test suite() { + return new TestSuite(ConcretePrecedenceAspectTest.class); + } + +} diff --git a/tests/java5/ataspectj/ataspectj/aop-concreteprecedenceaspect.xml b/tests/java5/ataspectj/ataspectj/aop-concreteprecedenceaspect.xml new file mode 100644 index 000000000..a3dbc3927 --- /dev/null +++ b/tests/java5/ataspectj/ataspectj/aop-concreteprecedenceaspect.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<aspectj> + <weaver options="-XmessageHandlerClass:ataspectj.TestHelper -1.5"/> + <aspects> + <concrete-aspect + name="ataspectj.Foo" + precedence="*..*_2, *..*_3, *..*_1"/> + <aspect name="ataspectj.ConcretePrecedenceAspectTest.TestAspect_1"/> + <aspect name="ataspectj.ConcretePrecedenceAspectTest.TestAspect_2"/> + <aspect name="ataspectj.ConcretePrecedenceAspectTest.TestAspect_3"/> + </aspects> +</aspectj> |