From fa21e62717f87e3f84b74dcedc36d79951ec0751 Mon Sep 17 00:00:00 2001 From: avasseur Date: Thu, 27 Oct 2005 11:43:16 +0000 Subject: impl and test for dec precedence in aop.xml without extends --- .../ataspectj/ataspectj/ConcreteAtAspectTest.java | 10 ++++ .../ataspectj/ConcretePrecedenceAspectTest.java | 69 ++++++++++++++++++++++ .../ataspectj/aop-concreteprecedenceaspect.xml | 12 ++++ 3 files changed, 91 insertions(+) create mode 100644 tests/java5/ataspectj/ataspectj/ConcretePrecedenceAspectTest.java create mode 100644 tests/java5/ataspectj/ataspectj/aop-concreteprecedenceaspect.xml (limited to 'tests/java5/ataspectj') 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 Alexandre Vasseur @@ -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 Alexandre Vasseur + */ +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 @@ + + + + + + + + + + -- cgit v1.2.3