[Jboss-cvs] JBossAS SVN: r56807 - in trunk: aop/src/main/org/jboss/aop/instrument testsuite/src/main/org/jboss/test/aop/scopedextender testsuite/src/main/org/jboss/test/aop/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 13 13:39:22 EDT 2006


Author: kabir.khan at jboss.com
Date: 2006-09-13 13:39:10 -0400 (Wed, 13 Sep 2006)
New Revision: 56807

Modified:
   trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorFieldAccessTransformer.java
   trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
   trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java
   trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java
   trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java
Log:
[JBAOP-257] Get field interception working for subclasses in a deployment using scoped classloaders extending classes deployed in the global classloading domain.

Methods and fields now work, still need to test fields.


Modified: trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -322,6 +322,7 @@
       private void addMethodInfoField()throws CannotCompileException
       {
          CtField infoField = new CtField(constructorInfoClass, INFO_FIELD, jp);
+         infoField.setModifiers(javassist.Modifier.PROTECTED);//Make visible to classes in child classloaders
          jp.addField(infoField);
       }
 

Modified: trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -348,6 +348,7 @@
       private void addMethodInfoField()throws CannotCompileException
       {
          CtField infoField = new CtField(constructorInfoClass, INFO_FIELD, jp);
+         infoField.setModifiers(javassist.Modifier.PROTECTED);//Make visible to classes in child classloaders
          jp.addField(infoField);
       }
 

Modified: trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -314,6 +314,7 @@
       private void addConstructionInfoField()throws CannotCompileException
       {
          CtField infoField = new CtField(constructionInfoClass, INFO_FIELD, jp);
+         infoField.setModifiers(javassist.Modifier.PROTECTED);//Make visible to classes in child classloaders
          jp.addField(infoField);
       }
 

Modified: trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -288,6 +288,7 @@
       private void addMethodInfoField()throws CannotCompileException
       {
          CtField infoField = new CtField(constructorInfoClass, INFO_FIELD, jp);
+         infoField.setModifiers(javassist.Modifier.PROTECTED);//Make visible to classes in child classloaders
          jp.addField(infoField);
       }
 

Modified: trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -254,6 +254,18 @@
          return jp;
       }
 
