[jboss-cvs] JBossAS SVN: r60550 - in branches/Branch_4_0: testsuite and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 14 14:26:35 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-02-14 14:26:35 -0500 (Wed, 14 Feb 2007)
New Revision: 60550

Added:
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml
   branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml
Modified:
   branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/AspectDeployer.java
   branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java
   branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java
   branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java
   branches/Branch_4_0/testsuite/build.xml
   branches/Branch_4_0/testsuite/imports/sections/aop.xml
Log:
Update jboss aop to 1.5 snapshot, basically what will go in 1.5.4.GA[JBAOP-356] Ability to attach a .aop deployment to a particular scoped classloader.

Register ScopedClassLoaderDomains per LoaderRepository instead of per (scoped) classloader.



Modified: branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/AspectDeployer.java
===================================================================
--- branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/AspectDeployer.java	2007-02-14 19:14:24 UTC (rev 60549)
+++ branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/AspectDeployer.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -22,13 +22,21 @@
 package org.jboss.aop.deployment;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.Iterator;
 
+import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
+import javax.management.MBeanInfo;
 import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.Notification;
 import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.jboss.aop.AspectAnnotationLoader;
 import org.jboss.aop.AspectManager;
@@ -38,8 +46,18 @@
 import org.jboss.deployment.DeploymentState;
 import org.jboss.deployment.SubDeployer;
 import org.jboss.deployment.SubDeployerSupport;
+import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
+import org.jboss.mx.loading.LoaderRepository;
+import org.jboss.mx.loading.RepositoryClassLoader;
 import org.jboss.util.file.ArchiveBrowser;
 import org.jboss.util.file.ClassFileFilter;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
 
 /**
  * Deployer for Aspects
@@ -288,7 +306,7 @@
       return docURL;
    }
    
-   private ClassLoader getScopedClassLoader(DeploymentInfo di, URL docUrl)
+   private ClassLoader getScopedClassLoader(DeploymentInfo di, URL docUrl) throws Exception
    {
       //Scoped AOP deployments are only available when deployed as part of a scoped sar, ear etc.
       //It can contain an aop.xml file, or it can be part of a .aop file
@@ -298,6 +316,125 @@
          return di.ucl;
       }
       
+      LoaderRepository attachToRepository = getLoaderRepositoryIfAttaching(di, docUrl);
+      if (attachToRepository != null)
+      {
+         di.ucl.setRepository(attachToRepository);
+         attachToRepository.addClassLoader(di.ucl);
+         return di.ucl;
+      }
       return null;
    }
+   
+   private LoaderRepository getLoaderRepositoryIfAttaching(DeploymentInfo di, URL docUrl) throws Exception
+   {
+      if (di.parent == null)
+      {
+         //We are a top-level deployment, check if we are meant to be attaching to a scoped repository
+         
+         //TODO Use AspectXmlLoader.loadURL once AOP is added to repository 
+         Document doc = loadURL(docUrl);
+         Element top = doc.getDocumentElement();
+         NodeList children = top.getChildNodes();
+         int childlength = children.getLength();
+         for (int i = 0; i < childlength ; i++)
+         {
+            Node child = children.item(i); 
+            if (child.getNodeType() == Node.ELEMENT_NODE)
+            {
+               Element element = (Element)child;  
+               if (element.getTagName().equals("loader-repository"))
+               {
+                  String repositoryName = null;
+                  NodeList nestedChildren = child.getChildNodes();
+                  int nestedChildLength = nestedChildren.getLength();
+                  for (int j = 0 ; j < nestedChildLength ; j++)
+                  {
+                     Node nestedChild = nestedChildren.item(j);
+                     if (nestedChild.getNodeType() == Node.TEXT_NODE || nestedChild.getNodeType() == Node.CDATA_SECTION_NODE)
+                     {
+                        repositoryName = nestedChild.getNodeValue().trim();
+                        break;
+                     }
+                  }
+                  log.info("Should attach deployment to loader repository " + repositoryName);
+                  ObjectName on;
+                  try
+                  {
+                     on = new ObjectName(repositoryName);
+                  }
+                  catch (MalformedObjectNameException e)
+                  {
+                     throw new RuntimeException("loader-repository='" + repositoryName + "' is not a valid object name", e);
+                  }
+                  
+                  try
+                  {
+                     MBeanInfo info = server.getMBeanInfo(on);
+                  }
+                  catch (InstanceNotFoundException e)
+                  {
+                     log.warn("No scoped loader repository exists with the name " + on);
+                  }
+                  
+                  LoaderRepository repository = (LoaderRepository)server.getAttribute(on, "Instance");
+                  if (repository instanceof HeirarchicalLoaderRepository3)
+                  {
+                     return repository;
+                  }
+                  else
+                  {
+                     log.warn("Loader repository " + on + " is not a isolated loader repository. Deploying aspects in default domain.");
+                  }
+               }
+            }            
+         }
+      }
+      
+      return null;
+   }
+   
+   //TODO Use AspectXmlLoader.loadURL once AOP is added to repository 
+   public static Document loadURL(URL configURL) throws Exception
+   {
+      InputStream is = configURL != null ? configURL.openStream() : null;
+      if (is == null)
+         throw new IOException("Failed to obtain InputStream from url: " + configURL);
+
+      DocumentBuilderFactory docBuilderFactory = null;
+      docBuilderFactory = DocumentBuilderFactory.newInstance();
+      docBuilderFactory.setValidating(false);
+      InputSource source = new InputSource(is);
+      URL url = AspectXmlLoader.class.getResource("/jboss-aop_1_0.dtd");
+      source.setSystemId(url.toString());
+      DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+      docBuilder.setEntityResolver(new Resolver());
+      //docBuilder.setErrorHandler(new LocalErrorHandler());
+      Document doc = docBuilder.parse(source);
+      return doc;
+   }
+
+   private static class Resolver implements EntityResolver
+   {
+      public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
+      {
+         if (systemId.endsWith("jboss-aop_1_0.dtd"))
+         {
+            try
+            {
+               URL url = AspectXmlLoader.class.getResource("/jboss-aop_1_0.dtd");
+               InputStream is = url.openStream();
+               return new InputSource(is);
+            }
+            catch (IOException e)
+            {
+               e.printStackTrace();
+               return null;
+            }
+         }
+         return null;
+      }
+   }
+
+
 }
\ No newline at end of file

Modified: branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java
===================================================================
--- branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java	2007-02-14 19:14:24 UTC (rev 60549)
+++ branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -109,7 +109,7 @@
       }
       catch (Exception ex)
       {
-         ClassFormatError cfe = new ClassFormatError("Failed to load dyn class: " + cc.getName());
+         ClassFormatError cfe = new ClassFormatError("Failed to load dyn class: " + cc.getName() + " with " + getClassLoader());
          cfe.initCause(ex);
          throw cfe;
       }

Modified: branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java
===================================================================
--- branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java	2007-02-14 19:14:24 UTC (rev 60549)
+++ branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -98,4 +98,13 @@
       return new ScopedClassLoaderDomain(cl, parentDelegation, parent, false);
    }
 
+   public Object getLoaderRepository(ClassLoader loader)
+   {
+      ClassLoader cl = ifScopedDeploymentGetScopedParentUclForCL(loader);
+      if (cl != null)
+      {
+         return ((RepositoryClassLoader)cl).getLoaderRepository();
+      }
+      return null;
+   }
 }

Modified: branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java
===================================================================
--- branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java	2007-02-14 19:14:24 UTC (rev 60549)
+++ branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -64,9 +64,19 @@
       return null;
    }
    
+   public void removeAspectDefinition(String name)
+   {
+      AspectDefinition def = super.internalRemoveAspectDefintion(name);
+      if (def != null)
+      {
+         Object o = myPerVMAspects.remove(name);
+      }
+   }
+
    public Object getPerVMAspect(AspectDefinition def)
    {
-      return getPerVMAspect(def.getName());
+      Object aspect = getPerVMAspect(def.getName());
+      return aspect;
    }
 
    public Object getPerVMAspect(String def)

Modified: branches/Branch_4_0/testsuite/build.xml
===================================================================
--- branches/Branch_4_0/testsuite/build.xml	2007-02-14 19:14:24 UTC (rev 60549)
+++ branches/Branch_4_0/testsuite/build.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -105,7 +105,7 @@
     <path refid="javassist.classpath"/>
     <path refid="jboss.jaxr.classpath"/>
     <path refid="jboss.remoting.classpath"/>
-    <path refid="jboss.jbossretro.rt.classpath"/>       
+    <path refid="jboss.jbossretro.rt.classpath"/>
     <path refid="jboss.backport.concurrent.classpath"/>
     <path refid="jgroups.jgroups.classpath"/>
   	<path refid="joesnmp.joesnmp.classpath"/>
@@ -225,7 +225,7 @@
     <pathelement path="${jboss.jbossws.lib}/jboss-saaj.jar"/>
   </path>
   <path id="webservice.classpath" refid="${webservice.classpath}"/>
-	
+
   <!-- classpath and local.classpath must have a value using with a path -->
   <property name="classpath" value=""/>
   <property name="local.classpath" value=""/>
@@ -639,7 +639,7 @@
     <exclude name="**/test/jacc/test/*"/>
   </patternset>
   <patternset id="jacc.external.includes">
-    <include name="org/jboss/test/jacc/test/external/*TestCase.class"/> 
+    <include name="org/jboss/test/jacc/test/external/*TestCase.class"/>
   </patternset>
   <patternset id="custom-secmgr.includes">
     <include name="**/test/**/CustomSecurityManagerTestCase.class"/>
