[jboss-cvs] JBossAS SVN: r70902 - in branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684: ejb3/src/main/org/jboss/ejb3/mdb and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 17 07:13:11 EDT 2008


Author: darran.lofthouse at jboss.com
Date: 2008-03-17 07:13:11 -0400 (Mon, 17 Mar 2008)
New Revision: 70902

Added:
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/resources/test/ear/eartest-mq-service.xml
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/QueueTestMDB.java
Modified:
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/build-test.xml
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/thirdparty/
Log:
[JBPAPP-684] NoInitialContextException on deployment of EAR that contains MDB and persistence.xml.

Modified: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/build-test.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/build-test.xml	2008-03-17 09:46:49 UTC (rev 70901)
+++ branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/build-test.xml	2008-03-17 11:13:11 UTC (rev 70902)
@@ -645,6 +645,7 @@
       <jar jarfile="${build.lib}/ear-session.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/ear/Facade*.class"/>
+	        <include name="org/jboss/ejb3/test/ear/Queue*.class"/>
          </fileset>
          <fileset dir="${resources}/test/ear/ejbref">
             <include name="META-INF/persistence.xml"/>
@@ -674,7 +675,15 @@
             <include name="earpu.jar"/>
          </zipfileset>
       </ear>
-
+	
+	  <mq2jbm basedir="${resources}/test/mdb"/>
+   	
+   	  <copy todir="${build.lib}">
+         <fileset dir="${resources}/test/ear">
+            <include name="*-service.xml"/>
+         </fileset>
+      </copy>
+      
    </target>
 
    <target name="dependency"
@@ -1591,7 +1600,41 @@
          </fileset>
       </jar>
    </target>
