[jboss-cvs] JBossAS SVN: r57911 - in branches/Branch_4_0: aspects/src/main/org/jboss/aop/deployment testsuite testsuite/imports/sections testsuite/src/main/org/jboss/test/aop/scoped testsuite/src/main/org/jboss/test/aop/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 30 06:40:21 EST 2006


Author: kabir.khan at jboss.com
Date: 2006-10-30 06:40:01 -0500 (Mon, 30 Oct 2006)
New Revision: 57911

Added:
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/AnnotatedInterceptor.java
Modified:
   branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/AspectDeployer.java
   branches/Branch_4_0/testsuite/build.xml
   branches/Branch_4_0/testsuite/imports/sections/aop.xml
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTester.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTesterMBean.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java
Log:
[JBAOP-293] Get scoped aop working with aspect annotation loader

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	2006-10-29 17:20:52 UTC (rev 57910)
+++ branches/Branch_4_0/aspects/src/main/org/jboss/aop/deployment/AspectDeployer.java	2006-10-30 11:40:01 UTC (rev 57911)
@@ -160,7 +160,9 @@
          if (!di.isXML)
          {
             Iterator it = ArchiveBrowser.getBrowser(di.localUrl, new ClassFileFilter());
-            AspectAnnotationLoader loader = new AspectAnnotationLoader(AspectManager.instance());
+            AspectManager manager = (scl != null) ? AspectManager.instance(scl) : AspectManager.instance();
+            AspectAnnotationLoader loader = new AspectAnnotationLoader(manager);
+            loader.setClassLoader(scl);
             loader.deployInputStreamIterator(it);
          }
          

Modified: branches/Branch_4_0/testsuite/build.xml
===================================================================
--- branches/Branch_4_0/testsuite/build.xml	2006-10-29 17:20:52 UTC (rev 57910)
+++ branches/Branch_4_0/testsuite/build.xml	2006-10-30 11:40:01 UTC (rev 57911)
@@ -104,7 +104,7 @@
     <path refid="jacorb.jacorb.classpath"/>
     <path refid="javassist.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"/>
@@ -237,7 +237,7 @@
     <pathelement path="${jboss.jbossws14.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=""/>
@@ -653,7 +653,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"/>
@@ -752,13 +752,13 @@
     <exclude name="org/jboss/test/cache/test/local/ConcurrentTransactionalUnitTestCase.class"/>
   </patternset>
 
-  <patternset id="aop-with-classloader.excludes">
-     <!-- Needs to be started either with the bootclasspath or -javaagent classloader hooks -->
-     <exclude name="org/jboss/test/aop/test/ScopedUnitTestCase.class"/>
-  </patternset>
-  <patternset id="aop-with-classloader.includes">
-     <include name="org/jboss/test/aop/test/ScopedUnitTestCase.class"/>
-  </patternset>
+   <patternset id="aop-with-classloader.excludes">
+      <!-- Needs to be started either with the bootclasspath or -javaagent classloader hooks -->
+      <exclude name="org/jboss/test/aop/test/Scoped*.class"/>
+   </patternset>
+   <patternset id="aop-with-classloader.includes">
+      <include name="org/jboss/test/aop/test/ScopedUnitTestCase.class"/>
+   </patternset>
 
   <!-- The union of the excludes -->
   <patternset id="all.excludes">
@@ -822,7 +822,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">
@@ -1058,13 +1058,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 -->
@@ -1078,18 +1078,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">
@@ -1212,7 +1212,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}">
@@ -1326,7 +1326,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>
@@ -1336,14 +1336,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"/>
@@ -1351,7 +1351,7 @@
 
     <server:stop name="tomcat-sso-cluster0"/>
     <server:stop name="tomcat-sso-cluster1"/>
-    
+
   </target>
 
   <!-- Tests that require the attribute "UseJBossWebLoader" set to true -->
