aboutsummaryrefslogtreecommitdiffstats
path: root/aspectj5rt/java5-testsrc
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-30 14:58:56 +0000
committeracolyer <acolyer>2005-09-30 14:58:56 +0000
commitf74a5c0fc3634f080b6a1714bb4d5b25df2a914b (patch)
treee5397b4f42b616043f48bd4a1d527bd5b04cb5e6 /aspectj5rt/java5-testsrc
parent5051f8e49ff9ca7009b9b9b2b510941e45389d05 (diff)
downloadaspectj-f74a5c0fc3634f080b6a1714bb4d5b25df2a914b.tar.gz
aspectj-f74a5c0fc3634f080b6a1714bb4d5b25df2a914b.zip
updates to reflection library (largely javadoc, but with a few small tweaks)
Diffstat (limited to 'aspectj5rt/java5-testsrc')
-rw-r--r--aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java10
-rw-r--r--aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java60
2 files changed, 36 insertions, 34 deletions
diff --git a/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java b/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java
index dde2f4fba..211da98c3 100644
--- a/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java
+++ b/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java
@@ -27,7 +27,7 @@ import org.aspectj.lang.reflect.AjTypeSystem;
public class AjTypeTests extends TestCase {
- private AjType stringType;
+ private AjType<String> stringType;
@Override
protected void setUp() throws Exception {
@@ -49,10 +49,10 @@ public class AjTypeTests extends TestCase {
public void testGetInterfaces() {
Class[] i1 = String.class.getInterfaces();
- Class[] i2 = stringType.getInterfaces();
+ AjType<?>[] i2 = stringType.getInterfaces();
assertEquals(i1.length,i2.length);
for (int i = 0; i < i1.length; i++)
- assertEquals(i1[i],i2[i]);
+ assertEquals(i1[i],i2[i].getJavaClass());
}
public void testGetModifiers() {
@@ -135,7 +135,7 @@ public class AjTypeTests extends TestCase {
public void testGetConstructor() throws Exception {
Constructor c1 = String.class.getConstructor(String.class);
- Constructor c2 = stringType.getConstructor(String.class);
+ Constructor c2 = stringType.getConstructor(stringType);
assertEquals(c1,c2);
}
@@ -149,7 +149,7 @@ public class AjTypeTests extends TestCase {
public void testGetDeclaredConstructor() throws Exception {
Constructor c1 = String.class.getDeclaredConstructor(String.class);
- Constructor c2 = stringType.getDeclaredConstructor(String.class);
+ Constructor c2 = stringType.getDeclaredConstructor(stringType);
assertEquals(c1,c2);
}
diff --git a/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java b/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java
index cb1520dba..a01287d0a 100644
--- a/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java
+++ b/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTestsWithAspects.java
@@ -28,7 +28,7 @@ import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.DeclareError;
import org.aspectj.lang.annotation.DeclareWarning;
import org.aspectj.lang.reflect.Advice;
-import org.aspectj.lang.reflect.AdviceType;
+import org.aspectj.lang.reflect.AdviceKind;
import org.aspectj.lang.reflect.AjType;
import org.aspectj.lang.reflect.AjTypeSystem;
import org.aspectj.lang.reflect.DeclareErrorOrWarning;
@@ -37,6 +37,8 @@ import org.aspectj.lang.reflect.NoSuchPointcutException;
import org.aspectj.lang.reflect.PerClause;
import org.aspectj.lang.reflect.PerClauseKind;
import org.aspectj.lang.reflect.Pointcut;
+import org.aspectj.lang.reflect.PointcutBasedPerClause;
+import org.aspectj.lang.reflect.TypePatternBasedPerClause;
public class AjTypeTestsWithAspects extends TestCase {
@@ -56,23 +58,23 @@ public class AjTypeTestsWithAspects extends TestCase {
PerClause pc = perThisA.getPerClause();
assertEquals(PerClauseKind.PERTHIS,pc.getKind());
- assertEquals("pc()",pc.getPointcutExpression().toString());
+ assertEquals("pc()",((PointcutBasedPerClause)pc).getPointcutExpression().asString());
pc= perTargetA.getPerClause();
assertEquals(PerClauseKind.PERTARGET,pc.getKind());
- assertEquals("pc()",pc.getPointcutExpression().toString());
+ assertEquals("pc()",((PointcutBasedPerClause)pc).getPointcutExpression().asString());
pc= perCflowA.getPerClause();
assertEquals(PerClauseKind.PERCFLOW,pc.getKind());
- assertEquals("pc()",pc.getPointcutExpression().toString());
+ assertEquals("pc()",((PointcutBasedPerClause)pc).getPointcutExpression().asString());
pc= perCflowbelowA.getPerClause();
assertEquals(PerClauseKind.PERCFLOWBELOW,pc.getKind());
- assertEquals("pc()",pc.getPointcutExpression().toString());
+ assertEquals("pc()",((PointcutBasedPerClause)pc).getPointcutExpression().asString());
pc= perTypeWithinA.getPerClause();
assertEquals(PerClauseKind.PERTYPEWITHIN,pc.getKind());
- assertEquals("org.aspectj..*",pc.getPointcutExpression().toString());
+ assertEquals("org.aspectj..*",((TypePatternBasedPerClause)pc).getTypePattern().asString());
}
@@ -148,13 +150,13 @@ public class AjTypeTestsWithAspects extends TestCase {
public void testGetDeclaredPointcut() throws Exception {
Pointcut p1 = sa.getDeclaredPointcut("simpleAspectMethodExecution");
assertEquals("simpleAspectMethodExecution",p1.getName());
- assertEquals("execution(* SimpleAspect.*(..))",p1.getPointcutExpression().toString());
+ assertEquals("execution(* SimpleAspect.*(..))",p1.getPointcutExpression().asString());
assertEquals(sa,p1.getDeclaringType());
assertEquals(0,p1.getParameterTypes().length);
assertTrue(Modifier.isPublic(p1.getModifiers()));
Pointcut p2 = sa.getDeclaredPointcut("simpleAspectCall");
assertEquals("simpleAspectCall",p2.getName());
- assertEquals("call(* SimpleAspect.*(..))",p2.getPointcutExpression().toString());
+ assertEquals("call(* SimpleAspect.*(..))",p2.getPointcutExpression().asString());
assertEquals(sa,p2.getDeclaringType());
assertEquals(1,p2.getParameterTypes().length);
assertTrue(Modifier.isPrivate(p2.getModifiers()));
@@ -169,13 +171,13 @@ public class AjTypeTestsWithAspects extends TestCase {
public void testGetPointcut() throws Exception {
Pointcut p1 = sa.getPointcut("simpleAspectMethodExecution");
assertEquals("simpleAspectMethodExecution",p1.getName());
- assertEquals("execution(* SimpleAspect.*(..))",p1.getPointcutExpression().toString());
+ assertEquals("execution(* SimpleAspect.*(..))",p1.getPointcutExpression().asString());
assertEquals(sa,p1.getDeclaringType());
assertEquals(0,p1.getParameterTypes().length);
assertTrue(Modifier.isPublic(p1.getModifiers()));
- Pointcut p2 = sa.getPointcut("simpleAspectCall");
+ Pointcut p2 = sa.getDeclaredPointcut("simpleAspectCall");
assertEquals("simpleAspectCall",p2.getName());
- assertEquals("call(* SimpleAspect.*(..))",p2.getPointcutExpression().toString());
+ assertEquals("call(* SimpleAspect.*(..))",p2.getPointcutExpression().asString());
assertEquals(sa,p2.getDeclaringType());
assertEquals(1,p2.getParameterTypes().length);
assertTrue(Modifier.isPrivate(p2.getModifiers()));
@@ -205,20 +207,20 @@ public class AjTypeTestsWithAspects extends TestCase {
public void testGetDeclaredAdvice() {
Advice[] advice = sa.getDeclaredAdvice();
assertEquals(10,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.BEFORE);
+ advice = sa.getDeclaredAdvice(AdviceKind.BEFORE);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AFTER);
+ advice = sa.getDeclaredAdvice(AdviceKind.AFTER);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AFTER_RETURNING);
+ advice = sa.getDeclaredAdvice(AdviceKind.AFTER_RETURNING);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AFTER_THROWING);
+ advice = sa.getDeclaredAdvice(AdviceKind.AFTER_THROWING);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AROUND);
+ advice = sa.getDeclaredAdvice(AdviceKind.AROUND);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.BEFORE,AdviceType.AFTER);
+ advice = sa.getDeclaredAdvice(AdviceKind.BEFORE,AdviceKind.AFTER);
assertEquals(4,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.BEFORE);
+ advice = sa.getDeclaredAdvice(AdviceKind.BEFORE);
// AV: corrupted test: cannot rely on ordering since a Set is used behind
Advice aone, atwo;
if (advice[0].getName()!=null && advice[0].getName().length()>0) {
@@ -230,7 +232,7 @@ public class AjTypeTestsWithAspects extends TestCase {
}
assertEquals("execution(* SimpleAspect.*(..))",aone.getPointcutExpression().toString());
assertEquals("logEntry",aone.getName());
- assertEquals(AdviceType.BEFORE,aone.getKind());
+ assertEquals(AdviceKind.BEFORE,aone.getKind());
assertEquals("execution(* SimpleAspect.*(..))",atwo.getPointcutExpression().toString());
assertEquals("",atwo.getName());
}
@@ -238,27 +240,27 @@ public class AjTypeTestsWithAspects extends TestCase {
public void testGetAdvice() {
Advice[] advice = sa.getDeclaredAdvice();
assertEquals(10,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.BEFORE);
+ advice = sa.getDeclaredAdvice(AdviceKind.BEFORE);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AFTER);
+ advice = sa.getDeclaredAdvice(AdviceKind.AFTER);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AFTER_RETURNING);
+ advice = sa.getDeclaredAdvice(AdviceKind.AFTER_RETURNING);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AFTER_THROWING);
+ advice = sa.getDeclaredAdvice(AdviceKind.AFTER_THROWING);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.AROUND);
+ advice = sa.getDeclaredAdvice(AdviceKind.AROUND);
assertEquals(2,advice.length);
- advice = sa.getDeclaredAdvice(AdviceType.BEFORE,AdviceType.AFTER);
+ advice = sa.getDeclaredAdvice(AdviceKind.BEFORE,AdviceKind.AFTER);
assertEquals(4,advice.length);
}
public void testGetNamedAdvice() throws Exception {
Advice a = sa.getAdvice("logItAll");
assertEquals("logItAll",a.getName());
- assertEquals(AdviceType.AROUND,a.getKind());
+ assertEquals(AdviceKind.AROUND,a.getKind());
a = sa.getAdvice("whatGoesAround");
assertEquals("whatGoesAround",a.getName());
- assertEquals(AdviceType.AROUND,a.getKind());
+ assertEquals(AdviceKind.AROUND,a.getKind());
try {
a = sa.getAdvice("ajc$after$123");
fail("Expecting NoSuchAdviceException");
@@ -276,10 +278,10 @@ public class AjTypeTestsWithAspects extends TestCase {
public void testGetNamedDeclaredAdvice() throws Exception {
Advice a = sa.getDeclaredAdvice("logItAll");
assertEquals("logItAll",a.getName());
- assertEquals(AdviceType.AROUND,a.getKind());
+ assertEquals(AdviceKind.AROUND,a.getKind());
a = sa.getDeclaredAdvice("whatGoesAround");
assertEquals("whatGoesAround",a.getName());
- assertEquals(AdviceType.AROUND,a.getKind());
+ assertEquals(AdviceKind.AROUND,a.getKind());
try {
a = sa.getDeclaredAdvice("ajc$after$123");
fail("Expecting NoSuchAdviceException");