[jboss-cvs] JBossAS SVN: r101602 - in branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3: src/main/org/jboss/ejb3 and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 26 22:59:43 EST 2010
Author: jbertram at redhat.com
Date: 2010-02-26 22:59:42 -0500 (Fri, 26 Feb 2010)
New Revision: 101602
Added:
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java
Removed:
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java
Modified:
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/build-test.xml
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java
branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/ejb3-interceptors-aop.xml
Log:
JBPAPP-3787
Modified: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/build-test.xml
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/build-test.xml 2010-02-27 00:59:26 UTC (rev 101601)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/build-test.xml 2010-02-27 03:59:42 UTC (rev 101602)
@@ -2078,6 +2078,26 @@
</fileset>
</jar>
</target>
+
+ <target name="ejbthree1876" description="Builds the ear and jar file(s) needed for testing EJBTHREE-1876.">
+ <mkdir dir="${build.lib}"/>
+ <!-- First build the jar file containing the EJBs -->
+ <jar jarfile="${build.lib}/ejbthree1876.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/ejb3/test/ejbthree1876/*.class"/>
+ </fileset>
+ </jar>
+ <!-- Now build the EAR and include the EJB jar and the queue-service.xml -->
+ <jar jarfile="${build.lib}/ejbthree1876.ear">
+ <fileset dir="${build.lib}">
+ <include name="ejbthree1876.jar"/>
+ </fileset>
+ <fileset dir="${resources}/test/ejbthree1876">
+ <include name="META-INF/application.xml"/>
+ <include name="META-INF/jboss-app.xml"/>
+ </fileset>
+ </jar>
+ </target>
<target name="jbas4489"
description="Builds a simple jar files."
@@ -3808,7 +3828,8 @@
ejbthree959, ejbthree963, ejbthree994, ejbthree1023, ejbthree1025, ejbthree1062,
ejbthree1109,
ejbthree1239,
- ejbthree1504,
+ ejbthree1504,
+ ejbthree1876,
jbpapp999,
jbpapp1186,
jbas4489, epcpropagation, jaccpropagation,
@@ -4439,6 +4460,9 @@
<param name="test" value="ejbthree1239"/>
</antcall>
<antcall target="test" inheritRefs="true">
+ <param name="test" value="ejbthree1876"/>
+ </antcall>
+ <antcall target="test" inheritRefs="true">
<param name="test" value="jbas4489"/>
</antcall>
<antcall target="test" inheritRefs="true">
Modified: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2010-02-27 00:59:26 UTC (rev 101601)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -57,6 +57,7 @@
import org.jboss.annotation.ejb.RemoteBindingImpl;
import org.jboss.annotation.ejb.RemoteBindings;
import org.jboss.annotation.ejb.RemoteBindingsImpl;
+import org.jboss.aop.Advisor;
import org.jboss.aop.AspectManager;
import org.jboss.aop.ClassContainer;
import org.jboss.aop.MethodInfo;
@@ -472,6 +473,19 @@
return objectName;
}
+ @SuppressWarnings("unchecked")
+ public static <C extends EJBContainer> C getEJBContainer(Advisor advisor)
+ {
+ try
+ {
+ return (C) advisor;
+ }
+ catch(ClassCastException e)
+ {
+ throw new ClassCastException(e.getMessage() + " using " + advisor);
+ }
+ }
+
public String getEjbName()
{
return ejbName;
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java (from rev 94177, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,95 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.interceptor;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.EJBContainerInvocation;
+
+/**
+ * EJB3TCCLInterceptor
+ *
+ * {@link Interceptor} responsible for setting the correct Thread context classloader (TCCL)
+ * during the EJB invocation. The {@link EJBContainer}'s classloader is set as the
+ * TCCL for the duration of this invocation. The TCCL is then reset to the original
+ * classloader.
+ *
+ * Note: The TCCL switch happens from the point when this interceptor is invoked. So
+ * ideally, this interceptor should be the first in the chain of the AOP interceptors
+ * during the EJB invocation
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+// TODO : This interceptor can be moved out of "core", but that isn't too
+// straightforward right now because the container's classloader can
+// only be obtained from EJBContainer and would effectively mean a dependency on
+// ejb3-core. There's a way to avoid this by introducing a new interface which exposes
+// the container's classloader and this interface is then implemented by the EJBContainer.
+// The other component can then rely on this new interface to get hold of the classloader.
+// But overall, that approach isn't straightforward at this point and probably not worth the
+// efforts.
+public class EJB3TCCLInterceptor implements Interceptor
+{
+
+ /**
+ * Returns the name of the interceptor
+ * @see Interceptor#getName()
+ */
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ /**
+ * Sets the TCCL to the classloader of the container so
+ * that the invocation happens in the context of the
+ * container's classloader. Finally upon return resets
+ * the TCCL to the previous classloader.
+ */
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ assert invocation instanceof EJBContainerInvocation : "Unexpected invocation type " + invocation.getClass()
+ + " - expected " + EJBContainerInvocation.class;
+
+ // get hold of the EJBContainer from the invocation
+ EJBContainer ejbContainer = EJBContainer.getEJBContainer(invocation.getAdvisor());
+
+ ClassLoader ejbContainerClassloader = ejbContainer.getClassloader();
+ ClassLoader previousClassLoader = Thread.currentThread().getContextClassLoader();
+ // TODO: Review for security manager privileged blocks
+ try
+ {
+ // Set the TCCL to the EJBContainer's classloader
+ Thread.currentThread().setContextClassLoader(ejbContainerClassloader);
+ // move on
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ // reset to original TCCL
+ Thread.currentThread().setContextClassLoader(previousClassLoader);
+ }
+ }
+
+}
Modified: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java 2010-02-27 00:59:26 UTC (rev 101601)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -186,8 +186,10 @@
TransactionManagementType mtype = TxUtil.getTransactionManagementType(container);
if (mtype == javax.ejb.TransactionManagementType.BEAN) return false;
-
- TransactionAttribute attr = (TransactionAttribute)container.resolveAnnotation(method, TransactionAttribute.class);
+ // JBPAPP-1668: the method can be called by anybody using the interface method (== unadvised)
+ Method advisedMethod = container.getMethodInfo(method).getAdvisedMethod();
+
+ TransactionAttribute attr = (TransactionAttribute)container.resolveAnnotation(advisedMethod, TransactionAttribute.class);
if (attr == null)
{
attr =(TransactionAttribute)container.resolveAnnotation(TransactionAttribute.class);
Modified: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/ejb3-interceptors-aop.xml
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/ejb3-interceptors-aop.xml 2010-02-27 00:59:26 UTC (rev 101601)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/ejb3-interceptors-aop.xml 2010-02-27 03:59:42 UTC (rev 101602)
@@ -85,9 +85,12 @@
<interceptor factory="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory" scope="PER_CLASS"/>
<interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor" scope="PER_VM"/>
+
<domain name="Stateless Bean">
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
</bind>
@@ -280,6 +283,7 @@
<interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
</bind>
<bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.mdb.MDBInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
@@ -363,4 +367,4 @@
</domain>
-</aop>
\ No newline at end of file
+</aop>
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876 (from rev 94177, projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1876)
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF (from rev 94177, projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1876/META-INF)
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1876/META-INF/jboss-app.xml 2009-09-30 19:02:30 UTC (rev 94177)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,10 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!DOCTYPE jboss-app
- PUBLIC "-//JBoss//DTD J2EE Application 1.3V2//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-app_3_2.dtd">
-
-<jboss-app>
- <loader-repository>
- jboss.ejb3.test:loader=ejbthree1876
- </loader-repository>
-</jboss-app>
\ No newline at end of file
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml (from rev 94177, projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1876/META-INF/jboss-app.xml)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,10 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE jboss-app
+ PUBLIC "-//JBoss//DTD J2EE Application 1.3V2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-app_3_2.dtd">
+
+<jboss-app>
+ <loader-repository>
+ jboss.ejb3.test:loader=ejbthree1876
+ </loader-repository>
+</jboss-app>
\ No newline at end of file
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558 (from rev 89736, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1558)
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1558/TXNotSupportedMDB.java 2009-06-03 14:27:00 UTC (rev 89736)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.core.test.ejbthree1558;
-
-import static javax.ejb.TransactionAttributeType.NOT_SUPPORTED;
-
-import javax.ejb.ActivationConfigProperty;
-import javax.ejb.MessageDriven;
-import javax.ejb.TransactionAttribute;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
-/**
- * See also JBPAPP-1668
- *
- * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
- at MessageDriven(activationConfig = {
- @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
- @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/ejbthree1558-notx"),
- @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "3") })
-public class TXNotSupportedMDB implements MessageListener
-{
- @TransactionAttribute(NOT_SUPPORTED)
- public void onMessage(Message message)
- {
- throw new RuntimeException("Not implemented");
- }
-}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java (from rev 89736, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1558/TXNotSupportedMDB.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.core.test.ejbthree1558;
+
+import static javax.ejb.TransactionAttributeType.NOT_SUPPORTED;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.TransactionAttribute;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * See also JBPAPP-1668
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/ejbthree1558-notx"),
+ @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "3") })
+public class TXNotSupportedMDB implements MessageListener
+{
+ @TransactionAttribute(NOT_SUPPORTED)
+ public void onMessage(Message message)
+ {
+ throw new RuntimeException("Not implemented");
+ }
+}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit (from rev 89736, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1558/unit)
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java 2009-06-03 14:27:00 UTC (rev 89736)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.core.test.ejbthree1558.unit;
-
-import static org.junit.Assert.assertFalse;
-
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.Properties;
-
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.resource.spi.endpoint.MessageEndpointFactory;
-
-import org.jboss.aop.Domain;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
-import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
-import org.jboss.ejb3.DeploymentUnit;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
-import org.jboss.ejb3.core.resolvers.ScopedEJBReferenceResolver;
-import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
-import org.jboss.ejb3.core.test.common.MockEjb3Deployment;
-import org.jboss.ejb3.core.test.ejbthree1558.TXNotSupportedMDB;
-import org.jboss.ejb3.mdb.MDB;
-import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
-import org.jboss.ejb3.test.common.MetaDataHelper;
-import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class JBossMessageEndpointFactoryTestCase extends AbstractEJB3TestCase
-{
- private static class MyMDB extends MDB
- {
- public MyMDB(String ejbName, Domain domain, ClassLoader cl, String beanClassName, Hashtable ctxProperties,
- Ejb3Deployment deployment, JBossMessageDrivenBeanMetaData beanMetaData) throws ClassNotFoundException
- {
- super(ejbName, domain, cl, beanClassName, ctxProperties, deployment, beanMetaData);
- }
-
- protected MessageEndpointFactory getMessageEndpointFactory()
- {
- return messageEndpointFactory;
- }
- }
-
- private static MyMDB container;
-
- @BeforeClass
- public static void beforeClass() throws Exception
- {
- AbstractEJB3TestCase.beforeClass();
-
- AbstractDeploymentUnit deploymentUnit = new AbstractDeploymentUnit(new AbstractDeploymentContext("ejbthree1558", ""));
- deploymentUnit.createClassLoader(new ClassLoaderFactory() {
- public ClassLoader createClassLoader(org.jboss.deployers.structure.spi.DeploymentUnit unit) throws Exception
- {
- return Thread.currentThread().getContextClassLoader();
- }
-
- public void removeClassLoader(org.jboss.deployers.structure.spi.DeploymentUnit unit) throws Exception
- {
- }
- });
- DeploymentUnit unit = new MockDeploymentUnit(deploymentUnit);
- Ejb3Deployment deployment = new MockEjb3Deployment(unit, deploymentUnit);
-
- deployment.setEJBReferenceResolver(new ScopedEJBReferenceResolver());
-
- Class<?> beanImplementationClasses[] = { TXNotSupportedMDB.class };
- JBossMetaData jbossMetaData = MetaDataHelper.getMetaDataFromBeanImplClasses(beanImplementationClasses);
- unit.addAttachment(AttachmentNames.PROCESSED_METADATA, jbossMetaData);
-
- String ejbName = "TXNotSupportedMDB";
- JBossMessageDrivenBeanMetaData beanMetaData = (JBossMessageDrivenBeanMetaData) jbossMetaData.getEnterpriseBean(ejbName);
- Domain domain = getDomain("Message Driven Bean");
- ClassLoader cl = deploymentUnit.getClassLoader();
- String beanClassName = beanMetaData.getEjbClass();
- Properties ctxProperties = null;
-
- container = new MyMDB(ejbName, domain, cl, beanClassName, ctxProperties, deployment, beanMetaData);
- }
-
- @Test
- public void testIsDeliveryTransacted() throws Exception
- {
- Method method = MessageListener.class.getDeclaredMethod("onMessage", Message.class);
- boolean isDeliveryTransacted = container.getMessageEndpointFactory().isDeliveryTransacted(method);
- assertFalse("TXNotSupportedMDB must not have delivery transacted", isDeliveryTransacted);
- }
-}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java (from rev 89736, projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.core.test.ejbthree1558.unit;
+
+import static org.junit.Assert.assertFalse;
+
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+
+import org.jboss.aop.Domain;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
+import org.jboss.ejb3.core.resolvers.ScopedEJBReferenceResolver;
+import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
+import org.jboss.ejb3.core.test.common.MockEjb3Deployment;
+import org.jboss.ejb3.core.test.ejbthree1558.TXNotSupportedMDB;
+import org.jboss.ejb3.mdb.MDB;
+import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
+import org.jboss.ejb3.test.common.MetaDataHelper;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JBossMessageEndpointFactoryTestCase extends AbstractEJB3TestCase
+{
+ private static class MyMDB extends MDB
+ {
+ public MyMDB(String ejbName, Domain domain, ClassLoader cl, String beanClassName, Hashtable ctxProperties,
+ Ejb3Deployment deployment, JBossMessageDrivenBeanMetaData beanMetaData) throws ClassNotFoundException
+ {
+ super(ejbName, domain, cl, beanClassName, ctxProperties, deployment, beanMetaData);
+ }
+
+ protected MessageEndpointFactory getMessageEndpointFactory()
+ {
+ return messageEndpointFactory;
+ }
+ }
+
+ private static MyMDB container;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ AbstractEJB3TestCase.beforeClass();
+
+ AbstractDeploymentUnit deploymentUnit = new AbstractDeploymentUnit(new AbstractDeploymentContext("ejbthree1558", ""));
+ deploymentUnit.createClassLoader(new ClassLoaderFactory() {
+ public ClassLoader createClassLoader(org.jboss.deployers.structure.spi.DeploymentUnit unit) throws Exception
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ public void removeClassLoader(org.jboss.deployers.structure.spi.DeploymentUnit unit) throws Exception
+ {
+ }
+ });
+ DeploymentUnit unit = new MockDeploymentUnit(deploymentUnit);
+ Ejb3Deployment deployment = new MockEjb3Deployment(unit, deploymentUnit);
+
+ deployment.setEJBReferenceResolver(new ScopedEJBReferenceResolver());
+
+ Class<?> beanImplementationClasses[] = { TXNotSupportedMDB.class };
+ JBossMetaData jbossMetaData = MetaDataHelper.getMetaDataFromBeanImplClasses(beanImplementationClasses);
+ unit.addAttachment(AttachmentNames.PROCESSED_METADATA, jbossMetaData);
+
+ String ejbName = "TXNotSupportedMDB";
+ JBossMessageDrivenBeanMetaData beanMetaData = (JBossMessageDrivenBeanMetaData) jbossMetaData.getEnterpriseBean(ejbName);
+ Domain domain = getDomain("Message Driven Bean");
+ ClassLoader cl = deploymentUnit.getClassLoader();
+ String beanClassName = beanMetaData.getEjbClass();
+ Properties ctxProperties = null;
+
+ container = new MyMDB(ejbName, domain, cl, beanClassName, ctxProperties, deployment, beanMetaData);
+ }
+
+ @Test
+ public void testIsDeliveryTransacted() throws Exception
+ {
+ Method method = MessageListener.class.getDeclaredMethod("onMessage", Message.class);
+ boolean isDeliveryTransacted = container.getMessageEndpointFactory().isDeliveryTransacted(method);
+ assertFalse("TXNotSupportedMDB must not have delivery transacted", isDeliveryTransacted);
+ }
+}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876 (from rev 94177, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876)
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java 2009-09-30 19:02:30 UTC (rev 94177)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,82 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.ejbthree1876;
-
-import javax.ejb.ActivationConfigProperty;
-import javax.ejb.EJB;
-import javax.ejb.MessageDriven;
-
-import org.jboss.ejb3.annotation.ResourceAdapter;
-import org.jboss.ejb3.test.ejbthree1876.unit.EJBInvocationClassLoaderTestCase;
-import org.jboss.logging.Logger;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-
-/**
- * QuartzIntegratedMDB
- *
- * MDB used in test case for EJBTHREE-1876 {@link EJBInvocationClassLoaderTestCase}
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
- at MessageDriven(activationConfig =
-{@ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "*/2 * * * * ?")})
- at ResourceAdapter("quartz-ra.rar")
-public class QuartzIntegratedMDB implements Job
-{
-
- /**
- * Logger
- */
- private static Logger logger = Logger.getLogger(QuartzIntegratedMDB.class);
-
- /**
- * Bean
- */
- @EJB
- private StatelessRemote bean;
-
- /**
- * Uses the injected bean to invoke an method on it
- */
- public void execute(JobExecutionContext jobContext) throws JobExecutionException
- {
- logger.info("Job " + jobContext + " at " + System.currentTimeMillis());
- try
- {
- // just call the bean
- bean.doNothing();
- logger.debug("Bean successfully invoked in MDB");
- // worked fine, so set a state in a singleton
- ResultTracker.getInstance().setPassed();
- }
- catch (Exception e)
- {
- logger.error("Exception in MDB: ", e);
- ResultTracker.getInstance().setException(e);
- }
-
- }
-
-}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java (from rev 94177, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,82 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ejbthree1876;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.EJB;
+import javax.ejb.MessageDriven;
+
+import org.jboss.annotation.ejb.ResourceAdapter;
+import org.jboss.ejb3.test.ejbthree1876.unit.EJBInvocationClassLoaderTestCase;
+import org.jboss.logging.Logger;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ * QuartzIntegratedMDB
+ *
+ * MDB used in test case for EJBTHREE-1876 {@link EJBInvocationClassLoaderTestCase}
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at MessageDriven(activationConfig =
+{@ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "*/2 * * * * ?")})
+ at ResourceAdapter("quartz-ra.rar")
+public class QuartzIntegratedMDB implements Job
+{
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(QuartzIntegratedMDB.class);
+
+ /**
+ * Bean
+ */
+ @EJB
+ private StatelessRemote bean;
+
+ /**
+ * Uses the injected bean to invoke an method on it
+ */
+ public void execute(JobExecutionContext jobContext) throws JobExecutionException
+ {
+ logger.info("Job " + jobContext + " at " + System.currentTimeMillis());
+ try
+ {
+ // just call the bean
+ bean.doNothing();
+ logger.debug("Bean successfully invoked in MDB");
+ // worked fine, so set a state in a singleton
+ ResultTracker.getInstance().setPassed();
+ }
+ catch (Exception e)
+ {
+ logger.error("Exception in MDB: ", e);
+ ResultTracker.getInstance().setException(e);
+ }
+
+ }
+
+}
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java 2009-09-30 19:02:30 UTC (rev 94177)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,83 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.ejbthree1876;
-
-/**
- * ResultTracker
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class ResultTracker
-{
- public static enum Result
- {
- SUCCESS, FAILURE;
- }
-
- private Result result = Result.FAILURE;
-
- private static ResultTracker instance;
-
- private Exception failureCause;
-
- public static synchronized ResultTracker getInstance()
- {
- if (instance == null)
- {
- instance = new ResultTracker();
- }
- return instance;
- }
-
- private ResultTracker()
- {
-
- }
-
- public Result getResult()
- {
- return this.result;
- }
-
- public void setFailed()
- {
- this.result = Result.FAILURE;
- }
-
- public void setPassed()
- {
- this.result = Result.SUCCESS;
- this.failureCause = null;
- }
-
- public void setException(Exception e)
- {
- this.result = Result.FAILURE;
- this.failureCause = e;
- }
-
- public Exception getFailureCause()
- {
- return this.failureCause;
- }
-}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java (from rev 94177, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,83 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ejbthree1876;
+
+/**
+ * ResultTracker
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class ResultTracker
+{
+ public static enum Result
+ {
+ SUCCESS, FAILURE;
+ }
+
+ private Result result = Result.FAILURE;
+
+ private static ResultTracker instance;
+
+ private Exception failureCause;
+
+ public static synchronized ResultTracker getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new ResultTracker();
+ }
+ return instance;
+ }
+
+ private ResultTracker()
+ {
+
+ }
+
+ public Result getResult()
+ {
+ return this.result;
+ }
+
+ public void setFailed()
+ {
+ this.result = Result.FAILURE;
+ }
+
+ public void setPassed()
+ {
+ this.result = Result.SUCCESS;
+ this.failureCause = null;
+ }
+
+ public void setException(Exception e)
+ {
+ this.result = Result.FAILURE;
+ this.failureCause = e;
+ }
+
+ public Exception getFailureCause()
+ {
+ return this.failureCause;
+ }
+}
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java 2009-09-30 19:02:30 UTC (rev 94177)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,83 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.ejbthree1876;
-
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.test.ejbthree1876.ResultTracker.Result;
-
-/**
- * SimpleSLSBean
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
- at Stateless
- at Remote(StatelessRemote.class)
- at RemoteBinding(jndiBinding = SimpleSLSBean.JNDI_NAME)
-public class SimpleSLSBean implements StatelessRemote
-{
-
- public static final String JNDI_NAME = "SimpleBean";
-
- public void doNothing()
- {
- // As suggested by the method name, do nothing!
-
- }
-
- public void setException(Exception e)
- {
- // just delegate to the singleton result tracker
- ResultTracker.getInstance().setException(e);
-
- }
-
- public void setFailed()
- {
- // just delegate to the singleton result tracker
- ResultTracker.getInstance().setFailed();
-
- }
-
- public void setPassed()
- {
- // just delegate to the singleton result tracker
- ResultTracker.getInstance().setPassed();
-
- }
-
- public Result getResult()
- {
- // just delegate to the singleton result tracker
- return ResultTracker.getInstance().getResult();
- }
-
- public Exception getFailureCause()
- {
- // just delegate to the singleton result tracker
- return ResultTracker.getInstance().getFailureCause();
- }
-
-}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java (from rev 94177, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,83 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ejbthree1876;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.ejb3.test.ejbthree1876.ResultTracker.Result;
+
+/**
+ * SimpleSLSBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(StatelessRemote.class)
+ at RemoteBinding(jndiBinding = SimpleSLSBean.JNDI_NAME)
+public class SimpleSLSBean implements StatelessRemote
+{
+
+ public static final String JNDI_NAME = "SimpleBean";
+
+ public void doNothing()
+ {
+ // As suggested by the method name, do nothing!
+
+ }
+
+ public void setException(Exception e)
+ {
+ // just delegate to the singleton result tracker
+ ResultTracker.getInstance().setException(e);
+
+ }
+
+ public void setFailed()
+ {
+ // just delegate to the singleton result tracker
+ ResultTracker.getInstance().setFailed();
+
+ }
+
+ public void setPassed()
+ {
+ // just delegate to the singleton result tracker
+ ResultTracker.getInstance().setPassed();
+
+ }
+
+ public Result getResult()
+ {
+ // just delegate to the singleton result tracker
+ return ResultTracker.getInstance().getResult();
+ }
+
+ public Exception getFailureCause()
+ {
+ // just delegate to the singleton result tracker
+ return ResultTracker.getInstance().getFailureCause();
+ }
+
+}
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java 2009-09-30 19:02:30 UTC (rev 94177)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.ejbthree1876;
-
-import org.jboss.ejb3.test.ejbthree1876.ResultTracker.Result;
-
-/**
- * StatelessLocal
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public interface StatelessRemote
-{
-
- void doNothing();
-
- void setPassed();
-
- void setFailed();
-
- void setException(Exception e);
-
- Result getResult();
-
- Exception getFailureCause();
-}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java (from rev 94177, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ejbthree1876;
+
+import org.jboss.ejb3.test.ejbthree1876.ResultTracker.Result;
+
+/**
+ * StatelessLocal
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface StatelessRemote
+{
+
+ void doNothing();
+
+ void setPassed();
+
+ void setFailed();
+
+ void setException(Exception e);
+
+ Result getResult();
+
+ Exception getFailureCause();
+}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit (from rev 94177, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/unit)
Deleted: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java 2009-09-30 19:02:30 UTC (rev 94177)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -1,103 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.ejbthree1876.unit;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.jboss.ejb3.test.ejbthree1876.ResultTracker;
-import org.jboss.ejb3.test.ejbthree1876.SimpleSLSBean;
-import org.jboss.ejb3.test.ejbthree1876.StatelessRemote;
-import org.jboss.logging.Logger;
-import org.jboss.test.JBossTestCase;
-
-/**
- * EJBInvocationClassLoaderTestCase
- *
- * Test case to test the fix for EJBTHREE-1876 issue (also JBAS-6314)
- *
- * The issue involved a Quartz integrated MDB, in a isolated deployment, which when
- * using a injected bean would throw CNFE for the bean/bean-interfaces.
- * The real issue was because the Quartz scheduler thread did not have the
- * correct classloader while working with the EJB containers and other
- * components. More details here http://www.jboss.org/index.html?module=bb&op=viewtopic&t=159011
- *
- *
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class EJBInvocationClassLoaderTestCase extends JBossTestCase
-{
-
- private static Logger logger = Logger.getLogger(EJBInvocationClassLoaderTestCase.class);
-
- /**
- * Constructor
- * @param name
- */
- public EJBInvocationClassLoaderTestCase(String name)
- {
- super(name);
-
- }
-
- /**
- *
- * @return
- * @throws Exception
- */
- public static Test suite() throws Exception
- {
- return getDeploySetup(EJBInvocationClassLoaderTestCase.class, "ejbthree1876.ear");
- }
-
- /**
- * Ensure that the MDB is able to invoke a method on an injected bean. The MDB
- * is configured to receive timed invocations from a Quartz scheduler. On each
- * invocation, the MDB uses an injected SLSB to invoke a method on that bean.
- * The result (success/failure) is stored on a server side {@link ResultTracker}
- * which is then accessed through the same SLSB in this testcase.
- *
- * @throws Exception
- */
- public void testBeanInvocationThroughMDB() throws Exception
- {
- // ensure that the deployment went off fine
- serverFound();
- logger.debug("Successfully deployed the ejbthree1876.ear");
-
- // upon deployment, the MDB will be invoked by the quartz scheduler
- // every 2 seconds. So let's atleast wait for 3 seconds before testing
- // whether the MDB has been invoked. If the MDB was invoked, it internally
- // we call a quick SLSB method and then set a state for success/failure.
- // We just have to check the state here
- Thread.sleep(3000);
- Context ctx = new InitialContext();
- StatelessRemote bean = (StatelessRemote) ctx.lookup(SimpleSLSBean.JNDI_NAME);
- assertNull("Exception occured while invoking injected bean's method from MDB", bean.getFailureCause());
- assertEquals("MDB could not invoke the injected bean's method", ResultTracker.Result.SUCCESS, bean.getResult());
- }
-
-}
Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java (from rev 94177, projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java)
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-3787/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java 2010-02-27 03:59:42 UTC (rev 101602)
@@ -0,0 +1,103 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ejbthree1876.unit;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1876.ResultTracker;
+import org.jboss.ejb3.test.ejbthree1876.SimpleSLSBean;
+import org.jboss.ejb3.test.ejbthree1876.StatelessRemote;
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * EJBInvocationClassLoaderTestCase
+ *
+ * Test case to test the fix for EJBTHREE-1876 issue (also JBAS-6314)
+ *
+ * The issue involved a Quartz integrated MDB, in a isolated deployment, which when
+ * using a injected bean would throw CNFE for the bean/bean-interfaces.
+ * The real issue was because the Quartz scheduler thread did not have the
+ * correct classloader while working with the EJB containers and other
+ * components. More details here http://www.jboss.org/index.html?module=bb&op=viewtopic&t=159011
+ *
+ *
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJBInvocationClassLoaderTestCase extends JBossTestCase
+{
+
+ private static Logger logger = Logger.getLogger(EJBInvocationClassLoaderTestCase.class);
+
+ /**
+ * Constructor
+ * @param name
+ */
+ public EJBInvocationClassLoaderTestCase(String name)
+ {
+ super(name);
+
+ }
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(EJBInvocationClassLoaderTestCase.class, "ejbthree1876.ear");
+ }
+
+ /**
+ * Ensure that the MDB is able to invoke a method on an injected bean. The MDB
+ * is configured to receive timed invocations from a Quartz scheduler. On each
+ * invocation, the MDB uses an injected SLSB to invoke a method on that bean.
+ * The result (success/failure) is stored on a server side {@link ResultTracker}
+ * which is then accessed through the same SLSB in this testcase.
+ *
+ * @throws Exception
+ */
+ public void testBeanInvocationThroughMDB() throws Exception
+ {
+ // ensure that the deployment went off fine
+ serverFound();
+ logger.debug("Successfully deployed the ejbthree1876.ear");
+
+ // upon deployment, the MDB will be invoked by the quartz scheduler
+ // every 2 seconds. So let's atleast wait for 3 seconds before testing
+ // whether the MDB has been invoked. If the MDB was invoked, it internally
+ // we call a quick SLSB method and then set a state for success/failure.
+ // We just have to check the state here
+ Thread.sleep(3000);
+ Context ctx = new InitialContext();
+ StatelessRemote bean = (StatelessRemote) ctx.lookup(SimpleSLSBean.JNDI_NAME);
+ assertNull("Exception occured while invoking injected bean's method from MDB", bean.getFailureCause());
+ assertEquals("MDB could not invoke the injected bean's method", ResultTracker.Result.SUCCESS, bean.getResult());
+ }
+
+}
More information about the jboss-cvs-commits
mailing list