[jboss-cvs] JBossAS SVN: r64424 - in branches/JBoss_4_0_5_GA_CP/ejb3: src/main/org/jboss/ejb3 and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 2 08:26:15 EDT 2007


Author: kabir.khan at jboss.com
Date: 2007-08-02 08:26:15 -0400 (Thu, 02 Aug 2007)
New Revision: 64424

Added:
   branches/JBoss_4_0_5_GA_CP/ejb3/src/resources/test/ejbthree1023/
   branches/JBoss_4_0_5_GA_CP/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/
   branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java
Modified:
   branches/JBoss_4_0_5_GA_CP/ejb3/build-test.xml
   branches/JBoss_4_0_5_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
Log:
[EJBTHREE-1023] Fix and test for default local interface not picked up if class is woven with JBoss AOP

Modified: branches/JBoss_4_0_5_GA_CP/ejb3/build-test.xml
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/build-test.xml	2007-08-02 12:06:55 UTC (rev 64423)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/build-test.xml	2007-08-02 12:26:15 UTC (rev 64424)
@@ -264,7 +264,7 @@
       <!-- This test accesses some ejb3 classes directly -->
       <path refid="jboss.ejb3.classpath"/>
    </path>
-   
+
    <path id="dd.web.client.classpath">
       <path refid="client.classpath"/>
       <path refid="apache.httpclient.classpath"/>
@@ -274,7 +274,7 @@
       <pathelement path="${resources}/test/iiop"/>
       <path refid="client.classpath"/>
    </path>
-   
+
    <!-- The classpath required to build javadocs. -->
    <path id="javadoc.classpath">
       <path refid="javac.classpath"/>
@@ -453,7 +453,7 @@
             <include name="org/jboss/ejb3/test/jca/inflow/*.class"/>
          </fileset>
       </jar>
-      
+
       <jar jarfile="${build.lib}/jcainflow.rar">
          <fileset dir="${build.lib}">
             <include name="jcainflow.jar"/>
@@ -468,7 +468,7 @@
             <include name="*.xml"/>
          </fileset>
       </copy>
-      
+
    </target>
 
    <target name="cache"
@@ -1051,9 +1051,9 @@
    <target name="unauthenticatedprincipal"
       description="Builds all jar files."
       depends="compile-classes">
-      
+
       <mkdir dir="${build.lib}"/>
-      
+
       <jar jarfile="${build.lib}/unauthenticatedprincipal.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/unauthenticatedprincipal/*.class"/>
@@ -1394,20 +1394,20 @@
          </fileset>
       </jar>
    </target>
-   
+
    <target name="clusteredservice"
       description="Builds all jar files."
       depends="compile-classes">
-      
+
       <mkdir dir="${build.lib}"/>
-      
+
       <jar jarfile="${build.lib}/clusteredservice.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/clusteredservice/*.class"/>
             <exclude name="org/jboss/ejb3/test/clusteredservice/ServiceWeb.class"/>
          </fileset>
       </jar>
-      
+
       <war warfile="${build.lib}/clusteredservice.war"
          webxml="${build.resources}/test/clusteredservice/WEB-INF/web.xml">
          <classes dir="${build.classes}">
@@ -1597,6 +1597,23 @@
       </jar>
    </target>
 
+   <target name="ejbthree1023"
+      description="Builds a simple jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/ejbthree1023.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ejbthree1023/*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/ejbthree1023">
+            <include name="*.xml"/>
+         </fileset>
+      </jar>
+
+   </target>
+
    <target name="wolfc"
       description="Builds all jar files."
       depends="compile-classes">
@@ -1915,13 +1932,13 @@
          </fileset>
       </jar>
    </target>
-   
+
    <target name="mdbtransactions"
       description="Builds all jar files."
       depends="compile-classes">
-      
+
       <mkdir dir="${build.lib}"/>
-      
+
       <jar jarfile="${build.lib}/mdbtransactions-test.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/mdbtransactions/*.class"/>
@@ -1931,7 +1948,7 @@
             <include name="META-INF/persistence.xml"/>
          </fileset>
       </jar>
-      
+
       <jar jarfile="${build.lib}/mdbtransactions21-test.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/mdbtransactions/*21.class"/>