@@ -1408,7 +1408,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"/>
@@ -1882,8 +1882,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/**"/>
@@ -1958,7 +1958,7 @@
         junit.syspropertyset="jacc-tests-props" />
 
     <stop-jboss/>
-    <wait-on-shutdown conf="jacc-security-external"/> 
+    <wait-on-shutdown conf="jacc-security-external"/>
   </target>
 
 
@@ -2692,7 +2692,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>
@@ -3205,7 +3205,7 @@
         fork="${junit.batchtest.fork}"/>
     </junit>
   </target>
-   
+
    <target name="one-cluster-test" if="test">
 
     <property name="jboss-junit-configuration" value="UDP"/>
@@ -3227,7 +3227,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"/>
@@ -3288,7 +3288,7 @@
     <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">
 
-      <test-compatibility client-version="3_2_8SP1" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dorg.jboss.j2ee.Serialization"/>      
+      <test-compatibility client-version="3_2_8SP1" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dorg.jboss.j2ee.Serialization"/>
       <test-compatibility client-version="3_2_x"    serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dorg.jboss.j2ee.Serialization"/>
       <test-compatibility client-version="4_0_1SP1" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy -Dorg.jboss.j2ee.LegacySerialization" client-serialization-flag="-Dnone"/>
       <test-compatibility client-version="4_0_2"    serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dnone"/>
@@ -3300,7 +3300,7 @@
       <test-compatibility-pooledInvokers client-version="4_0_3"    serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dnone"/>
       <test-compatibility-pooledInvokers client-version="4_0_3SP1" serialization-flag="-Dorg.jboss.invocation.pooled.Legacy" client-serialization-flag="-Dnone"/>
       <test-compatibility-pooledInvokers client-version="4_0_4_GA" serialization-flag="-Dnone" client-serialization-flag="-Dnone"/>
-      <test-compatibility-pooledInvokers client-version="4_0_x"    serialization-flag="-Dnone" client-serialization-flag="-Dnone"/>      
+      <test-compatibility-pooledInvokers client-version="4_0_x"    serialization-flag="-Dnone" client-serialization-flag="-Dnone"/>
     </target>
 
     <macrodef name="test-compatibility-pooledInvokers">
@@ -3345,12 +3345,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	2006-10-29 17:20:52 UTC (rev 57910)
+++ branches/Branch_4_0/testsuite/imports/sections/aop.xml	2006-10-30 11:40:01 UTC (rev 57911)
@@ -1,5 +1,5 @@
 <project name="tests-aop-jars">
-   
+
   <!-- aop test -->
   <target name="_jars-aop">
     <mkdir dir="${build.lib}"/>
@@ -19,6 +19,7 @@
       <include name="org/jboss/test/aop/bean/AnnotatedSecuredPOJO.java"/>
       <include name="org/jboss/test/aop/bean/AnnotatedTxPOJO.java"/>
       <include name="org/jboss/test/aop/bean/AnnotatedTxLockedPOJO.java"/>
+      <include name="org/jboss/test/aop/scoped/AnnotatedInterceptor.java"/>
     </annotationc>
     <!-- build aopest.jar -->
     <jar destfile="${build.lib}/aoptest.jar"
@@ -191,6 +192,7 @@
     <jar destfile="${build.lib}/aop-scopedtest2.sar">
       <fileset dir="${build.classes}">
         <include name="org/jboss/test/aop/scoped/*.class"/>
+        <exclude name="org/jboss/test/aop/scoped/Annotated*.class"/>
       </fileset>
       <fileset dir="${build.resources}/aop/scoped/sar2/META-INF">
         <include name="scoped-aop.xml"/>
@@ -199,7 +201,7 @@
         <include name="META-INF/jboss-service.xml"/>
       </fileset>
     </jar>
-    
+
     <jar destfile="${build.lib}/aop-scopedear1-ejb.jar">
       <fileset dir="${build.classes}">
         <include name="org/jboss/test/aop/scoped/ear/ejb/*.class"/>
@@ -236,7 +238,7 @@
         <include name="META-INF/jboss-app.xml"/>
       </fileset>
     </jar>
-    
+
     <jar destfile="${build.lib}/aop-scopedear2-ejb.jar">
       <fileset dir="${build.classes}">
         <include name="org/jboss/test/aop/scoped/ear/ejb/*.class"/>
@@ -273,8 +275,31 @@
         <include name="META-INF/jboss-app.xml"/>
       </fileset>
     </jar>
-    
-    
+
+    <!-- ************************ -->
+    <!-- jars for extender test   -->
+    <!-- ***********************  -->
+    <jar destfile="${build.lib}/aop-extendertest.aop">
+       <fileset dir="${build.classes}">
+          <include name="org/jboss/test/aop/extender/*.class"/>
+          <exclude name="org/jboss/test/aop/extender/ExtenderTester*.class"/>
+       </fileset>
+       <fileset dir="${build.resources}/aop/extender">
+          <include name="META-INF/jboss-aop.xml"/>
+       </fileset>
+    </jar>
+    <jar destfile="${build.lib}/aop-extendertest.sar">
+       <fileset dir="${build.lib}">
+          <include name="aop-extendertest.aop"/>
+       </fileset>
+       <fileset dir="${build.classes}">
+          <include name="org/jboss/test/aop/extender/ExtenderTester*.class"/>
+       </fileset>
+       <fileset dir="${build.resources}/aop/extender">
+          <include name="META-INF/jboss-service.xml"/>
+       </fileset>
+    </jar>
+
     <!-- ok, we have created the loadtime jars, let us now precompile the classes for standalone test  -->
 
     <!--

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/AnnotatedInterceptor.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/AnnotatedInterceptor.java	2006-10-29 17:20:52 UTC (rev 57910)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/AnnotatedInterceptor.java	2006-10-30 11:40:01 UTC (rev 57911)
@@ -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.scoped;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ * @@org.jboss.aop.InterceptorDef (scope=org.jboss.aop.advice.Scope.PER_VM)
+ * @@org.jboss.aop.Bind (pointcut="all(org.jboss.test.aop.scoped.POJO)")
+ */
+public class AnnotatedInterceptor implements Interceptor
+{
+   static boolean invoked;
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      invoked = true;
+      return invocation.invokeNext();
+   }
+
+}

Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTester.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTester.java	2006-10-29 17:20:52 UTC (rev 57910)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTester.java	2006-10-30 11:40:01 UTC (rev 57911)
@@ -138,6 +138,25 @@
       }
    }
    
