summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoravasseur <avasseur>2005-10-27 11:43:16 +0000
committeravasseur <avasseur>2005-10-27 11:43:16 +0000
commitfa21e62717f87e3f84b74dcedc36d79951ec0751 (patch)
tree2a9232ab0cb358747e2a6b7be627eae90d7e4dcc /tests
parentf202157faad53d040e13da63ef7a3a4472a72ce4 (diff)
downloadaspectj-fa21e62717f87e3f84b74dcedc36d79951ec0751.tar.gz
aspectj-fa21e62717f87e3f84b74dcedc36d79951ec0751.zip
impl and test for dec precedence in aop.xml without extends
Diffstat (limited to 'tests')
-rw-r--r--tests/java5/ataspectj/ataspectj/ConcreteAtAspectTest.java10
-rw-r--r--tests/java5/ataspectj/ataspectj/ConcretePrecedenceAspectTest.java69
-rw-r--r--tests/java5/ataspectj/ataspectj/aop-concreteprecedenceaspect.xml12
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml8
5 files changed, 103 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>
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
index 49e9e7850..ae8f478f7 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
@@ -102,6 +102,10 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase {
runTest("ConcreteAspect");
}
+ public void testConcretePrecedenceAspect() {
+ runTest("ConcretePrecedenceAspect");
+ }
+
public void testAspectOfWhenAspectNotInInclude() {
runTest("AspectOfWhenAspectNotInInclude");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
index 257d56805..dcb9f3918 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
@@ -147,6 +147,14 @@
<run class="ataspectj.ConcreteAspectTest" ltw="ataspectj/aop-concreteaspect.xml"/>
</ajc-test>
+ <ajc-test dir="java5/ataspectj" title="ConcretePrecedenceAspect">
+ <compile
+ files="ataspectj/ConcretePrecedenceAspectTest.java,ataspectj/TestHelper.java"
+ options="-1.5 -Xdev:NoAtAspectJProcessing -XnoWeave"
+ />
+ <run class="ataspectj.ConcretePrecedenceAspectTest" ltw="ataspectj/aop-concreteprecedenceaspect.xml"/>
+ </ajc-test>
+
<ajc-test dir="java5/ataspectj" title="AspectOfWhenAspectNotInInclude">
<compile
files="ataspectj/bugs/AspectOfWhenAspectNotInIncludeTest.java,ataspectj/TestHelper.java"