[jbpm-commits] JBoss JBPM SVN: r6027 - in jbpm4/trunk/modules: test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Dec 22 17:06:05 EST 2009


Author: tom.baeyens at jboss.com
Date: 2009-12-22 17:06:05 -0500 (Tue, 22 Dec 2009)
New Revision: 6027

Added:
   jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/PlainJmsTest.java
Modified:
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java
   jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java
   jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java
   jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java
   jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml
Log:
JBPM-2695 jms test updates

Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java	2009-12-22 20:53:21 UTC (rev 6026)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java	2009-12-22 22:06:05 UTC (rev 6027)
@@ -31,7 +31,6 @@
 import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
 import javax.jms.QueueSession;
-import javax.jms.Session;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 

Added: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/PlainJmsTest.java
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/PlainJmsTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/PlainJmsTest.java	2009-12-22 22:06:05 UTC (rev 6027)
@@ -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.jbpm.test.jms;
+
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
+import org.apache.cactus.ServletTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class PlainJmsTest extends ServletTestCase {
+
+  public void testPlainJms() throws Exception {
+    InitialContext initialContext = new InitialContext();
+    UserTransaction userTransaction = (UserTransaction) initialContext.lookup("UserTransaction");
+    userTransaction.begin();
+    
+    Queue queue = (Queue) initialContext.lookup("queue/jbpm-test-queue");
+    QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) initialContext.lookup("XAConnectionFactory");
+    QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
+    QueueSession queueSession = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
+    QueueSender queueSender = queueSession.createSender(queue);
+    TextMessage message = queueSession.createTextMessage("hello");
+    queueSender.send(message);
+    queueSender.close();
+    queueSession.commit();
+    queueSession.close();
+    queueConnection.close();
+    
+    userTransaction.commit();
+    userTransaction.begin();
+    
+    InitialContext context = new InitialContext();
+    queueConnectionFactory = (QueueConnectionFactory) context.lookup("XAConnectionFactory");
+    queue = (Queue)context.lookup("queue/jbpm-test-queue");
+    queueConnection = queueConnectionFactory.createQueueConnection();
+    queueConnection.start();
+    queueSession = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
+    MessageConsumer messageConsumer = queueSession.createConsumer(queue);
+    message = (TextMessage) messageConsumer.receive(1000);
+    messageConsumer.close();
+    queueSession.commit();
+    queueSession.close();
+    queueConnection.stop();
+    queueConnection.close();
+
+    userTransaction.commit();
+    
+    assertNotNull(message);
+    assertEquals("hello", message.getText());
+  }
+}


Property changes on: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/PlainJmsTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java	2009-12-22 20:53:21 UTC (rev 6026)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java	2009-12-22 22:06:05 UTC (rev 6027)
@@ -1,3 +1,24 @@
+/*
+ * 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.jbpm.test.jms;
 
 import javax.jms.MapMessage;
@@ -8,21 +29,19 @@
 import org.jbpm.test.JbpmTestCase;
 
 public class QueueMapMessageTest extends JbpmTestCase {
-	
+
   public static Test suite() {
     ServletTestSuite servletTestSuite = new ServletTestSuite();
     servletTestSuite.addTestSuite(QueueMapMessageTest.class);
     return servletTestSuite;
   }
-  	
+
   protected void setUp() throws Exception {
-    super.setUp();  
+    super.setUp();
 
-    registerDeployment(repositoryService.createDeployment()
-        .addResourceFromClasspath("org/jbpm/test/jms/queue.map.process.jpdl.xml")
-        .deploy());  
+    registerDeployment(repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/test/jms/queue.map.process.jpdl.xml").deploy());
   }
-  
+
   public void testJmsText() throws Exception {
     executionService.startProcessInstanceByKey("JMS_map_queue");
     MapMessage mapMessage = (MapMessage) jmsConsumeMessageFromQueue("XAConnectionFactory", "queue/jbpm-test-queue");

Modified: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java	2009-12-22 20:53:21 UTC (rev 6026)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java	2009-12-22 22:06:05 UTC (rev 6027)
@@ -1,3 +1,24 @@
+/*
+ * 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.jbpm.test.jms;
 
 import java.util.HashMap;

Modified: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java	2009-12-22 20:53:21 UTC (rev 6026)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java	2009-12-22 22:06:05 UTC (rev 6027)
@@ -1,3 +1,24 @@
+/*
+ * 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.jbpm.test.jms;
 
 import javax.jms.TextMessage;

Modified: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml	2009-12-22 20:53:21 UTC (rev 6026)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml	2009-12-22 22:06:05 UTC (rev 6027)
@@ -7,7 +7,7 @@
   </start>
 
   <jms name="send message" 
-        connection-factory="XAConnectionFactory"
+        connection-factory="java:JmsXA"
         destination="queue/jbpm-test-queue"
         g="96,16,83,52">
     <map>



More information about the jbpm-commits mailing list