[jboss-cvs] JBossAS SVN: r97757 - in branches/JBPAPP_4_2_0_GA_CP/ejb3/src: resources and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 11 18:14:22 EST 2009
Author: jbertram at redhat.com
Date: 2009-12-11 18:14:21 -0500 (Fri, 11 Dec 2009)
New Revision: 97757
Added:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/META-INF/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java
Removed:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/META-INF/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java
Modified:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml
Log:
JBPAPP-3259
Copied: branches/JBPAPP_4_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/interceptor/EJB3TCCLInterceptor.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml 2009-12-11 21:31:47 UTC (rev 97756)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml 2009-12-11 23:14:21 UTC (rev 97757)
@@ -85,10 +85,11 @@
<interceptor factory="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory" scope="PER_CLASS"/>
<interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
<interceptor factory="org.jboss.ejb3.connectionmanager.CachedConnectionInterceptorFactory" scope="PER_CLASS"/>
-
+ <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>
@@ -289,6 +290,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"/>
@@ -376,4 +378,4 @@
</domain>
-</aop>
\ No newline at end of file
+</aop>
Copied: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876 (from rev 94177, projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1876)
Copied: branches/JBPAPP_4_2_0_GA_CP/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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ejbthree1876/META-INF/jboss-app.xml 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/QuartzIntegratedMDB.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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.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);
+ }
+
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/ResultTracker.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/SimpleSLSBean.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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.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();
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/StatelessRemote.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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_2_0_GA_CP/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_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1876/unit/EJBInvocationClassLoaderTestCase.java 2009-12-11 23:14:21 UTC (rev 97757)
@@ -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