+      private static String debugFields(CtClass clazz) throws NotFoundException
+      {
+         StringBuffer sb = new StringBuffer();
+         sb.append(clazz.getName());
+         CtField[] fields = clazz.getFields();
+         for (int i = 0 ; i < fields.length ; i++)
+         {
+            sb.append("\n\t\t\t\t" + Modifier.toString(fields[i].getModifiers()) + " " + fields[i].getName() + " " + fields[i].getType());
+         }
+         
+         return sb.toString();
+      }
 
       private CtClass setupClass()throws NotFoundException, CannotCompileException
       {
@@ -320,6 +332,7 @@
       private void addFieldInfoField()throws CannotCompileException
       {
          CtField infoField = new CtField(fieldInfoClass, INFO_FIELD, jp);
+         infoField.setModifiers(javassist.Modifier.PROTECTED);//Make visible to classes in child classloaders
          jp.addField(infoField);
       }
 

Modified: trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorFieldAccessTransformer.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorFieldAccessTransformer.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorFieldAccessTransformer.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -262,6 +262,7 @@
       {
          code =
             "{" +
+"System.out.println(\"**** Reading field" + field.getName() + " \");" +            
             "   if (" + infoName + " == null && " + generatorName + " != null)" +
             "   {" +
             "   " + generatorName + "." + JoinPointGenerator.GENERATE_JOINPOINT_CLASS + "();" +
@@ -280,6 +281,7 @@
       {
          code =
             "{" +
+"System.out.println(\"**** Reading field" + field.getName() + " \");" +            
             "   if (" + infoName + " == null && " + generatorName + " != null)" +
             "   {" +
             "   " + generatorName + "." + JoinPointGenerator.GENERATE_JOINPOINT_CLASS + "();" +

Modified: trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -530,7 +530,13 @@
       try
       {
          AOPClassPool pool = AOPClassPool.createAOPClassPool(clazz.getClassPool(), AOPClassPoolRepository.getInstance());
-
+         
+//         if (clazz.getName().startsWith("org.jboss.test.aop.scopedextender."))
+//         {
+//            //Debug
+//            System.out.println("========> Converting references for " + clazz.getName() + " in " + clazz.getClassPool());
+//            System.out.println("---> Created temp pool " + pool);
+//         }
          Iterator it = clazz.getRefClasses().iterator();
          while (it.hasNext())
          {
@@ -563,11 +569,19 @@
 
             ClassAdvisor advisor = manager.getTempClassAdvisor(ctRef);
             
+//            if (clazz.getName().startsWith("org.jboss.test.aop.scopedextender."))
+//            {
+//               //Debug
+//               System.out.println("---> Found class " + ctRef.getName() + " in " + ctRef.getClassPool());
+//               System.out.println("---> Using manager " + manager + " should convert fields " + !manager.shouldSkipFieldAccess(ref));
+//            }
+            
             if (!manager.shouldSkipFieldAccess(ref) && !ref.equals(clazz.getName()))
             {
                List fields = getAdvisableFields(ctRef);
                if (fieldAccessTransformer.replaceFieldAccess(fields, ctRef, advisor))
                {
+//                  System.out.println("---> !!!Replaced field access!!!");
                   manager.addFieldInterceptionMarker(ref);
                   converted = true;
                }

Modified: trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -23,8 +23,6 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
-import java.net.URL;
-import java.net.URLClassLoader;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
@@ -52,10 +50,8 @@
 import org.jboss.aop.advice.GeneratedAdvisorInterceptor;
 import org.jboss.aop.advice.Scope;
 import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.Joinpoint;
 import org.jboss.aop.pointcut.ast.ASTCFlowExpression;
 import org.jboss.aop.pointcut.ast.ClassExpression;
-import org.jboss.aop.standalone.Compiler;
 import org.jboss.aop.util.JavassistUtils;
 import org.jboss.aop.util.ReflectToJavassist;
 
@@ -199,7 +195,24 @@
    private Object instantiateClass(Class clazz, AdviceSetup[] aroundSetups) throws Exception
    {
       Constructor ctor = clazz.getConstructor(new Class[] {info.getClass()});
-      Object obj = ctor.newInstance(new Object[] {info});
+      Object obj;
+      try
+      {
+         obj = ctor.newInstance(new Object[] {info});
+      }
+      catch (Exception e)
+      {
+         StringBuffer sb = new StringBuffer();
+         sb.append("\n\t\t" + Modifier.toString(clazz.getModifiers()) + " " + clazz.getName() + " " + clazz.getClassLoader() + "\n\t\t\textends\n");
+         clazz = clazz.getSuperclass();
+         sb.append("\t\t" + Modifier.toString(clazz.getModifiers()) + " " + clazz.getName() + " " + clazz.getClassLoader() + "\n");
+         Field[] fields = clazz.getDeclaredFields();
+         for (int i = 0 ; i < fields.length ; i++)
+         {
+            sb.append("\n\t\t\t" + Modifier.toString(fields[i].getModifiers()) + " " + fields[i].getType().getName() + " " + fields[i].getName() + " " + fields[i].getType().getClassLoader());
+         }
+         throw new RuntimeException(sb.toString(), e);
+      }
       
       for (int i = 0 ; i < aroundSetups.length ; i++)
       {
@@ -387,6 +400,8 @@
       {
          return
             "{" +
+//"System.out.println(\"xxxx ME \" + this.getClass().getName() + this.getClass().getClassLoader());" +            
+//"System.out.println(\"xxxx SUPER \" + super.getClass().getName() + super.getClass().getClassLoader());" +            
             "   if (" + setup.getAspectFieldName() + " != null)" +
             "   {" +
             "      return " + setup.getAspectFieldName() + ";" +

Modified: trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -354,6 +354,7 @@
       private void addMethodInfoField()throws CannotCompileException
       {
          CtField infoField = new CtField(methodInfoClass, INFO_FIELD, jp);
+         infoField.setModifiers(javassist.Modifier.PROTECTED);//Make visible to classes in child classloaders
          jp.addField(infoField);
       }
 

Modified: trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -361,6 +361,7 @@
       private void addMethodInfoField()throws CannotCompileException
       {
          CtField infoField = new CtField(methodInfoClass, INFO_FIELD, jp);
+         infoField.setModifiers(javassist.Modifier.PROTECTED);//Make visible to classes in child classloaders
          jp.addField(infoField);
       }
 

Modified: trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -332,7 +332,7 @@
       {
          CtField infoField = new CtField(methodInfoClass, INFO_FIELD, jp);
          jp.addField(infoField);
-         infoField.setModifiers(Modifier.PROTECTED | Modifier.TRANSIENT);
+         infoField.setModifiers(Modifier.PROTECTED | Modifier.TRANSIENT);//Make visible to classes in child classloaders
       }      
       
       private void addDispatchMethods() throws CannotCompileException, NotFoundException

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -23,6 +23,8 @@
 
 import java.util.ArrayList;
 
+import org.jboss.aop.joinpoint.FieldReadInvocation;
+import org.jboss.aop.joinpoint.FieldWriteInvocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
 
 /**
@@ -39,4 +41,16 @@
       invoked.add(invocation.getMethod().getName());
       return invocation.invokeNext();
    }
+
+   public Object invoke(FieldReadInvocation invocation) throws Throwable
+   {
+      invoked.add(invocation.getField().getName());
+      return invocation.invokeNext();
+   }
+
+   public Object invoke(FieldWriteInvocation invocation) throws Throwable
+   {
+      invoked.add(invocation.getField().getName());
+      return invocation.invokeNext();
+   }
 }

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -106,18 +106,50 @@
 
    public void testField() throws Exception
    {
+      TestUtil testUtil = new TestUtil();
       try
       {
          System.out.println("=============== BaseLoadedTester - FIELD ================");
+         Base_Base base = new Base_Base();
+         
+         BaseAspect.invoked.clear();
+         base.base = 5;
+         String m = "Base_Base.base";
+         testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+         
+         BaseAspect.invoked.clear();
+         testUtil.compare(5, base.base);
+         testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+         
+         
+         Base_A1 a1 = new Base_A1();
+
+         BaseAspect.invoked.clear();
+         a1.a1 = 10;
+         m = "Base_A1.a1";
+         testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+
+         BaseAspect.invoked.clear();
+         testUtil.compare(10, a1.a1);
+         testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
       }
       catch (RuntimeException e)
       {
          // AutoGenerated
          throw new RuntimeException(e);
       }
-      throw new Exception("Not yet implemented");
-   }
 
+      if (testUtil.getErrors() != null)
+      {
+         throw new RuntimeException(testUtil.getErrors());
+      }
+
+      if(Advised.class.isAssignableFrom(BaseNotBaseWoven.class))
+      {
+         throw new RuntimeException("BaseNotBaseWoven should not be woven");
+      }
+}
+
    public String readName()
    {
       return "BaseLoadedTester";

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -28,6 +28,8 @@
  */
 public class BaseNotBaseWoven
 {
+   int field;
+   
    public void notWovenInBase()
    {
       

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -23,6 +23,8 @@
 
 import java.util.ArrayList;
 
+import org.jboss.aop.joinpoint.FieldReadInvocation;
+import org.jboss.aop.joinpoint.FieldWriteInvocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
 
 /**
@@ -39,4 +41,17 @@
       invoked.add(invocation.getMethod().getName());
       return invocation.invokeNext();
    }
+   
+   public Object invoke(FieldReadInvocation invocation) throws Throwable
+   {
+      invoked.add(invocation.getField().getName());
+      return invocation.invokeNext();
+   }
+
+   public Object invoke(FieldWriteInvocation invocation) throws Throwable
+   {
+      invoked.add(invocation.getField().getName());
+      return invocation.invokeNext();
+   }
+   
 }

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -23,6 +23,8 @@
 
 import java.util.ArrayList;
 
+import org.jboss.aop.joinpoint.FieldReadInvocation;
+import org.jboss.aop.joinpoint.FieldWriteInvocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
 
 /**
@@ -39,4 +41,17 @@
       invoked.add(invocation.getMethod().getName());
       return invocation.invokeNext();
    }
+
+   public Object invoke(FieldReadInvocation invocation) throws Throwable
+   {
+      invoked.add(invocation.getField().getName());
+      return invocation.invokeNext();
+   }
+
+   public Object invoke(FieldWriteInvocation invocation) throws Throwable
+   {
+      invoked.add(invocation.getField().getName());
+      return invocation.invokeNext();
+   }
+   
 }

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -197,16 +197,181 @@
 
    public void testField() throws Exception
    {
-      try
+      TestUtil testUtil = new TestUtil();
+      System.out.println("=============== ScopedChildNoParentDelegationTester - FIELD ================");
+      Child_A3 a3 = new Child_A3();
+      
+      clear();
+      a3.a3 = 10;
+      String m = "Child_A3.a3";
+      testUtil.compare(m, "ChildAspect", new String[]{"a3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a3"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.a3);
+      testUtil.compare(m, "ChildAspect", new String[]{"a3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a3"}, BaseParentAspect.invoked);
+      
+      clear();
+      a3.a2 = 10;
+      m = "Child_A3.a2";
+      testUtil.compare(m, "ChildAspect", new String[]{"a2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a2"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.a2);
+      testUtil.compare(m, "ChildAspect", new String[]{"a2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a2"}, BaseParentAspect.invoked);
+      
+      clear();
+      a3.a1 = 10;
+      m = "Child_A3.a1";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a1"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.a1);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a1"}, BaseParentAspect.invoked);
+      
+      clear();
+      a3.base = 10;
+      m = "Child_A3.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      
+      //Base_A1 overrides the version from parent/global ucl, so aspects deployed by us should apply to its methods
+      Base_A1 a1 = new Base_A1();
+
+      clear();
+      a1.a1 = 10;
+      m = "Base_A1.a1";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a1"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a1.a1);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a1"}, BaseParentAspect.invoked);
+      
+      clear();
+      a1.base = 10;
+      m = "Base_A1.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a1.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+
+      //Base_A1 overrides the version from parent/global ucl, so aspects deployed by us should apply to its methods
+      Base_Base base = new Base_Base();
+
+      clear();
+      base.base = 10;
+      m = "Base_Base.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, base.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+
+
+      Child_B3 b3 = new Child_B3();
+      
+      clear();
+      b3.b3 = 10;
+      m = "Child_B3.b3";
+      testUtil.compare(m, "ChildAspect", new String[]{"b3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b3"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.b3);
+      testUtil.compare(m, "ChildAspect", new String[]{"b3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b3"}, BaseParentAspect.invoked);
+      
+      clear();
+      b3.b2 = 10;
+      m = "Child_B3.b2";
+      testUtil.compare(m, "ChildAspect", new String[]{"b2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b2"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.b2);
+      testUtil.compare(m, "ChildAspect", new String[]{"b2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b2"}, BaseParentAspect.invoked);
+      
+      clear();
+      b3.b1 = 10;
+      m = "Child_B3.b1";
+      testUtil.compare(m, "ChildAspect", new String[]{"b1"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b1"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.b1);
+      testUtil.compare(m, "ChildAspect", new String[]{"b1"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b1"}, BaseParentAspect.invoked);
+      
+      clear();
+      b3.base = 10;
+      m = "Child_B3.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+
+      BaseNotBaseWoven bnbw = new BaseNotBaseWoven();
+      clear();
+      m = "BaseNotBaseWoven.field";
+      bnbw.field = 100;
+      testUtil.compare(m, "ChildAspect", new String[]{"field"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"field"}, BaseParentAspect.invoked);
+
+      clear();
+      testUtil.compare(100, bnbw.field);
+      testUtil.compare(m, "ChildAspect", new String[]{"field"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"field"}, BaseParentAspect.invoked);
+
+      if (testUtil.getErrors() != null)
       {
-         System.out.println("=============== ScopedChildNoParentDelegationTester - FIELD ================");
+         throw new RuntimeException(testUtil.getErrors());
       }
-      catch (RuntimeException e)
-      {
-         // AutoGenerated
-         throw new RuntimeException(e);
-      }
-      throw new Exception("Not yet implemented");
    }
 
    public String readName()

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -196,16 +196,168 @@
 
    public void testField() throws Exception
    {
-      try
+      TestUtil testUtil = new TestUtil();
+      System.out.println("=============== ScopedChildNoParentDelegationTester - FIELD ================");
+      Child_A3 a3 = new Child_A3();
+      
+      clear();
+      a3.a3 = 10;
+      String m = "Child_A3.a3";
+      testUtil.compare(m, "ChildAspect", new String[]{"a3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a3"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.a3);
+      testUtil.compare(m, "ChildAspect", new String[]{"a3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a3"}, BaseParentAspect.invoked);
+      
+      clear();
+      a3.a2 = 10;
+      m = "Child_A3.a2";
+      testUtil.compare(m, "ChildAspect", new String[]{"a2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a2"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.a2);
+      testUtil.compare(m, "ChildAspect", new String[]{"a2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a2"}, BaseParentAspect.invoked);
+      
+      clear();
+      a3.a1 = 10;
+      m = "Child_A3.a1";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a1"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.a1);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"a1"}, BaseParentAspect.invoked);
+      
+      clear();
+      a3.base = 10;
+      m = "Child_A3.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a3.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      
+      //Base_A1 is from parent/global ucl, so aspects deployed by us should not apply to its fields
+      Base_A1 a1 = new Base_A1();
+
+      clear();
+      a1.a1 = 10;
+      m = "Base_A1.a1";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a1.a1);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"a1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+      
+      clear();
+      a1.base = 10;
+      m = "Base_A1.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, a1.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+
+      //Base_A1 is from parent/global ucl, so aspects deployed by us should not apply to its fields
+      Base_Base base = new Base_Base();
+
+      clear();
+      base.base = 10;
+      m = "Base_Base.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, base.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+
+
+
+      Child_B3 b3 = new Child_B3();
+      
+      clear();
+      b3.b3 = 10;
+      m = "Child_B3.b3";
+      testUtil.compare(m, "ChildAspect", new String[]{"b3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b3"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.b3);
+      testUtil.compare(m, "ChildAspect", new String[]{"b3"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b3"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b3"}, BaseParentAspect.invoked);
+      
+      clear();
+      b3.b2 = 10;
+      m = "Child_B3.b2";
+      testUtil.compare(m, "ChildAspect", new String[]{"b2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b2"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.b2);
+      testUtil.compare(m, "ChildAspect", new String[]{"b2"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b2"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b2"}, BaseParentAspect.invoked);
+      
+      clear();
+      b3.b1 = 10;
+      m = "Child_B3.b1";
+      testUtil.compare(m, "ChildAspect", new String[]{"b1"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b1"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.b1);
+      testUtil.compare(m, "ChildAspect", new String[]{"b1"}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"b1"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"b1"}, BaseParentAspect.invoked);
+      
+      clear();
+      b3.base = 10;
+      m = "Child_B3.base";
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+      
+      clear();
+      testUtil.compare(10, b3.base);
+      testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+      testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+      testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+
+      if (testUtil.getErrors() != null)
       {
-         System.out.println("=============== ScopedChildParentDelegationTester - FIELD ================");
-      }
-      catch (RuntimeException e)
-      {
-         // AutoGenerated
-         throw new RuntimeException(e);
-      }
-      throw new Exception("Not yet implemented");
+         throw new RuntimeException(testUtil.getErrors());
+      }   
    }
 
    public String readName()

Modified: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -33,6 +33,12 @@
 public class TestUtil
 {
    StringBuffer errors;
+   
+   public void compare(int expected, int actual)
+   {
+      if (expected != actual) throw new RuntimeException("Expected " + expected + " but was " + actual);
+   }
+   
    public void compare(String method, String aspect, String[] expect, ArrayList actual)
    {
       List expected = Arrays.asList(expect);

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java	2006-09-13 17:26:37 UTC (rev 56806)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java	2006-09-13 17:39:10 UTC (rev 56807)
@@ -74,16 +74,16 @@
       invokeMethodTest(CHILD_NAME);
    }
    
-//   public void testBaseField() throws Exception
-//   {
-//      invokeFieldTest(BASE_NAME);
-//   }
-//   
-//   public void testChildField() throws Exception
-//   {
-//      invokeFieldTest(CHILD_NAME);
-//   }
-//   
+   public void testBaseField() throws Exception
+   {
+      invokeFieldTest(BASE_NAME);
+   }
+   
+   public void testChildField() throws Exception
+   {
+      invokeFieldTest(CHILD_NAME);
+   }
+   
 //   public void testBaseConstructor() throws Exception
 //   {
 //      invokeConstructorTest(BASE_NAME);
@@ -93,7 +93,7 @@
 //   {
 //      invokeConstructorTest(CHILD_NAME);
 //   }
-   
+//   
    private void invokeMethodTest(String objName) throws Exception
    {
       invoke(objName, "testMethod");




More information about the jboss-cvs-commits mailing list