+	
+   <target name="jaccpropagation"
+      description="Builds all jar files."
+      depends="compile-classes">
 
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/jaccpropagation-ejbs.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/jaccpropagation/*.class"/>
+            <exclude name="org/jboss/ejb3/test/jaccpropagation/War*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/jaccpropagation">
+            <include name="*.properties"/>
+            <include name="META-INF/jboss.xml"/>
+         </fileset>
+      </jar>
+
+      <war warfile="${build.lib}/jaccpropagation.war"
+         webxml="${build.resources}/test/jaccpropagation/WEB-INF/test-web.xml">
+         <webinf dir="${build.resources}/test/jaccpropagation/WEB-INF">
+            <include name="jboss-web.xml"/>
+         </webinf>
+         <classes dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/jaccpropagation/servlets/**"/>
+         </classes>
+      </war>
+      
+      <copy todir="${build.lib}">
+         <fileset dir="${resources}/test/jaccpropagation">
+            <include name="jaccpropagation-security-service.xml"/>
+         </fileset>
+      </copy>
+   </target>
+
    <target name="servlet"
       description="Builds all jar files."
       depends="compile-classes">
@@ -3565,7 +3608,7 @@
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree785, ejbthree832, ejbthree921,
       ejbthree959, ejbthree963, ejbthree994, ejbthree1023, ejbthree1025, ejbthree1062,
-      jbas4489, epcpropagation,
+      jbas4489, epcpropagation, jaccpropagation, 
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, jaxws,
       pkg, securitydomain, enventry, 
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions, 
@@ -3594,6 +3637,9 @@
 
      <!-- These tests need extra stuff on classpath -->
       <condition property="client.run.classpath" value="security.client.classpath">
+         <equals arg1="${test}" arg2="jaccpropagation"/>
+      </condition>
+	  <condition property="client.run.classpath" value="security.client.classpath">
          <equals arg1="${test}" arg2="security"/>
       </condition>
       <condition property="client.run.classpath" value="dd.web.client.classpath">
@@ -3910,6 +3956,9 @@
       <antcall target="test" inheritRefs="true">
          <param name="test" value="ejbthree1090"/>
       </antcall>
+	  <antcall target="test" inheritRefs="true">
+         <param name="test" value="jaccpropagation"/>
+      </antcall>
       <antcall target="test" inheritRefs="true">
         <param name="test" value="ejbthree1092"/>
       </antcall>

Modified: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java	2008-03-17 09:46:49 UTC (rev 70901)
+++ branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java	2008-03-17 11:13:11 UTC (rev 70902)
@@ -559,19 +559,12 @@
    protected JMSProviderAdapter getJMSProviderAdapter()
            throws NamingException
    {
-      Context context = getInitialContext();
       //todo make this pluggable
       String providerAdapterJNDI = getProviderAdapterJNDI();
-      try
-      {
-         log.debug("Looking up provider adapter: " + providerAdapterJNDI);
+      
+      log.debug("Looking up provider adapter: " + providerAdapterJNDI);
      
-         return (JMSProviderAdapter) context.lookup(providerAdapterJNDI);
-      }
-      finally
-      {
-         context.close();
-      }
+      return (JMSProviderAdapter) getInitialContext().lookup(providerAdapterJNDI);
 
    }
 

Copied: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/resources/test/ear/eartest-mq-service.xml (from rev 69544, branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/ear/eartest-mq-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/resources/test/ear/eartest-mq-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/resources/test/ear/eartest-mq-service.xml	2008-03-17 11:13:11 UTC (rev 70902)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+
+   <mbean code="org.jboss.mq.server.jmx.Queue"
+      name="jboss.mq.destination:service=Queue,name=eartest">
+      <attribute name="JNDIName">queue/eartest</attribute>
+      <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+   </mbean>
+</server>

Modified: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java	2008-03-17 09:46:49 UTC (rev 70901)
+++ branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java	2008-03-17 11:13:11 UTC (rev 70902)
@@ -35,4 +35,6 @@
    void testEarLib();
 
    void testReferencedEntity();
+   
+   boolean receivedMessage();
 }

Modified: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java	2008-03-17 09:46:49 UTC (rev 70901)
+++ branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java	2008-03-17 11:13:11 UTC (rev 70902)
@@ -34,6 +34,8 @@
 @Stateless
 public class FacadeBean implements Facade
 {
+   public static boolean receivedMessage = false;
+   
    @PersistenceContext(unitName="earlib")
    EntityManager earlib;
 
@@ -51,4 +53,9 @@
       ReferencedEntity ref = new ReferencedEntity();
       ejbref.persist(ref);
    }
+   
+   public boolean receivedMessage()
+   {
+      return receivedMessage;
+   }
 }

Copied: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/QueueTestMDB.java (from rev 69544, branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ear/QueueTestMDB.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/QueueTestMDB.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/QueueTestMDB.java	2008-03-17 11:13:11 UTC (rev 70902)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ear;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import org.jboss.annotation.ejb.PoolClass;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at MessageDriven(name="QueueMDB", messageListenerInterface=MessageListener.class,
+      activationConfig =
+        {
+        @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+        @ActivationConfigProperty(propertyName="destination", propertyValue="queue/eartest")
+        })
+ at PoolClass(value=org.jboss.ejb3.StrictMaxPool.class, maxSize=1, timeout=10000)
+public class QueueTestMDB
+implements MessageListener
+{
+   private static final Logger log = Logger.getLogger(QueueTestMDB.class);
+   
+   public void onMessage(Message message)
+   {
+      System.out.println("+++ QueueTestMDB onMessage ");
+      
+      FacadeBean.receivedMessage = true;
+   }
+}

Modified: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java	2008-03-17 09:46:49 UTC (rev 70901)
+++ branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java	2008-03-17 11:13:11 UTC (rev 70902)
@@ -21,6 +21,15 @@
 */
 package org.jboss.ejb3.test.ear.unit;
 
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+
+import javax.naming.InitialContext;
+
 import org.jboss.test.JBossTestCase;
 import org.jboss.ejb3.test.factory.Session1;
 import org.jboss.ejb3.test.factory.Session2;
@@ -30,6 +39,7 @@
 import org.jboss.ejb3.test.factory.Entity1;
 import org.jboss.ejb3.test.factory.Entity2;
 import org.jboss.ejb3.test.factory.unit.FactoryUnitTestCase;
+import org.jboss.ejb3.test.mdb.Stateless;
 import org.jboss.ejb3.test.ear.Facade;
 import junit.framework.Test;
 