@@ -1941,7 +1958,7 @@
             <include name="META-INF/jboss.xml"/>
          </fileset>
       </jar>
-      
+
       <copy todir="${build.lib}">
          <fileset dir="${resources}/test/mdbtransactions">
             <include name="*.xml"/>
@@ -2096,13 +2113,13 @@
             <include name="META-INF/*.xml"/>
          </fileset>
       </jar>
-      
+
       <copy todir="${build.lib}">
          <fileset dir="${resources}/test/mdb">
             <include name="*.xml"/>
          </fileset>
       </copy>
-      
+
    </target>
 
    <target name="concurrent"
@@ -2170,13 +2187,13 @@
          </fileset>
       </jar>
    </target>
-   
+
    <!--target name="concurrent"
       description="Builds all jar files."
       depends="compile-classes">
-      
+
       <mkdir dir="${build.lib}"/>
-      
+
       <jar jarfile="${build.lib}/concurrent-test.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/concurrent/**/*.class"/>
@@ -2349,13 +2366,13 @@
          </fileset>
       </jar>
    </target>
-   
+
    <target name="invoker"
       description="Builds all jar files."
       depends="compile-classes">
-      
+
       <mkdir dir="${build.lib}"/>
-      
+
       <jar jarfile="${build.lib}/invoker-test.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/invoker/*.class"/>
@@ -2591,16 +2608,17 @@
          </fileset>
       </jar>
    </target>
-   
-   <target name="jars" depends="arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
-      circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ejbthree440, 
-      ejbthree454, ejbthree653, ejbthree670, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
-      securitydomain, enventry, 
-      jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions, 
-      exception, dd/override, stateless, dd/mdb, bank, dd, longlived, xmlcfg, hbm, regressionHHH275, 
-      entityexception, asynchronous, consumer, clusteredentity, secondary, stateful, service, lob, cache, initial, 
-      timer, benchmark, entity, joininheritance, singletable, tableperclass, dependent, mdb, manytomany, regression, 
-      composite, composite2, entitycallback, relationships, ssl, ssladvanced, clusteredsession, strictpool, jacc, 
+
+   <target name="jars" depends="arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader,
+      circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ejbthree440,
+      ejbthree454, ejbthree653, ejbthree670, ejbthree1023,
+      aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
+      securitydomain, enventry,
+      jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions,
+      exception, dd/override, stateless, dd/mdb, bank, dd, longlived, xmlcfg, hbm, regressionHHH275,
+      entityexception, asynchronous, consumer, clusteredentity, secondary, stateful, service, lob, cache, initial,
+      timer, benchmark, entity, joininheritance, singletable, tableperclass, dependent, mdb, manytomany, regression,
+      composite, composite2, entitycallback, relationships, ssl, ssladvanced, clusteredsession, strictpool, jacc,
       localcall, interceptors, interceptors2, iiop, clientinterceptor"/>
 
    <target name="test" depends="init" if="test"
@@ -2644,7 +2662,7 @@
             <isset property="test.jndi.url"/>
          </not>
       </condition>
-      
+
       <junit dir="${module.output}"
          printsummary="yes"
          haltonerror="false"
@@ -2839,8 +2857,8 @@
       </java>
    </target>
 
-   
 
+
    <target name="run" depends="init" if="class"
       description="Execute all tests in the given test directory.">
       <java fork="true" classname="${class}">
@@ -2914,6 +2932,9 @@
          <param name="test" value="regression/ejbthree231"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree1023"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="clientinterceptors"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
@@ -3196,14 +3217,14 @@
             <include name="lib/**"/>
          </patternset>
       </create-config>
-     
+
       <start-jboss conf="arjuna" host="${node0}" jboss.dist="${ejb3.dist}"/>
       <wait-on-host/>
-      
+
       <antcall target="test" inheritRefs="true">
          <param name="test" value="arjuna"/>
       </antcall>
-      
+
       <stop-jboss jboss.dist="${ejb3.dist}"/>
       <wait-on-shutdown conf="arjuna"/>
    </target>
@@ -3263,7 +3284,7 @@
       <stop-jboss jboss.dist="${ejb3.dist}"/>
       <wait-on-shutdown conf="ejb3-ssl-advanced"/>
    </target>