@@ -809,7 +809,7 @@
       		<replacefilter token="&lt;interceptor call-by-value=&quot;true&quot;&gt;org.jboss.invocation.MarshallingInvokerInterceptor&lt;/interceptor&gt;"
       		               value="&lt;interceptor call-by-value=&quot;true&quot;&gt;org.jboss.invocation.DataContainerMarshallingInvokerInterceptor&lt;/interceptor&gt;"/>
       	</replace>
-  	
+
     <server:start name="unified-jboss"/>
 
      <antcall target="test-unified-unit">
@@ -1044,13 +1044,13 @@
     <antcall target="tests-clustering">
       <param name="jboss-junit-configuration" value="UDP"/>
     </antcall>
-    
+
     <!-- Test a TCP stack. -->
     <antcall target="tests-clustering">
       <param name="jgroups-stack" value="TCP"/>
       <param name="jboss-junit-configuration" value="TCP"/>
     </antcall>
-    
+
   </target>
 
   <!-- Depending on the value of the ${jboss-junit-configuration} variable, uses different JGroups stacks -->
@@ -1064,18 +1064,18 @@
 
     <server:start name="cluster-${jboss-junit-configuration}-0"/>
     <server:start name="cluster-${jboss-junit-configuration}-1"/>
- 
+
     <echo message="Going to call target tests-clustering-unit for non-HTTP tests"/>
 
     <antcall target="tests-clustering-udp" inheritRefs="true"/>
-    
+
     <antcall target="tests-clustering-unit">
       <param name="cluster.includes.refid" value="cluster.non.http.includes"/>
       <param name="jboss-junit-configuration" value="Default-${jboss-junit-configuration}"/>
       <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-0"/>
       <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-1"/>
-    </antcall>    
-    
+    </antcall>
+
     <echo message="Going to call target tests-clustering-unit for HTTP tests (ASYNC, no BR)"/>
 
     <antcall target="tests-clustering-unit">
