aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/ataspectj
diff options
context:
space:
mode:
authoravasseur <avasseur>2005-09-28 10:12:00 +0000
committeravasseur <avasseur>2005-09-28 10:12:00 +0000
commite24482630a4dc558528537c87dbd3165c078cf92 (patch)
tree2a005af320c3ce50be056fc4f5e0ccc328394669 /tests/java5/ataspectj
parent64da2cd84875f49f5745722a4aad15a3c3128b35 (diff)
downloadaspectj-e24482630a4dc558528537c87dbd3165c078cf92.tar.gz
aspectj-e24482630a4dc558528537c87dbd3165c078cf92.zip
test for Adrian, #108488 - note: other test are commented out
Diffstat (limited to 'tests/java5/ataspectj')
-rw-r--r--tests/java5/ataspectj/ataspectj/PerClauseTest.java25
-rw-r--r--tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java14
2 files changed, 36 insertions, 3 deletions
diff --git a/tests/java5/ataspectj/ataspectj/PerClauseTest.java b/tests/java5/ataspectj/ataspectj/PerClauseTest.java
index 08e019489..dfb529dcd 100644
--- a/tests/java5/ataspectj/ataspectj/PerClauseTest.java
+++ b/tests/java5/ataspectj/ataspectj/PerClauseTest.java
@@ -62,7 +62,7 @@ public class PerClauseTest extends TestCase {
log("perTarget");
}
- public void testPerTarget() {
+ public void xtestPerTarget() {
s_log = new StringBuffer();
perTarget();
assertEquals("AOP.perTarget perTarget ", s_log.toString());
@@ -121,7 +121,7 @@ public class PerClauseTest extends TestCase {
log("perCflow");
}
- public void testPerCflow() throws Throwable {
+ public void xtestPerCflow() throws Throwable {
s_log = new StringBuffer();
// no aspect bound yet
@@ -177,7 +177,7 @@ public class PerClauseTest extends TestCase {
assertEquals(2, PerClauseTestAspects.TestAspectPerCflow.s_count);
}
- public void testPerTypeWithin() {
+ public void xtestPerTypeWithin() {
assertTrue(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTW1.class));
assertTrue(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTW2.class));
assertFalse(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTWNoMatch.class));
@@ -213,4 +213,23 @@ public class PerClauseTest extends TestCase {
static class PTWNoMatch {
static void foo() {};
}
+
+ public void testPerThis() {
+ assertEquals(0, PerClauseTestAspects.TestAspectPerThis.s_count);
+
+ PerThis i1 = new PerThis();
+ i1.foo();
+ assertEquals(1, PerClauseTestAspects.TestAspectPerThis.s_count);
+ i1.foo();
+ assertEquals(1, PerClauseTestAspects.TestAspectPerThis.s_count);
+
+ new PerThis().foo();
+ assertEquals(2, PerClauseTestAspects.TestAspectPerThis.s_count);
+
+ assertEquals(3, PerClauseTestAspects.TestAspectPerThis.a_count);
+ }
+
+ static class PerThis {
+ void foo() {};
+ }
}
diff --git a/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java b/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java
index 175eb79ce..414e52573 100644
--- a/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java
+++ b/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java
@@ -78,7 +78,21 @@ public class PerClauseTestAspects {
public void before(JoinPoint jp) {
;
}
+ }
+
+ @Aspect("perthis(this(ataspectj.PerClauseTest.PerThis))")
+ public static class TestAspectPerThis {
+ static int s_count;
+ static int a_count;
+
+ public TestAspectPerThis() {
+ s_count++;
+ }
+ @Before("execution(* ataspectj.PerClauseTest.PerThis.foo())")
+ public void before(JoinPoint jp) {
+ a_count++;
+ }
}