[jboss-cvs] JBossAS SVN: r60561 - in branches/Branch_4_2/testsuite/src: main/org/jboss/test/aop/scopedattach and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 15 05:36:22 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-02-15 05:36:21 -0500 (Thu, 15 Feb 2007)
New Revision: 60561

Added:
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/test/ScopedEarWithClassesInWebInfTestCase.java
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml
   branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml
Log:
[JBAOP-356] Ability to attach a .aop deployment to a particular scoped classloader.

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


Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/POJO.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspect.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedAspectFactory.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedFactoryAspect.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedInterceptor.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataBinding.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedMetadataLoader.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCInterceptor.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPCJInterceptor.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedPJInterceptor.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTester.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/scopedattach/ScopedTesterMBean.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/main/org/jboss/test/aop/test/ScopedEarWithClassesInWebInfTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/test/ScopedEarWithClassesInWebInfTestCase.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/test/ScopedEarWithClassesInWebInfTestCase.java	2007-02-15 10:36:21 UTC (rev 60561)
@@ -0,0 +1,69 @@
+/*
+* 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 java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.util.web.HttpUtils;
+
+/**
+ * This test must be run within the test-aop-scoped target since it requires the classloader hooks
+ * for interception of classes within the .war file.
+ * 
+ * THE EAR IS NOT REALLY SCOPED!!!!
+ * The test is named to fit in with the naming convention for tests requiring a special hook
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedEarWithClassesInWebInfTestCase extends JBossTestCase
+{
+   org.apache.log4j.Category log = getLog();
+
+   static boolean deployed = false;
+   static int test = 0;
+   static AOPClassLoaderHookTestSetup setup;
+
+   public ScopedEarWithClassesInWebInfTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testEar1() throws Exception
+   {
+      URL url = new URL(HttpUtils.getBaseURL() + "classesinwebinf/srv");
+      HttpUtils.accessURL(url);      
+   }
+
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+      suite.addTest(new TestSuite(ScopedEarWithClassesInWebInfTestCase.class));
+
+      setup = new AOPClassLoaderHookTestSetup(suite, "aop-classesinwebinf.ear");
+      return setup;
+   }
+}

Added: branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-aop.xml	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/jboss-service.xml	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar1/META-INF/prepare-aop.xml	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-aop.xml	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/jboss-service.xml	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/scoped-attach/sar2/META-INF/prepare-aop.xml	2007-02-15 10:36:21 UTC (rev 60561)
@@ -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