[jboss-cvs] JBossAS SVN: r67725 - in trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123: unit and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Dec 2 03:09:47 EST 2007


Author: ALRubinger
Date: 2007-12-02 03:09:47 -0500 (Sun, 02 Dec 2007)
New Revision: 67725

Added:
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessRemoteBusiness.java
Modified:
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDB.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDBBase.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/unit/MultipleInterfacesInInheritanceForMDBUnitTestCase.java
Log:
[EJBTHREE-1123] Completed test by sending Message to MDB, ensuring received

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDB.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDB.java	2007-12-02 05:53:22 UTC (rev 67724)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDB.java	2007-12-02 08:09:47 UTC (rev 67725)
@@ -35,8 +35,10 @@
  */
 @MessageDriven(activationConfig = {
       @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
-      @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/ejbthree1123") })
+      @ActivationConfigProperty(propertyName = "destination", propertyValue = TestMDB.QUEUE_NAME) })
 public class TestMDB extends TestMDBBase implements MessageListener
 {
-
+   // Class Members
+   
+   public static final String QUEUE_NAME = "queue/ejbthree1123";
 }

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDBBase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDBBase.java	2007-12-02 05:53:22 UTC (rev 67724)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestMDBBase.java	2007-12-02 08:09:47 UTC (rev 67725)
@@ -21,8 +21,10 @@
  */
 package org.jboss.ejb3.test.ejbthree1123;
 
+import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageListener;
+import javax.jms.TextMessage;
 
 import org.jboss.logging.Logger;
 
@@ -41,6 +43,17 @@
    
    public void onMessage(Message message)
    {
-      log.info("Message received: " + message);
+      // Log
+      try
+      {
+         log.info("Message received: " + ((TextMessage)message).getText());
+      }
+      catch (JMSException e)
+      {
+         throw new RuntimeException(e);
+      }
+      
+      // Notify the remotely-exposed EJB that we've got the message
+      TestStatelessBean.IS_MESSAGE_RECEIVED = true;
    }
 }

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessBean.java	2007-12-02 08:09:47 UTC (rev 67725)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1123;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * A Stateless EJB used to determine whether a message has been 
+ * received by the MDB
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+
+ at Stateless
+ at Remote(TestStatelessRemoteBusiness.class)
+ at RemoteBinding(jndiBinding=TestStatelessRemoteBusiness.JNDI_NAME)
+public class TestStatelessBean implements TestStatelessRemoteBusiness
+{
+   // Class Members
+   public static boolean IS_MESSAGE_RECEIVED = false;
+
+   // Required Implementations
+   
+   public boolean isMessageReceived()
+   {
+      return TestStatelessBean.IS_MESSAGE_RECEIVED;
+   }
+   
+   public void clearStatus()
+   {
+      TestStatelessBean.IS_MESSAGE_RECEIVED = false;
+   }
+
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessRemoteBusiness.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessRemoteBusiness.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessRemoteBusiness.java	2007-12-02 08:09:47 UTC (rev 67725)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1123;
+
+/**
+ * Remote Business Interface for the EJB reporting whether a message has
+ * been received by the MDB
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public interface TestStatelessRemoteBusiness
+{
+   String JNDI_NAME = "TestStatelessBean/remote";
+
+   boolean isMessageReceived();
+   
+   void clearStatus();
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/TestStatelessRemoteBusiness.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/unit/MultipleInterfacesInInheritanceForMDBUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/unit/MultipleInterfacesInInheritanceForMDBUnitTestCase.java	2007-12-02 05:53:22 UTC (rev 67724)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1123/unit/MultipleInterfacesInInheritanceForMDBUnitTestCase.java	2007-12-02 08:09:47 UTC (rev 67725)
@@ -21,8 +21,15 @@
  */
 package org.jboss.ejb3.test.ejbthree1123.unit;
 
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+
 import junit.framework.Test;
 
+import org.jboss.ejb3.test.ejbthree1123.TestMDB;
+import org.jboss.ejb3.test.ejbthree1123.TestStatelessRemoteBusiness;
 import org.jboss.test.JBossTestCase;
 
 /**
@@ -50,10 +57,30 @@
    // Tests 
 
    /**
-    * Test 
+    * Test that the MDB with multiple business interfaces (defined through inheritance)
+    * successfully deploys and receives a test message
     */
-   public void testMultipleOccurancesOfSameInterfaceInInheritanceForMDB() throws Exception
+   public void testMultipleInterfacesViaInheritanceForMDB() throws Exception
    {
-      fail("NYI; Deployment currently fails due to Classloading error.");
+      // Send a Message to the Queue
+      Queue queue = (Queue) this.getInitialContext().lookup(TestMDB.QUEUE_NAME);
+      QueueConnectionFactory factory = (QueueConnectionFactory) this.getInitialContext().lookup("ConnectionFactory");
+      QueueConnection qConnection = factory.createQueueConnection();
+      QueueSession session = qConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+      session.createSender(queue).send(
+            session.createTextMessage("\n\nRustic Overtones of Portland, ME.  Listen to them.  \n\nL,\nALR\n"));
+      session.close();
+      qConnection.close();
+
+      // Wait for processing; async task
+      this.sleep(5000);
+
+      // Ensure the message was received; denotes that the MDB deployed OK
+      TestStatelessRemoteBusiness ejb = (TestStatelessRemoteBusiness) this.getInitialContext().lookup(
+            TestStatelessRemoteBusiness.JNDI_NAME);
+      assertEquals(true, ejb.isMessageReceived());
+      
+      // Clear status for next run
+      ejb.clearStatus();
    }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list