-   
+
    <target name="invoker-test" depends="init">
       <create-config baseconf="all" newconf="invoker" jboss.dist="${ejb3.dist}">
          <patternset>
@@ -3272,21 +3293,21 @@
             <include name="lib/**"/>
          </patternset>
       </create-config>
-      
+
       <start-jboss conf="invoker" host="${node0}" jboss.dist="${ejb3.dist}"/>
       <wait-on-host/>
-      
-      <property name="jvmargs" value=""/>      
-      
+
+      <property name="jvmargs" value=""/>
+
       <!--antcall target="test-with-jvmargs" inheritRefs="true">
          <param name="test" value="invoker"/>
          <param name="jvmargs" value="${jvmargs}"/>
       </antcall-->
-      
+
       <antcall target="test" inheritRefs="true">
          <param name="test" value="invoker"/>
       </antcall>
-      
+
       <stop-jboss jboss.dist="${ejb3.dist}"/>
       <wait-on-shutdown conf="invoker"/>
    </target>
@@ -3464,15 +3485,15 @@
          <param name="test.extension" value="jacorb"/>
          <param name="test.jndi.url" value="corbaloc::localhost:3528/JBoss/Naming/root"/>
       	 <!-- using jacorb -->
-         <param name="jvmargs" value="${debugFlags} 
-            -Djava.security.manager 
-            -Djava.security.policy=${resources}/security/tst.policy 
-            -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB 
-            -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton 
-            -Dorg.omg.PortableInterceptor.ORBInitializerClass.org.jboss.tm.iiop.TxClientInterceptorInitializer 
-            -Dorg.omg.PortableInterceptor.ORBInitializerClass.org.jboss.iiop.csiv2.SASClientInitializer 
-            -DORBInitRef.NameService=corbaloc::localhost:3528/JBoss/Naming/root 
-            -Djacorb.log.default.verbosity=10 
+         <param name="jvmargs" value="${debugFlags}
+            -Djava.security.manager
+            -Djava.security.policy=${resources}/security/tst.policy
+            -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB
+            -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
+            -Dorg.omg.PortableInterceptor.ORBInitializerClass.org.jboss.tm.iiop.TxClientInterceptorInitializer
+            -Dorg.omg.PortableInterceptor.ORBInitializerClass.org.jboss.iiop.csiv2.SASClientInitializer
+            -DORBInitRef.NameService=corbaloc::localhost:3528/JBoss/Naming/root
+            -Djacorb.log.default.verbosity=10
             -Djacorb.log.loggerFactory=org.jboss.util.Log4jLoggerFactory" />
       </antcall>
    </target>
@@ -3507,5 +3528,5 @@
       </antcall>
       <!-- TODO: call sunorb-test, but the report gets overwritten -->
    </target>
-   
+
 </project>

Modified: branches/JBoss_4_0_5_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-08-02 12:06:55 UTC (rev 64423)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -164,7 +164,11 @@
       Iterator<Class> it = interfaces.iterator();
       while (it.hasNext())
       {
-         if (it.next().getName().startsWith("javax.ejb")) it.remove();
+         String interfaceName = it.next().getName();
+         if (interfaceName.startsWith("javax.ejb")) it.remove();
+
+         //FIXME Other aop frameworks might add other interfaces, this should really be configurable
+         if (interfaceName.startsWith("org.jboss.aop.")) it.remove();
       }
       return interfaces;
    }
@@ -418,7 +422,7 @@
       if (ear != null) return ear.getBaseName() + "/" + name;
       return name;
    }
-   
+
    public static String getClientBindUrl(RemoteBinding binding) throws Exception
    {
       String clientBindUrl = binding.clientBindUrl();
@@ -435,7 +439,7 @@
             clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
          }
       }
