[jboss-cvs] JBossAS SVN: r101600 - in branches/Branch_Hornet_Temporary_2/testsuite/src: main/org/jboss/test/messagedriven/beans and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 26 19:49:50 EST 2010


Author: clebert.suconic at jboss.com
Date: 2010-02-26 19:49:50 -0500 (Fri, 26 Feb 2010)
New Revision: 101600

Added:
   branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/hornetq-configuration.xml
Modified:
   branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/joram/JoramTestAdminDelegate.java
   branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/beans/TestMessageDriven.java
   branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java
   branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/ejb-jar.xml
Log:
Work on MDB tests

Modified: branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/joram/JoramTestAdminDelegate.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/joram/JoramTestAdminDelegate.java	2010-02-27 00:10:29 UTC (rev 101599)
+++ branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/joram/JoramTestAdminDelegate.java	2010-02-27 00:49:50 UTC (rev 101600)
@@ -104,7 +104,7 @@
    {
       try
       {
-         JMSTestAdmin.getAdmin().createQueue(name, name);
+         JMSTestAdmin.getAdmin().createQueue(name, new String[]{name});
       }
       catch (Exception e)
       {
@@ -128,7 +128,7 @@
    {
       try
       {
-         JMSTestAdmin.getAdmin().createTopic(name, name);
+         JMSTestAdmin.getAdmin().createTopic(name, new String[]{name});
       }
       catch (Exception e)
       {

Modified: branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/beans/TestMessageDriven.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/beans/TestMessageDriven.java	2010-02-27 00:10:29 UTC (rev 101599)
+++ branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/beans/TestMessageDriven.java	2010-02-27 00:49:50 UTC (rev 101600)
@@ -30,14 +30,14 @@
 import javax.jms.Message;
 import javax.jms.MessageListener;
 import javax.transaction.Transaction;
- 
+
 import org.jboss.logging.Logger;
 import org.jboss.mx.util.MBeanProxyExt;
 import org.jboss.test.messagedriven.mbeans.TestMessageDrivenManagementMBean;
 
 /**
- * A Test Message Driven Bean 
- *
+ * A Test Message Driven Bean
+ * 
  * @author <a href="mailto:adrian at jboss.com>Adrian Brock</a>
  * @version <tt>$Revision: 1.4</tt>
  */
@@ -47,48 +47,53 @@
    private static final long serialVersionUID = 1L;
 
    protected static final Logger log = Logger.getLogger(TestMessageDriven.class);
-   
+
    protected MessageDrivenContext ctx;
    protected TestMessageDrivenManagementMBean mbean;
-   
-   /** Replaces legacy org.jboss.ejb.plugins.jms.DLQHandler.JBOSS_ORIG_DESTINATION */
+
+   /**
+    * Replaces legacy
+    * org.jboss.ejb.plugins.jms.DLQHandler.JBOSS_ORIG_DESTINATION
+    */
    private static final String JBOSS_DESTINATION = "JBOSS_ORIG_DESTINATION";
-   
+
    public void onMessage(Message message)
    {
-      log.info("Got message: " + message);
-      mbean.addMessage(message);
-      if (isDLQ(message))
-         return;
-      logProperties();
-      logTransaction();
-      String rollback = getRollback();
-      if (rollback.equals("DLQ"))
+      synchronized (TestMessageDriven.class)
       {
-         log.info("Rollback DLQ");
-         ctx.setRollbackOnly();
+         log.info("Got message: " + message);
+         mbean.addMessage(message);
+         if (isDLQ(message))
+            return;
+         logProperties();
+         logTransaction();
+         String rollback = getRollback();
+         if (rollback.equals("DLQ"))
+         {
+            log.info("Rollback DLQ");
+            ctx.setRollbackOnly();
+         }
       }
    }
-   
+
    public boolean isDLQ(Message message)
    {
       try
       {
          if (message.getStringProperty(JBOSS_DESTINATION) != null)
             return true;
-      }
-      catch (JMSException e)
+      } catch (JMSException e)
       {
          log.error("Unhandled error", e);
       }
       return false;
    }
-   
+
    public String getRollback()
    {
       return System.getProperty("test.messagedriven.rollback", "None");
    }
-   
+
    public void logProperties()
    {
       Properties props = System.getProperties();
@@ -99,19 +104,20 @@
             log.info(key + "=" + props.getProperty(key));
       }
    }
-   
+
    public Transaction logTransaction()
    {
       Transaction tx = mbean.getTransaction();
       log.info("tx=" + tx);
       return tx;
    }
-   
+
    public void ejbCreate()
    {
-      mbean = (TestMessageDrivenManagementMBean) MBeanProxyExt.create(TestMessageDrivenManagementMBean.class, TestMessageDrivenManagementMBean.OBJECT_NAME);
+      mbean = (TestMessageDrivenManagementMBean) MBeanProxyExt.create(TestMessageDrivenManagementMBean.class,
+            TestMessageDrivenManagementMBean.OBJECT_NAME);
    }
-   
+
    public void ejbRemove()
    {
    }

Modified: branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java	2010-02-27 00:10:29 UTC (rev 101599)
+++ branches/Branch_Hornet_Temporary_2/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java	2010-02-27 00:49:50 UTC (rev 101600)
@@ -72,19 +72,19 @@
     
    static
    {
-      testQueueProps.put("destination", "queue/testQueue");
+      testQueueProps.put("destination", "testQueue");
       testQueueProps.put("destinationType", "javax.jms.Queue");
 
-      testQueueNoDestinationTypeProps.put("destination", "queue/testQueue");
+      testQueueNoDestinationTypeProps.put("destination", "testQueue");
       testQueueNoDestinationTypeProps.put("destinationType", "");
 
-      testTopicProps.put("destination", "topic/testTopic");
+      testTopicProps.put("destination", "testTopic");
       testTopicProps.put("destinationType", "javax.jms.Topic");
 
-      testTopicNoDestinationTypeProps.put("destination", "topic/testTopic");
+      testTopicNoDestinationTypeProps.put("destination", "testTopic");
       testTopicNoDestinationTypeProps.put("destinationType", "");
 
-      testDurableTopicProps.put("destination", "topic/testDurableTopic");
+      testDurableTopicProps.put("destination", "testDurableTopic");
       testDurableTopicProps.put("destinationType", "javax.jms.Topic");
       testDurableTopicProps.put("clientID", "DurableSubscriberExample");
       testDurableTopicProps.put("durability", "Durable");
@@ -124,7 +124,16 @@
       try
       {
          for (int i = 0; i < ops.length; ++i)
-            ops[i].run();
+         {
+            try
+            {
+                  ops[i].run();
+            }
+            catch (Throwable e)
+            {
+               throw new RuntimeException("Failure at operation " + i, e);
+            }
+         }
       }
       finally
       {

Modified: branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/ejb-jar.xml	2010-02-27 00:10:29 UTC (rev 101599)
+++ branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/ejb-jar.xml	2010-02-27 00:49:50 UTC (rev 101600)
@@ -25,11 +25,10 @@
                <activation-config-property-name>subscriptionDurability</activation-config-property-name>
                <activation-config-property-value>${test.messagedriven.durability}</activation-config-property-value>
             </activation-config-property>
-            <!-- When not using preconfigured client ids
             <activation-config-property>
                <activation-config-property-name>clientID</activation-config-property-name>
                <activation-config-property-value>${test.messagedriven.clientID}</activation-config-property-value>
-            </activation-config-property-->
+            </activation-config-property>
             <activation-config-property>
                <activation-config-property-name>subscriptionName</activation-config-property-name>
                <activation-config-property-value>${test.messagedriven.subscriptionName}</activation-config-property-value>

Added: branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/hornetq-configuration.xml
===================================================================
--- branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/hornetq-configuration.xml	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/testsuite/src/resources/messagedriven/jmscontainerinvoker/META-INF/hornetq-configuration.xml	2010-02-27 00:49:50 UTC (rev 101600)
@@ -0,0 +1,23 @@
+<configuration xmlns="urn:hornetq"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+   <address-settings>
+      <!--default for catch all-->
+      <address-setting match="jms.queue.*">
+         <max-delivery-attempts>5</max-delivery-attempts>
+         <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+         <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+         <redelivery-delay>0</redelivery-delay>
+         <max-size-bytes>-1</max-size-bytes>
+      </address-setting>
+      <address-setting match="jms.topic.*">
+         <max-delivery-attempts>${test.messagedriven.DLQMaxResent}</max-delivery-attempts>
+         <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+         <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+         <redelivery-delay>0</redelivery-delay>
+         <max-size-bytes>-1</max-size-bytes>
+      </address-setting>
+   </address-settings>
+
+</configuration>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list