@@ -1198,7 +1198,7 @@
       <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-0"/>
       <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-1"/>
     </antcall>
-    
+
   </target>
 
   <target name="tests-clustering-configure" unless="${tests.clustering.skip.startup}">
@@ -1312,7 +1312,7 @@
       </patternset>
     </create-config>
     <server:start name="tomcat-sso"/>
-    <run-junit junit.patternset="tc-sso.includes" 
+    <run-junit junit.patternset="tc-sso.includes"
 	junit.configuration="tomcat-sso"/>
     <server:stop name="tomcat-sso"/>
   </target>
@@ -1322,14 +1322,14 @@
     <!-- Create the sso enabled tomcat config starting with the all config -->
     <create-cluster-sso-node newconf="tomcat-sso-cluster0"/>
     <create-cluster-sso-node newconf="tomcat-sso-cluster1"/>
-    
+
     <echo message="Modifying the node0 and node1 Tomcat configuration for REPL_SYNC/UseJK"/>
     <http-cluster-node-config-change conf="tomcat-sso-cluster0" useBuddyRepl="false"/>
     <http-cluster-node-config-change conf="tomcat-sso-cluster1" useBuddyRepl="false"/>
 
     <server:start name="tomcat-sso-cluster0"/>
     <server:start name="tomcat-sso-cluster1"/>
-    
+
     <antcall target="tests-clustering-unit">
       <param name="cluster.includes.refid" value="tc-sso-clustered.includes"/>
       <param name="jboss-junit-configuration" value="tomcat-sso-cluster"/>
@@ -1337,7 +1337,7 @@
 
     <server:stop name="tomcat-sso-cluster0"/>
     <server:stop name="tomcat-sso-cluster1"/>
-    
+
   </target>
 
   <!-- Tests that require the attribute "UseJBossWebLoader" set to true -->
@@ -1394,7 +1394,7 @@
     <server:start name="binding-manager1"/>
     <server:start name="binding-manager2"/>
 
-    <run-junit junit.patternset="binding-manager.includes" 
+    <run-junit junit.patternset="binding-manager.includes"
        junit.configuration="binding-manager" />
 
     <server:stop name="binding-manager1"/>
@@ -1868,8 +1868,8 @@
   </target>
 
   <target name="tests-jacc-security-external"
-    description="Tests run against a jboss server with JACC configured with an 
-                        external policy provider"> 
+    description="Tests run against a jboss server with JACC configured with an
+                        external policy provider">
     <create-config baseconf="default" newconf="jacc-security-external" newconf-src="jacc">
       <patternset>
         <include name="conf/**"/>
@@ -1944,7 +1944,7 @@
         junit.syspropertyset="jacc-tests-props" />
 
     <stop-jboss/>
-    <wait-on-shutdown conf="jacc-security-external"/> 
+    <wait-on-shutdown conf="jacc-security-external"/>
   </target>
 
 
@@ -2676,7 +2676,7 @@
         junit.syspropertyset="tests-webservice-ssl-props"
 	junit.configuration="webservice-ssl" />
      <run-junit junit.patternset="webservice-ssl.noenv.includes"
-        junit.syspropertyset="tests-webservice-ssl-noenv-props" 
+        junit.syspropertyset="tests-webservice-ssl-noenv-props"
 	junit.configuration="webservice-ssl" />
      <server:stop name="webservice-ssl"/>
   </target>
@@ -2701,14 +2701,17 @@
       <copy todir="${jboss.dist}/bin" file="${jboss.aop.lib}/jdk14-pluggable-instrumentor.jar"/>
       <server:start name="scoped-aop"/>
 
-       <run-junit junit.patternset="aop-with-classloader.includes"
-	 junit.configuration="aop-scoped"/>
+    <antcall target="run-tests-aop-scoped" inheritRefs="true"/>
 
       <server:stop name="scoped-aop"/>
       <delete dir="${jboss.dist}/bin/woven-classloader"/>
       <delete file="${jboss.dist}/bin/jdk14-pluggable-instrumentor.jar"/>
   </target>
 
+  <target name="run-tests-aop-scoped"
+     description="AOP tests requiring a native classloader hook">
+       <run-junit junit.patternset="aop-with-classloader.includes" junit.configuration="aop-scoped"/>
+  </target>
 
   <!--
      | Standard jaxr tests that should run successfully against a
@@ -3189,7 +3192,7 @@
         fork="${junit.batchtest.fork}"/>
     </junit>
   </target>
-   
+
    <target name="one-cluster-test" if="test">
 
     <property name="jboss-junit-configuration" value="UDP"/>
@@ -3211,7 +3214,7 @@
     <server:stop name="cluster-${jboss-junit-configuration}-0"/>
     <server:stop name="cluster-${jboss-junit-configuration}-1"/>
    </target>
-   
+
   <target name="one-cluster-test-tcp">
      <property name="jgroups-stack" value="TCP"/>
      <property name="jboss-junit-configuration" value="TCP"/>
@@ -3271,12 +3274,12 @@
 
     <target name="tests-matrix"
       description="Executes only the version check compatibility suite. Use -Dmatrix-versions=[version container] for this task" depends="maybejars" if="matrix-versions">
-      
+
       <fail message="Use -Dmatrix-versions=[version container] for this task" unless="matrix-versions"/>
       <fail message="Set -Djdk14= to a JDK1.4 installation" unless="jdk14"/>
       <fail message="Set -Djdk15= to a JDK1.5 installation" unless="jdk15"/>
 