+   public void testAnnotatedScopedAnnotationsDeployed()
+   {
+      AnnotatedInterceptor.invoked = false;
+      POJO pojo = new POJO();
+      if (!AnnotatedInterceptor.invoked) throw new RuntimeException("AnnotatedInterceptor should have been invoked");
+   }
+   
+   public void testAnnotatedScopedAnnotationsNotDeployed()
+   {
+      try
+      {
+         AnnotatedInterceptor.invoked = false;
+         throw new RuntimeException("AnnotatedInterceptor should not be available in this deployment");
+      }
+      catch (NoClassDefFoundError expected)
+      {
+      }
+   }
+   
    public void testIntroduction1()
    {
       IntroducedPOJO pojo = new IntroducedPOJO();

Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTesterMBean.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTesterMBean.java	2006-10-29 17:20:52 UTC (rev 57910)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/scoped/ScopedTesterMBean.java	2006-10-30 11:40:01 UTC (rev 57911)
@@ -38,4 +38,6 @@
    void testScoped() throws Exception;
    void testIntroduction1();
    void testIntroduction2();
+   void testAnnotatedScopedAnnotationsDeployed();
+   void testAnnotatedScopedAnnotationsNotDeployed();
 }

Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java	2006-10-29 17:20:52 UTC (rev 57910)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java	2006-10-30 11:40:01 UTC (rev 57911)
@@ -90,7 +90,24 @@
       server.invoke(testerName, "testScoped", params, sig);
    }
    
+   public void testAnnotations1() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester1");
+      Object[] params = {};
+      String[] sig = {};
+      server.invoke(testerName, "testAnnotatedScopedAnnotationsDeployed", params, sig);
+   }
    
+   public void testAnnotations2() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester2");
+      Object[] params = {};
+      String[] sig = {};
+      server.invoke(testerName, "testAnnotatedScopedAnnotationsNotDeployed", params, sig);
+   }
+   
    public void testIntroduction1() throws Exception
    {
       MBeanServerConnection server = getServer();




More information about the jboss-cvs-commits mailing list