[jboss-cvs] JBossAS SVN: r64425 - in branches/Branch_4_2/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:31:12 EDT 2007
Author: kabir.khan at jboss.com
Date: 2007-08-02 08:31:12 -0400 (Thu, 02 Aug 2007)
New Revision: 64425
Added:
branches/Branch_4_2/ejb3/src/resources/test/ejbthree1023/
branches/Branch_4_2/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java
Modified:
branches/Branch_4_2/ejb3/build-test.xml
branches/Branch_4_2/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/Branch_4_2/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_2/ejb3/build-test.xml 2007-08-02 12:26:15 UTC (rev 64424)
+++ branches/Branch_4_2/ejb3/build-test.xml 2007-08-02 12:31:12 UTC (rev 64425)
@@ -1851,6 +1851,23 @@
</copy>
</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="jbas4489"
description="Builds a simple jar files."
depends="compile-classes">
@@ -3285,7 +3302,7 @@
<target name="jars" depends="localfromremote, clusteredjms, entityoptimisticlocking, concurrentnaming, propertyreplacement, persistenceunits, invalidtxmdb, descriptortypo, libdeployment, homeinterface, timestampentity, servicexmbean, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader,
circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440,
ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree832, ejbthree921,
- ejbthree959, ejbthree963, ejbthree994,
+ ejbthree959, ejbthree963, ejbthree994, ejbthree1023,
jbas4489,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, jaxws,
pkg, securitydomain, enventry,
@@ -3822,6 +3839,9 @@
<param name="test" value="ejbthree994"/>
</antcall>
<antcall target="test" inheritRefs="true">
+ <param name="test" value="ejbthree1023"/>
+ </antcall>
+ <antcall target="test" inheritRefs="true">
<param name="test" value="jbas4489"/>
</antcall>
</target>
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2007-08-02 12:26:15 UTC (rev 64424)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -185,7 +185,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;
}
Added: branches/Branch_4_2/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml
===================================================================
--- branches/Branch_4_2/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml (rev 0)
+++ branches/Branch_4_2/ejb3/src/resources/test/ejbthree1023/ejbthree1023-aop.xml 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocal.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/AnnotatedLocalBean.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocal.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/DefaultLocalBean.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeBean.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/FacadeRemote.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/TestInterceptor.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1023/unit/DefaultLocalInterfaceWovenBeanTestCase.java 2007-08-02 12:31:12 UTC (rev 64425)
@@ -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