-      <test-compatibility client-version="3_2_8SP1" client-jdk="${jdk14}" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dorg.jboss.j2ee.Serialization"/>      
+      <test-compatibility client-version="3_2_8SP1" client-jdk="${jdk14}" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dorg.jboss.j2ee.Serialization"/>
       <test-compatibility client-version="3_2_x"    client-jdk="${jdk14}" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dorg.jboss.j2ee.Serialization"/>
       <test-compatibility client-version="4_0_1SP1" client-jdk="${jdk14}" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy -Dorg.jboss.j2ee.LegacySerialization" client-serialization-flag="-Dnone"/>
       <test-compatibility client-version="4_0_2"    client-jdk="${jdk14}" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dnone"/>
@@ -3289,7 +3292,7 @@
       <test-compatibility-pooledInvokers client-version="4_0_3"    client-jdk="${jdk14}" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dnone"/>
       <test-compatibility-pooledInvokers client-version="4_0_3SP1" client-jdk="${jdk14}" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dnone"/>
       <test-compatibility-pooledInvokers client-version="4_0_4_GA" client-jdk="${jdk14}" serialization-flag="-Dnone" client-serialization-flag="-Dnone"/>
-      <test-compatibility-pooledInvokers client-version="4_0_x"    client-jdk="${jdk14}" serialization-flag="-Dnone" client-serialization-flag="-Dnone"/>      
+      <test-compatibility-pooledInvokers client-version="4_0_x"    client-jdk="${jdk14}" serialization-flag="-Dnone" client-serialization-flag="-Dnone"/>
       <test-compatibility-pooledInvokers client-version="4_2_x"    client-jdk="${jdk15}" serialization-flag="-Dnone" client-serialization-flag="-Dnone"/>
     </target>
 
@@ -3339,12 +3342,12 @@
         <execute-matrix-unit test-name="cmp2" parameter-filter="org/jboss/test/cmp2/**/*TestCase.class"/>
         <execute-matrix-unit test-name="jms" parameter-filter="org/jboss/test/jbossmq/test/JBossMQUnitTest.class"/>
     </target>
-    
+
     <target name="tests-standard-unit-matrix-version-pooled">
         <execute-matrix-unit test-name="pooled-invoker" parameter-filter="org/jboss/test/pooled/test/**/BeanStressTestCase.class"/>
     </target>
-    
 
+
     <macrodef name="execute-matrix-unit">
         <attribute name="test-name"/>
         <attribute name="parameter-filter"/>

Modified: branches/Branch_4_0/testsuite/imports/sections/aop.xml
===================================================================
--- branches/Branch_4_0/testsuite/imports/sections/aop.xml	2007-02-14 19:14:24 UTC (rev 60549)
+++ branches/Branch_4_0/testsuite/imports/sections/aop.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -276,6 +276,52 @@
       </fileset>
     </jar>
     
