diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/options11 | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/new/options11')
-rw-r--r-- | tests/new/options11/Aspect.java | 43 | ||||
-rw-r--r-- | tests/new/options11/Main.java | 11 | ||||
-rw-r--r-- | tests/new/options11/aspectlib1.jar | bin | 0 -> 1145 bytes | |||
-rw-r--r-- | tests/new/options11/aspectlib2.jar | bin | 0 -> 934 bytes | |||
-rw-r--r-- | tests/new/options11/injar.jar | bin | 0 -> 363 bytes | |||
-rw-r--r-- | tests/new/options11/injar/Injar.java | 6 | ||||
-rw-r--r-- | tests/new/options11/library1/Library1.java | 23 | ||||
-rw-r--r-- | tests/new/options11/library2/Library2.java | 20 |
8 files changed, 103 insertions, 0 deletions
diff --git a/tests/new/options11/Aspect.java b/tests/new/options11/Aspect.java new file mode 100644 index 000000000..e0c56f519 --- /dev/null +++ b/tests/new/options11/Aspect.java @@ -0,0 +1,43 @@ + + +import org.aspectj.testing.Tester; +import org.aspectj.lang.JoinPoint; + +import library1.Library1; +import library2.Library2; + +/** extend abstract, and implement needed */ +aspect AnotherAspect extends Library2 { + + pointcut targetJoinPoints() : + execution(public static void Main.main(..)); + + protected String renderId(JoinPoint jp) { + String result = super.renderId(jp); + return result + " - ok"; + } +} + +class Testing { + static aspect Init { + + declare dominates : Init, Library1, AnotherAspect; + + before() : AnotherAspect.targetJoinPoints() { + Main.i = 1; + Tester.expectEvent("before main"); + Tester.expectEvent("after main"); + Tester.expectEvent("after 2 main - ok"); + Tester.expectEvent("before 2 main - ok"); + Tester.expectEvent("before run"); + } + after () returning : AnotherAspect.targetJoinPoints() { + Tester.checkAllEvents(); + } + + before() : call(void run()) { + Tester.event("before run"); + } + } + +}
\ No newline at end of file diff --git a/tests/new/options11/Main.java b/tests/new/options11/Main.java new file mode 100644 index 000000000..cfefc7b90 --- /dev/null +++ b/tests/new/options11/Main.java @@ -0,0 +1,11 @@ + + +import org.aspectj.testing.Tester; + +public class Main { + static int i = 0; + public static void main(String[] args) { + new injar.Injar().run(); + Tester.check(i != 0, "aspect failed"); + } +}
\ No newline at end of file diff --git a/tests/new/options11/aspectlib1.jar b/tests/new/options11/aspectlib1.jar Binary files differnew file mode 100644 index 000000000..31e101889 --- /dev/null +++ b/tests/new/options11/aspectlib1.jar diff --git a/tests/new/options11/aspectlib2.jar b/tests/new/options11/aspectlib2.jar Binary files differnew file mode 100644 index 000000000..20a22aa46 --- /dev/null +++ b/tests/new/options11/aspectlib2.jar diff --git a/tests/new/options11/injar.jar b/tests/new/options11/injar.jar Binary files differnew file mode 100644 index 000000000..2003bdc86 --- /dev/null +++ b/tests/new/options11/injar.jar diff --git a/tests/new/options11/injar/Injar.java b/tests/new/options11/injar/Injar.java new file mode 100644 index 000000000..02123001d --- /dev/null +++ b/tests/new/options11/injar/Injar.java @@ -0,0 +1,6 @@ + +package injar; + +public class Injar { + public void run() {} +}
\ No newline at end of file diff --git a/tests/new/options11/library1/Library1.java b/tests/new/options11/library1/Library1.java new file mode 100644 index 000000000..ce2a13067 --- /dev/null +++ b/tests/new/options11/library1/Library1.java @@ -0,0 +1,23 @@ + +package library1; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.testing.Tester; + +public aspect Library1 { + pointcut targetJoinPoints() : + //execution(public static void main(String[])); + execution(public static void main(..)); + + before() : targetJoinPoints() { + Tester.event("before " + renderId(thisJoinPoint)); + } + + before() : targetJoinPoints() { + Tester.event("after " + renderId(thisJoinPoint)); + } + + protected String renderId(JoinPoint jp) { + return jp.getSignature().getName(); + } +}
\ No newline at end of file diff --git a/tests/new/options11/library2/Library2.java b/tests/new/options11/library2/Library2.java new file mode 100644 index 000000000..989dafb3c --- /dev/null +++ b/tests/new/options11/library2/Library2.java @@ -0,0 +1,20 @@ + +package library2; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.testing.Tester; + +public abstract aspect Library2 { + abstract pointcut targetJoinPoints(); + + before() : targetJoinPoints() { + Tester.event("before 2 " + renderId(thisJoinPoint)); + } + + before() : targetJoinPoints() { + Tester.event("after 2 " + renderId(thisJoinPoint)); + } + protected String renderId(JoinPoint jp) { + return jp.getSignature().getName(); + } +}
\ No newline at end of file |