-      
+
       return clientBindUrl;
    }
 }

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,8 @@
+<aop>
+	<bind pointcut="execution(* org.jboss.ejb3.test.ejbthree1023.AnnotatedLocalBean->woven())">
+		<interceptor class="org.jboss.ejb3.test.ejbthree1023.TestInterceptor"/>
+	</bind>
+	<bind pointcut="execution(* org.jboss.ejb3.test.ejbthree1023.DefaultLocalBean->woven())">
+		<interceptor class="org.jboss.ejb3.test.ejbthree1023.TestInterceptor"/>
+	</bind>
+</aop>
\ No newline at end of file

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,36 @@
+/*
+* 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.ejb3.test.ejbthree1023;
+
+import javax.ejb.Local;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Local
+public interface AnnotatedLocal
+{
+   void woven();
+   void notWoven();
+}

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,46 @@
+/*
+* 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.ejb3.test.ejbthree1023;
+
+import javax.ejb.Stateless;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+public class AnnotatedLocalBean implements AnnotatedLocal
+{
+   public static boolean woven;
+   public static boolean notWoven;
+   
+   public void notWoven()
+   {
+      notWoven = true;
+   }
+
+   public void woven()
+   {
+      woven = true;
+   }
+}

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,33 @@
+/*
+* 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.ejb3.test.ejbthree1023;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DefaultLocal
+{
+   void woven();
+   void notWoven();
+}

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,46 @@
+/*
+* 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.ejb3.test.ejbthree1023;
+
+import javax.ejb.Stateless;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+public class DefaultLocalBean implements DefaultLocal
+{
+   public static boolean woven;
+   public static boolean notWoven;
+   
+   public void notWoven()
+   {
+      notWoven = true;
+   }
+
+   public void woven()
+   {
+      woven = true;
+   }
+}

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,137 @@
+/*
+* 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.ejb3.test.ejbthree1023;
+
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+
+import org.jboss.aop.Advised;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+public class FacadeBean implements FacadeRemote
+{
+   public void callWovenBeanWithAnnotatedLocal() throws Exception
+   {
+      InitialContext ctx = new InitialContext();
+      AnnotatedLocal local = (AnnotatedLocal)ctx.lookup("AnnotatedLocalBean/local");
+   
+      if (!Advised.class.isAssignableFrom(AnnotatedLocalBean.class))
+      {
+         throw new RuntimeException("AnnotatedLocalBean was not woven");
+      }
+      
+      AnnotatedLocalBean.woven = false;
+      AnnotatedLocalBean.notWoven = false;
+      TestInterceptor.invoked = false;
+      
+      local.woven();
+      
+      if (!AnnotatedLocalBean.woven)
+      {
+         throw new RuntimeException("woven was not called");
+      }
+      if (AnnotatedLocalBean.notWoven)
+      {
+         throw new RuntimeException("notWoven was called");
+      }
+      if (!TestInterceptor.invoked)
+      {
+         throw new RuntimeException("TestInterceptor was not invoked");
+      }
+      
+      AnnotatedLocalBean.woven = false;
+      AnnotatedLocalBean.notWoven = false;
+      TestInterceptor.invoked = false;
+
+      local.notWoven();
+      
+      if (AnnotatedLocalBean.woven)
+      {
+         throw new RuntimeException("woven was called");
+      }
+      if (!AnnotatedLocalBean.notWoven)
+      {
+         throw new RuntimeException("notWoven was not called");
+      }
+      if (TestInterceptor.invoked)
+      {
+         throw new RuntimeException("TestInterceptor was invoked");
+      }
+      
+   }
+   
+   public void callWovenBeanWithDefaultLocal() throws Exception
+   {
+      InitialContext ctx = new InitialContext();
+      DefaultLocal local = (DefaultLocal)ctx.lookup("DefaultLocalBean/local");
+
+      if (!Advised.class.isAssignableFrom(DefaultLocalBean.class))
+      {
+         throw new RuntimeException("DefaultLocalBean was not woven");
+      }
+      
+      DefaultLocalBean.woven = false;
+      DefaultLocalBean.notWoven = false;
+      TestInterceptor.invoked = false;
+      
+      local.woven();
+      
+      if (!DefaultLocalBean.woven)
+      {
+         throw new RuntimeException("woven was not called");
+      }
+      if (DefaultLocalBean.notWoven)
+      {
+         throw new RuntimeException("notWoven was called");
+      }
+      if (!TestInterceptor.invoked)
+      {
+         throw new RuntimeException("TestInterceptor was not invoked");
+      }
+      
+      DefaultLocalBean.woven = false;
+      DefaultLocalBean.notWoven = false;
+      TestInterceptor.invoked = false;
+
+      local.notWoven();
+      
+      if (DefaultLocalBean.woven)
+      {
+         throw new RuntimeException("woven was called");
+      }
+      if (!DefaultLocalBean.notWoven)
+      {
+         throw new RuntimeException("notWoven was not called");
+      }
+      if (TestInterceptor.invoked)
+      {
+         throw new RuntimeException("TestInterceptor was invoked");
+      }
+      
+   }
+
+}

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,36 @@
+/*
+* 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.ejb3.test.ejbthree1023;
+
+import javax.ejb.Remote;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Remote
+public interface FacadeRemote
+{
+   void callWovenBeanWithAnnotatedLocal() throws Exception;
+   void callWovenBeanWithDefaultLocal() throws Exception;
+}

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,46 @@
+/*
+* 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.ejb3.test.ejbthree1023;
+
+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 $
+ */
+public class TestInterceptor implements Interceptor
+{
+   public static boolean invoked;
+   public String getName()
+   {
+      return null;
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      invoked = true;
+      return invocation.invokeNext();
+   }
+
+}