+
+    <!-- jars for scoped attachment test -->
+    <jar destfile="${build.lib}/aop-scopedattachtest1.aop">
+      <fileset dir="${build.classes}">
+        <include name="org/jboss/test/aop/scopedattach/**/*.class"/>
+        <exclude name="org/jboss/test/aop/scopedattach/ScopedTester*.class"/>
+        <exclude name="org/jboss/test/aop/scopedattach/POJO.class"/>
+      </fileset>
+      <fileset dir="${build.resources}/aop/scoped-attach/sar1">
+        <include name="META-INF/jboss-aop.xml"/>
+      </fileset>
+    </jar>
+    <jar destfile="${build.lib}/aop-scopedattachtest1.sar">
+      <fileset dir="${build.classes}">
+        <include name="org/jboss/test/aop/scopedattach/ScopedTester*.class"/>
+        <include name="org/jboss/test/aop/scopedattach/POJO.class"/>
+      </fileset>
+      <fileset dir="${build.resources}/aop/scoped-attach/sar1">
+        <include name="META-INF/jboss-service.xml"/>
+      </fileset>
+      <fileset dir="${build.resources}/aop/scoped-attach/sar1/META-INF">
+        <include name="prepare-aop.xml"/>
+      </fileset>      
+    </jar>
+    <jar destfile="${build.lib}/aop-scopedattachtest2.aop">
+      <fileset dir="${build.classes}">
+        <include name="org/jboss/test/aop/scopedattach/**/*.class"/>
+        <exclude name="org/jboss/test/aop/scopedattach/ScopedTester*.class"/>
+        <exclude name="org/jboss/test/aop/scopedattach/POJO.class"/>
+      </fileset>
+      <fileset dir="${build.resources}/aop/scoped-attach/sar2">
+        <include name="META-INF/jboss-aop.xml"/>
+      </fileset>
+    </jar>
+    <jar destfile="${build.lib}/aop-scopedattachtest2.sar">
+      <fileset dir="${build.classes}">
+        <include name="org/jboss/test/aop/scopedattach/ScopedTester*.class"/>
+        <include name="org/jboss/test/aop/scopedattach/POJO.class"/>
+      </fileset>
+      <fileset dir="${build.resources}/aop/scoped-attach/sar2">
+        <include name="META-INF/jboss-service.xml"/>
+      </fileset>
+      <fileset dir="${build.resources}/aop/scoped-attach/sar2/META-INF">
+        <include name="prepare-aop.xml"/>
+      </fileset>      
+    </jar>
     
      <!-- Create jars for earwithwebinf test -->
      <jar destfile="${build.lib}/aop-classesinwebinf.aop">

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import javax.naming.InitialContext;
+import javax.transaction.TransactionManager;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class POJO
+{
+   public POJO()
+   {
+      System.out.println("*** POJO constructor");    
+   }
+   
+   public void method()
+   {
+      System.out.println("*** POJO method");      
+      try
+      {
+         TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
+         if (tm.getTransaction() == null) throw new RuntimeException("method() has no tx set");
+      }
+      catch (Exception e)
+      {
+         // AutoGenerated
+         throw new RuntimeException(e);
+      }
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ScopedAspect
+{
+   public static int intercepted;
+   public static int value;
+   
+   public void setValue(int i)
+   {
+      value = i;
+   }
+
+   public Object test(Invocation invocation) throws Throwable
+   {
+//      System.out.println("--- ScopedAspect intercepting " + getClass().getClassLoader());
+      intercepted++;
+      return invocation.invokeNext();
+   }
+   
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.advice.AspectFactory;
+import org.jboss.aop.joinpoint.Joinpoint;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ScopedAspectFactory implements AspectFactory
+{
+
+   public ScopedAspectFactory()
+   {
+      // FIXME ScopedAspectFactory constructor
+      super();
+   }
+
+   public Object createPerVM()
+   {
+      return new ScopedFactoryAspect();
+   }
+
+   public Object createPerClass(Advisor advisor)
+   {
+      throw new RuntimeException("Illegal scope");
+   }
+
+   public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
+   {
+      throw new RuntimeException("Illegal scope");
+   }
+
+   public Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
+   {
+      throw new RuntimeException("Illegal scope");
+   }
+
+   public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
+   {
+      throw new RuntimeException("Illegal scope");
+   }
+
+   public String getName()
+   {
+      return "ScopedAspectFactory";
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ScopedFactoryAspect
+{
+   public static String metadata;
+   public static String customMetadata;
+   public static int intercepted;
+   
+   public ScopedFactoryAspect()
+   {
+      super();
+   }
+
+   
+   public Object test(Invocation inv) throws Throwable
+   {
+      intercepted++;
+      metadata = (String)inv.getMetaData("test", "data");
+      customMetadata = (String)inv.getMetaData("custom", "data");
+      return inv.invokeNext();
+   }
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ScopedInterceptor implements Interceptor
+{
+   public static int intercepted;
+   public static int value;
+   
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+   
+   public void setValue(int i)
+   {
+      value = i;
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+//      System.out.println("--- ScopedInterceptor intercepting " + getClass().getClassLoader());
+      intercepted++;
+      
+      if (invocation instanceof MethodInvocation)
+      {
+         MethodInvocation mi = (MethodInvocation)invocation;
+         if (mi.getMethod().getName().equals("testMethod"))
+         {
+            return null;
+         }
+      }
+      
+      return invocation.invokeNext();
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.metadata.ClassMetaDataBinding;
+import org.jboss.aop.metadata.ClassMetaDataLoader;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ScopedMetadataBinding extends ClassMetaDataBinding
+{
+   String data;
+   
+   public ScopedMetadataBinding(ClassMetaDataLoader loader, String name, String tag, String exp)
+   {
+      super(loader, name, tag, exp);
+   }
+
+   public String getData()
+   {
+      return data;
+   }
+
+   public void setData(String data)
+   {
+      this.data = data;
+   }
+   
+   
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javassist.CtConstructor;
+import javassist.CtField;
+import javassist.CtMethod;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.metadata.ClassMetaDataBinding;
+import org.jboss.aop.metadata.ClassMetaDataLoader;
+import org.jboss.aop.util.XmlHelper;
+import org.w3c.dom.Element;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ScopedMetadataLoader implements ClassMetaDataLoader
+{
+   public ClassMetaDataBinding importMetaData(Element element, String name, String tag, String classExpr) throws Exception
+   {
+      ScopedMetadataBinding data = new ScopedMetadataBinding(this, name, tag, classExpr);
+      String value = XmlHelper.getOptionalChildContent(element, "data");
+      data.setData(value);
+      
+      return data;
+   }
+
+   public void bind(Advisor advisor, ClassMetaDataBinding data, CtMethod[] methods, CtField[] fields, CtConstructor[] constructors) throws Exception
+   {
+      for (int i = 0 ; i < methods.length ; i++)
+      {
+         advisor.getMethodMetaData().addMethodMetaData(methods[i], "custom", "data", ((ScopedMetadataBinding)data).getData());
+      }
+      for (int i = 0 ; i < constructors.length ; i++)
+      {
+         advisor.getConstructorMetaData().addConstructorMetaData(constructors[i], "custom", "data", ((ScopedMetadataBinding)data).getData());
+      }
+   }
+
+   public void bind(Advisor advisor, ClassMetaDataBinding data, Method[] methods, Field[] fields, Constructor[] constructors) throws Exception
+   {
+      for (int i = 0 ; i < methods.length ; i++)
+      {
+         advisor.getMethodMetaData().addMethodMetaData(methods[i], "custom", "data", ((ScopedMetadataBinding)data).getData());
+      }
+      for (int i = 0 ; i < constructors.length ; i++)
+      {
+         advisor.getConstructorMetaData().addConstructorMetaData(constructors[i], "custom", "data", ((ScopedMetadataBinding)data).getData());
+      }
+   }
+
+
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedPCInterceptor implements Interceptor
+{
+   public static int intercepted;
+   public static int value;
+   
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+   
+   public void setValue(int i)
+   {
+      value = i;
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+//      System.out.println("--- ScopedPCInterceptor intercepting " + getClass().getClassLoader());
+      intercepted++;
+      
+      if (invocation instanceof MethodInvocation)
+      {
+         MethodInvocation mi = (MethodInvocation)invocation;
+         if (mi.getMethod().getName().equals("testMethod"))
+         {
+            return null;
+         }
+      }
+      
+      return invocation.invokeNext();
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedPCJInterceptor implements Interceptor
+{
+   public static int intercepted;
+   public static int value;
+   
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+   
+   public void setValue(int i)
+   {
+      value = i;
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+//      System.out.println("--- ScopedPCJInterceptor intercepting " + getClass().getClassLoader());
+      intercepted++;
+      
+      if (invocation instanceof MethodInvocation)
+      {
+         MethodInvocation mi = (MethodInvocation)invocation;
+         if (mi.getMethod().getName().equals("testMethod"))
+         {
+            return null;
+         }
+      }
+      
+      return invocation.invokeNext();
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.aop.scopedattach;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedPJInterceptor implements Interceptor
+{
+   public static int intercepted;
+   public static int value;
+   
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+   
+   public void setValue(int i)
+   {
+      value = i;
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+//      System.out.println("--- ScopedPJInterceptor intercepting " + getClass().getClassLoader());
+      intercepted++;
+      
+      if (invocation instanceof MethodInvocation)
+      {
+         MethodInvocation mi = (MethodInvocation)invocation;
+         if (mi.getMethod().getName().equals("testMethod"))
+         {
+            return null;
+         }
+      }
+      
+      return invocation.invokeNext();
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,211 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+import java.lang.reflect.Method;
+
+import org.jboss.aop.Advised;
+import org.jboss.mx.loading.LoaderRepository;
+import org.jboss.mx.loading.RepositoryClassLoader;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class ScopedTester implements ScopedTesterMBean
+{
+   int expectedInterceptorValue;
+   int expectedAspectValue;
+   int metadataSuffix;
+   
+   String ctorPlainMetadata;
+   String methodPlainMetadata;
+   String customMetadata;
+   
+   public void setExpectedInterceptorValue(int i)
+   {
+      expectedInterceptorValue = i;
+   }
+
+   public void setExpectedAspectValue(int i)
+   {
+      expectedAspectValue = i;
+   }
+   
+   public int getExpectedInterceptorValue()
+   {
+      return expectedInterceptorValue;
+   }
+
+   public int getExpectedAspectValue()
+   {
+      return expectedAspectValue;
+   }
+
+   public void setMetadataSuffix(int i)
+   {
+      metadataSuffix = i;
+      ctorPlainMetadata = "ctor" + metadataSuffix;
+      methodPlainMetadata = "method" + metadataSuffix;
+      customMetadata = "custom" + metadataSuffix;
+   }
+   
+   public void checkPOJOAdvised()
+   {
+      System.out.println("--------------------------- TESTING POJO ADVISED ------------------");
+      if (!Advised.class.isAssignableFrom(POJO.class))
+      {
+         throw new RuntimeException("POJO is not advised");
+      }
+   }
+   
+   public void testScoped() throws Exception
+   {
+      try
+      {
+         System.out.println("--------------------------- TESTING SCOPED ------------------");
+         System.out.println("MY CLASSLOADER " + getClass().getClassLoader());
+         System.out.println("SCOPED INTERCEPTOR CLASSLOADER " + ScopedInterceptor.class.getClassLoader());
+         System.out.println("POJO CLASSLOADER " + POJO.class.getClassLoader());
+   
+         //Check that the classloaders have the same repositories
+         LoaderRepository repository1 = ((RepositoryClassLoader)getClass().getClassLoader()).getLoaderRepository();
+         LoaderRepository repository2 = ((RepositoryClassLoader)ScopedInterceptor.class.getClassLoader()).getLoaderRepository();
+         LoaderRepository repository3 = ((RepositoryClassLoader)POJO.class.getClassLoader()).getLoaderRepository();
+         
+         if (repository1 != repository2)
+         {
+            throw new RuntimeException("Repositories were not the same");
+         }
+         if (repository1 != repository3)
+         {
+            throw new RuntimeException("Repositories were not the same");
+         }
+         
+         System.out.println("------- CTOR");
+         ScopedAspect.intercepted = 0;
+         ScopedFactoryAspect.intercepted = 0;
+         ScopedPCInterceptor.intercepted = 0;
+         ScopedPCJInterceptor.intercepted = 0;
+         ScopedFactoryAspect.metadata = null;
+         ScopedFactoryAspect.customMetadata = null;
+         
+         POJO pojo = new POJO();
+         if (ScopedAspect.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedAspect 1 for POJO constructor, was " + ScopedAspect.intercepted);
+         }
+         if (ScopedFactoryAspect.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedFactoryAspect 1 for POJO constructor, was " + ScopedFactoryAspect.intercepted);
+         }
+         if (ScopedPCInterceptor.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedPCInterceptor 1 for POJO constructor, was " + ScopedPCInterceptor.intercepted);
+         }
+         if (ScopedPCJInterceptor.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedPCJInterceptor 1 for POJO constructor, was " + ScopedPCJInterceptor.intercepted);
+         }
+         if (!ctorPlainMetadata.equals(ScopedFactoryAspect.metadata))
+         {
+            throw new RuntimeException("Expected ctor metadata " + ctorPlainMetadata + ", was " + ScopedFactoryAspect.metadata);
+         }
+         if (!customMetadata.equals(ScopedFactoryAspect.customMetadata))
+         {
+            throw new RuntimeException("Expected ctor customm metadata " + customMetadata + ", was " + ScopedFactoryAspect.customMetadata);
+         }
+         
+         System.out.println("------- METHOD");
+         ScopedInterceptor.intercepted = 0;
+         ScopedAspect.intercepted = 0;
+         ScopedFactoryAspect.intercepted = 0;
+         ScopedPCInterceptor.intercepted = 0;
+         ScopedPCJInterceptor.intercepted = 0;
+         ScopedPJInterceptor.intercepted = 0;
+         ScopedFactoryAspect.metadata = null;
+         ScopedFactoryAspect.customMetadata = null;
+   
+         pojo.method();
+         if (ScopedInterceptor.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedInterceptor 1 for POJO method, was " + ScopedInterceptor.intercepted);
+         }
+         if (ScopedAspect.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedAspect 1 for POJO method, was " + ScopedAspect.intercepted);
+         }
+         if (ScopedFactoryAspect.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedFactoryAspect 1 for POJO method, was " + ScopedFactoryAspect.intercepted);
+         }
+         if (ScopedPCInterceptor.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedPCInterceptor 1 for POJO method, was " + ScopedPCInterceptor.intercepted);
+         }
+         if (ScopedPCJInterceptor.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedPCJInterceptor 1 for POJO method, was " + ScopedPCJInterceptor.intercepted);
+         }
+         if (ScopedPJInterceptor.intercepted != 1)
+         {
+            throw new RuntimeException("Expected ScopedPJInterceptor 1 for POJO method, was " + ScopedPJInterceptor.intercepted);
+         }
+         if (!methodPlainMetadata.equals(ScopedFactoryAspect.metadata))
+         {
+            throw new RuntimeException("Expected method metadata '" + methodPlainMetadata + ", was " + ScopedFactoryAspect.metadata);
+         }
+         if (!customMetadata.equals(ScopedFactoryAspect.customMetadata))
+         {
+            throw new RuntimeException("Expected method customm metadata " + customMetadata + ", was " + ScopedFactoryAspect.customMetadata);
+         }
+         
+         
+         if (ScopedInterceptor.value != expectedInterceptorValue)
+         {
+            throw new RuntimeException("Expected " + expectedInterceptorValue + " was " + ScopedInterceptor.value);
+         }
+         if (ScopedPCInterceptor.value != expectedInterceptorValue)
+         {
+            throw new RuntimeException("Expected " + expectedInterceptorValue + " was " + ScopedPCInterceptor.value);
+         }
+         if (ScopedPJInterceptor.value != expectedInterceptorValue)
+         {
+            throw new RuntimeException("Expected " + expectedInterceptorValue + " was " + ScopedPJInterceptor.value);
+         }
+         if (ScopedPCJInterceptor.value != expectedInterceptorValue)
+         {
+            throw new RuntimeException("Expected " + expectedInterceptorValue + " was " + ScopedPCJInterceptor.value);
+         }
+         if (ScopedAspect.value != expectedAspectValue)
+         {
+            throw new RuntimeException("Expected " + expectedAspectValue + " was " + ScopedAspect.value);
+         }
+      }
+      catch(Exception e)
+      {
+         e.printStackTrace();
+         throw e;
+      }
+   }   
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.scopedattach;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public interface ScopedTesterMBean
+{
+   void setExpectedInterceptorValue(int i);
+   int getExpectedInterceptorValue();
+   void setExpectedAspectValue(int i);
+   int getExpectedAspectValue();
+   void setMetadataSuffix(int i);
+
+   void checkPOJOAdvised();
+   void testScoped() throws Exception;
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.test;
+
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Kabir Khan</a>
+ * @version $Id$
+ */
+public class ScopedAttachUnitTestCase extends JBossTestCase
+{
+   org.apache.log4j.Category log = getLog();
+
+   static boolean deployed = false;
+   static int test = 0;
+   static AOPClassLoaderHookTestSetup setup;
+
+   public ScopedAttachUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testPOJOAdvised1() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester1");
+      Object[] params = {};
+      String[] sig = {};
+      server.invoke(testerName, "checkPOJOAdvised", params, sig);
+   }
+   
+   public void testPOJOAdvised2() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester2");
+      Object[] params = {};
+      String[] sig = {};
+      server.invoke(testerName, "checkPOJOAdvised", params, sig);
+   }
+   
+   public void testExpectedValues1() throws Exception
+   {
+      deploy("aop-scopedattachtest1.aop");
+      try
+      {
+         MBeanServerConnection server = getServer();
+         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester1");
+         Integer iv = (Integer)server.getAttribute(testerName, "ExpectedInterceptorValue");
+         Integer ia = (Integer)server.getAttribute(testerName, "ExpectedAspectValue");
+         assertEquals(11, iv.intValue());
+         assertEquals(21, ia.intValue());
+      }
+      finally
+      {
+         undeploy("aop-scopedattachtest1.aop");
+      }
+   }
+   
+   public void testExpectedValues2() throws Exception
+   {
+      deploy("aop-scopedattachtest2.aop");
+      try
+      {
+         MBeanServerConnection server = getServer();
+         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester2");
+         Integer iv = (Integer)server.getAttribute(testerName, "ExpectedInterceptorValue");
+         Integer ia = (Integer)server.getAttribute(testerName, "ExpectedAspectValue");
+         assertEquals(12, iv.intValue());
+         assertEquals(22, ia.intValue());
+      }
+      finally
+      {
+         undeploy("aop-scopedattachtest2.aop");
+      }
+   }
+   
+   public void testScoped1() throws Exception
+   {
+      deploy("aop-scopedattachtest1.aop");
+      try
+      {
+         MBeanServerConnection server = getServer();
+         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester1");
+         Object[] params = {};
+         String[] sig = {};
+         server.invoke(testerName, "testScoped", params, sig);
+      }
+      finally
+      {
+         undeploy("aop-scopedattachtest1.aop");
+      }
+   }
+
+   public void testScoped2() throws Exception
+   {
+      deploy("aop-scopedattachtest2.aop");
+      try
+      {
+         MBeanServerConnection server = getServer();
+         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester2");
+         Object[] params = {};
+         String[] sig = {};
+         server.invoke(testerName, "testScoped", params, sig);
+      }
+      finally
+      {
+         undeploy("aop-scopedattachtest2.aop");
+      }
+   }
+   
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+      suite.addTest(new TestSuite(ScopedAttachUnitTestCase.class));
+
+      setup = new AOPClassLoaderHookTestSetup(suite, "aop-scopedattachtest1.sar,aop-scopedattachtest2.sar");
+      return setup;
+   }
+}
\ No newline at end of file

Added: branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+	<loader-repository>aop.loading:loader=scope1</loader-repository>
+	
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedInterceptor" scope="PER_INSTANCE">
+      <attribute name="value">11</attribute>
+   </interceptor>
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedPJInterceptor" scope="PER_JOINPOINT">
+      <attribute name="value">11</attribute>
+   </interceptor>
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedPCInterceptor" scope="PER_CLASS">
+      <attribute name="value">11</attribute>
+   </interceptor>
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedPCJInterceptor" scope="PER_CLASS_JOINPOINT">
+      <attribute name="value">11</attribute>
+   </interceptor>
+   <aspect class="org.jboss.test.aop.scopedattach.ScopedAspect">
+      <attribute name="value">21</attribute>
+   </aspect>
+   <aspect factory="org.jboss.test.aop.scopedattach.ScopedAspectFactory"/>
+   <stack name="stuff">
+      <advice aspect="org.jboss.test.aop.scopedattach.ScopedAspectFactory" name="test"/>
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedPJInterceptor"/>
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedPCInterceptor"/>
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedPCJInterceptor"/>
+   </stack>
+
+   <bind pointcut="all(org.jboss.test.aop.scopedattach.POJO)">
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedInterceptor"/>
+      <advice aspect="org.jboss.test.aop.scopedattach.ScopedAspect" name="test"/>
+      <stack-ref name="stuff"/>
+   </bind>
+
+   <metadata tag="test" class="org.jboss.test.aop.scopedattach.POJO">
+      <constructor expr="POJO()">
+         <data>ctor1</data>
+      </constructor>
+      <method expr="void method(..)">
+         <data>method1</data>
+      </method>
+   </metadata>
+   
+   <metadata-loader tag="custom" class="org.jboss.test.aop.scopedattach.ScopedMetadataLoader"/>
+	<metadata tag="custom" class="org.jboss.test.aop.scopedattach.POJO">
+	      <data>custom1</data>
+	</metadata>
+   
+   <!-- Make sure we can see global aspects -->
+   <metadata tag="transaction" class="org.jboss.test.aop.scopedattach.POJO">
+      <method name="method">
+         <trans-attribute>Required</trans-attribute>
+      </method>
+   </metadata>
+</aop>

Added: branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+   <loader-repository>
+   	aop.loading:loader=scope1
+   </loader-repository>
+	<mbean code="org.jboss.test.aop.scopedattach.ScopedTester" name="jboss.aop:name=ScopedTester1">
+	   <attribute name="ExpectedInterceptorValue">11</attribute>
+	   <attribute name="ExpectedAspectValue">21</attribute>
+	   <attribute name="MetadataSuffix">1</attribute>
+	</mbean>
+</server>

Added: branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+   <prepare expr="all(org.jboss.test.aop.scopedattach.POJO)"/>
+</aop>

Added: branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+	<loader-repository>aop.loading:loader=scope2</loader-repository>
+	
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedInterceptor" scope="PER_INSTANCE">
+      <attribute name="value">12</attribute>
+   </interceptor>
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedPJInterceptor" scope="PER_JOINPOINT">
+      <attribute name="value">12</attribute>
+   </interceptor>
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedPCInterceptor" scope="PER_CLASS">
+      <attribute name="value">12</attribute>
+   </interceptor>
+   <interceptor class="org.jboss.test.aop.scopedattach.ScopedPCJInterceptor" scope="PER_CLASS_JOINPOINT">
+      <attribute name="value">12</attribute>
+   </interceptor>   
+   <aspect class="org.jboss.test.aop.scopedattach.ScopedAspect">
+      <attribute name="value">22</attribute>
+   </aspect>
+   <aspect factory="org.jboss.test.aop.scopedattach.ScopedAspectFactory"/>
+   <stack name="stuff">
+      <advice aspect="org.jboss.test.aop.scopedattach.ScopedAspectFactory" name="test"/>
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedPJInterceptor"/>
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedPCInterceptor"/>
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedPCJInterceptor"/>
+   </stack>
+
+   <bind pointcut="all(org.jboss.test.aop.scopedattach.POJO)">
+      <interceptor-ref name="org.jboss.test.aop.scopedattach.ScopedInterceptor"/>
+      <advice aspect="org.jboss.test.aop.scopedattach.ScopedAspect" name="test"/>
+      <stack-ref name="stuff"/>
+   </bind>
+   
+   <metadata tag="test" class="org.jboss.test.aop.scopedattach.POJO">
+      <constructor expr="POJO()">
+         <data>ctor2</data>
+      </constructor>
+      <method expr="void method(..)">
+         <data>method2</data>
+      </method>
+   </metadata>
+
+   <metadata-loader tag="custom" class="org.jboss.test.aop.scopedattach.ScopedMetadataLoader"/>
+	<metadata tag="custom" class="org.jboss.test.aop.scopedattach.POJO">
+	      <data>custom2</data>
+	</metadata>
+
+   <!-- Make sure we can see global aspects -->
+   <metadata tag="transaction" class="org.jboss.test.aop.scopedattach.POJO">
+      <method name="method">
+         <trans-attribute>Required</trans-attribute>
+      </method>
+   </metadata>
+</aop>

Added: branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+   <loader-repository>
+   	aop.loading:loader=scope2
+      <loader-repository-config>java2ParentDelegation=true</loader-repository-config> 
+   </loader-repository>
+	<mbean code="org.jboss.test.aop.scopedattach.ScopedTester" name="jboss.aop:name=ScopedTester2">
+	   <attribute name="ExpectedInterceptorValue">12</attribute>
+	   <attribute name="ExpectedAspectValue">22</attribute>
+	   <attribute name="MetadataSuffix">2</attribute>
+	</mbean>
+</server>

Added: branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml	                        (rev 0)
+++ branches/Branch_4_0/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml	2007-02-14 19:26:35 UTC (rev 60550)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+   <prepare expr="all(org.jboss.test.aop.scopedattach.POJO)"/>
+</aop>




More information about the jboss-cvs-commits mailing list