[jboss-cvs] JBossAS SVN: r90474 - in branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src: test/org/jboss/ejb3/test and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 19 11:51:59 EDT 2009


Author: jbertram at redhat.com
Date: 2009-06-19 11:51:59 -0400 (Fri, 19 Jun 2009)
New Revision: 90474

Added:
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java
Removed:
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java
Modified:
   branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java
Log:
[JBPAPP-2084]

Modified: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java	2009-06-19 15:44:07 UTC (rev 90473)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java	2009-06-19 15:51:59 UTC (rev 90474)
@@ -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);

Copied: branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/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-2084/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-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java	2009-06-19 15:51:59 UTC (rev 90474)
@@ -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-2084/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-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java	                        (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/TXNotSupportedMDB.java	2009-06-19 15:51:59 UTC (rev 90474)
@@ -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-2084/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-2084/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-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java	2009-06-19 15:51:59 UTC (rev 90474)
@@ -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-2084/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-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_3_0_GA_CP03_JBPAPP-2084/ejb3/src/test/org/jboss/ejb3/test/ejbthree1558/unit/JBossMessageEndpointFactoryTestCase.java	2009-06-19 15:51:59 UTC (rev 90474)
@@ -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);
+   }
+}




More information about the jboss-cvs-commits mailing list