@@ -43,16 +53,12 @@
 public class EarUnitTestCase
         extends JBossTestCase
 {
-   org.apache.log4j.Logger log = getLog();
-
    static boolean deployed = false;
    static int test = 0;
 
    public EarUnitTestCase(String name)
    {
-
       super(name);
-
    }
 
    public void testEarLib() throws Exception
@@ -66,10 +72,30 @@
       Facade facade = (Facade)getInitialContext().lookup("ear-test/FacadeBean/remote");
       facade.testReferencedEntity();
    }
+   
+   public void testMessage() throws Exception
+   {
+      InitialContext jndiContext = new InitialContext();
+      Queue queue = (Queue) getInitialContext().lookup("queue/eartest");
+      QueueConnectionFactory factory = (QueueConnectionFactory)jndiContext.lookup("ConnectionFactory");
+      QueueConnection connection = factory.createQueueConnection();
+      QueueSession session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+      QueueSender sender = session.createSender(queue);
+      TextMessage msg = session.createTextMessage("Hello World");
 
+      sender.send(msg);
+      session.close();
+      connection.close();
+
+      Thread.sleep(2000);
+   
+      Facade facade = (Facade)getInitialContext().lookup("ear-test/FacadeBean/remote");
+      assertTrue(facade.receivedMessage());
+   }
+
    public static Test suite() throws Exception
    {
-      return getDeploySetup(EarUnitTestCase.class, "ear-test.ear");
+      return getDeploySetup(EarUnitTestCase.class, "eartest-${jboss.jms.provider}-service.xml, ear-test.ear");
    }
 
 }


Property changes on: branches/JBPAPP_4_2_0_GA_CP02_JBPAPP-684/thirdparty
___________________________________________________________________
Name: svn:ignore
   - antlr
apache-addressing
apache-avalon
apache-avalon-logkit
apache-bcel
apache-beanutils
apache-bsf
apache-codec
apache-collections
apache-digester
apache-discovery
apache-fileupload
apache-httpclient
apache-jaxme
apache-lang
apache-log4j
apache-logging
apache-modeler
apache-myfaces
apache-pool
apache-scout
apache-slide
apache-tomcat
apache-velocity
apache-wss4j
apache-xalan
apache-xerces
apache-xmlsec
beanshell
cglib
commons-el
dom4j
gjt-jpl-util
gnu-getopt
hibernate
hibernate-annotations
hibernate-entitymanager
hsqldb
ibm-wsdl4j
jacorb
javassist
jaxen
jboss
jfreechart
jgroups
joesnmp
juddi
junit
junitejb
licenses
objectweb-joramtests
odmg
oswego-concurrent
qdox
quartz
sleepycat
sun-jaf
sun-javacc
sun-javamail
sun-jaxb
sun-servlet
trove
wutka-dtdparser
xdoclet
xml-sax
libraries.ent
jbpm
testsuite-libraries.ent
sun-jsf
sun-jstl
sun-opends
stax-api
woodstox
apache-xml-commons
snmptrapappender
sun-jaxws
wscommons-policy

   + antlr
apache-addressing
apache-avalon
apache-avalon-logkit
apache-bcel
apache-beanutils
apache-bsf
apache-codec
apache-collections
apache-digester
apache-discovery
apache-fileupload
apache-httpclient
apache-jaxme
apache-lang
apache-log4j
apache-logging
apache-modeler
apache-myfaces
apache-pool
apache-scout
apache-slide
apache-tomcat
apache-velocity
apache-wss4j
apache-xalan
apache-xerces
apache-xmlsec
beanshell
cglib
commons-el
dom4j
gjt-jpl-util
gnu-getopt
hibernate
hibernate-annotations
hibernate-entitymanager
hsqldb
ibm-wsdl4j
jacorb
javassist
jaxen
jboss
jcommon
jfreechart
jgroups
joesnmp
juddi
junit
junitejb
licenses
objectweb-joramtests
odmg
oswego-concurrent
qdox
quartz
sleepycat
sun-jaf
sun-javacc
sun-javamail
sun-jaxb
sun-servlet
trove
wutka-dtdparser
xdoclet
xml-sax
libraries.ent
jbpm
testsuite-libraries.ent
sun-jsf
sun-jstl
sun-opends
stax-api
woodstox
apache-xml-commons
snmptrapappender
sun-jaxws
wscommons-policy





More information about the jboss-cvs-commits mailing list