Added: branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java	2007-08-02 12:26:15 UTC (rev 64424)
@@ -0,0 +1,141 @@
+/*
+* 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.ejb3.test.ejbthree1023.unit;
+
+import javax.management.Attribute;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.ejb3.test.ejbthree1023.FacadeRemote;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.JBossTestSetup;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DefaultLocalInterfaceWovenBeanTestCase extends JBossTestCase
+{
+
+   public DefaultLocalInterfaceWovenBeanTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testAnnotatedLocalInterfaceWovenBean() throws Exception
+   {
+      //Just a sanity test
+      InitialContext ctx = getInitialContext();
+      FacadeRemote facade = (FacadeRemote)ctx.lookup("FacadeBean/remote");
+      facade.callWovenBeanWithAnnotatedLocal();
+   }
+   
+   public void testDefaultLocalInterfaceWovenBean() throws Exception
+   {
+      //The real test for this issue
+      InitialContext ctx = getInitialContext();
+      FacadeRemote facade = (FacadeRemote)ctx.lookup("FacadeBean/remote");
+      facade.callWovenBeanWithDefaultLocal();
+   }
+   
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+      suite.addTest(new TestSuite(DefaultLocalInterfaceWovenBeanTestCase.class));
+
+      AOPTestSetup setup = new AOPTestSetup(suite, "ejbthree1023.jar");
+      return setup; 
+   }
+
+   static class AOPTestSetup extends JBossTestSetup
+   {
+      public static String ASPECT_MANAGER_NAME = "jboss.aop:service=AspectManager";
+
+      private String jar;
+      private String originalInclude;
+
+      // Create an initializer for the test suite
+      AOPTestSetup(TestSuite suite, String jar) throws Exception
+      {
+         super(suite);
+         this.jar = jar;
+      }
+
+      protected void setUp() throws Exception
+      {
+         super.setUp();
+         ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
+        
+         originalInclude = (String)getServer().getAttribute(aspectManager, "Include");
+         Attribute include = new Attribute("Include", originalInclude + ", org.jboss.ejb3.test.");
+         getServer().setAttribute(aspectManager, include);
+         
+         Attribute enableTransformer = new Attribute("EnableTransformer", Boolean.TRUE);
+         getServer().setAttribute(aspectManager, enableTransformer);
+         try
+         {
+            redeploy(jar);
+         }
+         catch(Exception e)
+         {
+            // Reset the EnableTransformer to false
+            try
+            {
+               enableTransformer = new Attribute("EnableTransformer", Boolean.FALSE);
+               getServer().setAttribute(aspectManager, enableTransformer);
+            }
+            catch(Exception ex)
+            {
+               getLog().error("Failed to set EnableTransformer to false", ex);
+            }
+            throw e;
+         }
+      }
+      protected void tearDown() throws Exception
+      {
+         Exception undeployException = null;
+         try
+         {
+            undeploy(jar);
+         }
+         catch(Exception e)
+         {
+            undeployException = e;
+         }
+         ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
+         
+         Attribute include = new Attribute("Include", originalInclude);
+         getServer().setAttribute(aspectManager, include);
+         
+         
+         Attribute enableTransformer = new Attribute("EnableTransformer", Boolean.FALSE);
+         getServer().setAttribute(aspectManager, enableTransformer);
+         if( undeployException != null )
+            throw undeployException;
+         super.tearDown();
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list