[jbpm-commits] JBoss JBPM SVN: r6007 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples and 16 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Dec 21 11:39:24 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-12-21 11:39:23 -0500 (Mon, 21 Dec 2009)
New Revision: 6007
Added:
jbpm4/trunk/modules/log/target/
jbpm4/trunk/modules/log/target/classes/
jbpm4/trunk/modules/log/target/classes/org/
jbpm4/trunk/modules/log/target/classes/org/jbpm/
jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/
jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/
jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/ConsoleHandler.class
jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/Jdk14Log.class
jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/Log4jLog.class
jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/LogFactory.class
jbpm4/trunk/modules/log/target/maven-archiver/
jbpm4/trunk/modules/log/target/maven-archiver/pom.properties
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerTest.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/jbpm.cfg.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/process.jpdl.xml
Removed:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/
Modified:
jbpm4/trunk/modules/examples/pom.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsActivity.java
jbpm4/trunk/modules/test-base/pom.xml
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Log:
JBPM-2695 added JMS test helper methods to JbpmTestCase. added JMS mock test case to module test-cfg
Modified: jbpm4/trunk/modules/examples/pom.xml
===================================================================
--- jbpm4/trunk/modules/examples/pom.xml 2009-12-21 15:20:53 UTC (rev 6006)
+++ jbpm4/trunk/modules/examples/pom.xml 2009-12-21 16:39:23 UTC (rev 6007)
@@ -37,17 +37,14 @@
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-test-base</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-jpdl</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-bpmn</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
@@ -72,24 +69,6 @@
<artifactId>spring</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.mockejb</groupId>
- <artifactId>mockejb</artifactId>
- <version>0.6-beta2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.1_3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>apache-oro</groupId>
- <artifactId>jakarta-oro</artifactId>
- <version>2.0.8</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsActivity.java 2009-12-21 15:20:53 UTC (rev 6006)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsActivity.java 2009-12-21 16:39:23 UTC (rev 6007)
@@ -24,9 +24,6 @@
import java.io.Serializable;
import java.util.List;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.ObjectMessage;
@@ -37,9 +34,7 @@
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.naming.Context;
import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.jbpm.api.JbpmException;
import org.jbpm.api.model.OpenExecution;
@@ -51,161 +46,133 @@
/**
* @author Koen Aers
+ * @author Tom Baeyens
*/
-public class JmsActivity extends JpdlAutomaticActivity
-{
+public class JmsActivity extends JpdlAutomaticActivity {
private static final Log log = Log.getLog(JmsActivity.class.getName());
private static final long serialVersionUID = 1L;
- protected String type = "text";
- protected String text = "";
- protected String expression = "";
+ protected String type = null;
+ protected String textExpression = null;
+ protected String objectExpression = null;
protected MapDescriptor mapDescriptor = null;
- protected String connectionFactoryName = "";
- protected String destinationName = "";
+ protected String connectionFactoryName = null;
+ protected String destinationName = null;
- public void perform(OpenExecution execution)
- {
- try
- {
- Context context = new InitialContext();
- if (context == null)
- return;
- ConnectionFactory connectionFactory = getConnectionFactory(context);
- if (connectionFactory == null)
- return;
- Destination destination = getDestination(context);
- if (destination instanceof Queue)
- {
- performQueueSend(connectionFactory, (Queue)destination);
+ public void perform(OpenExecution execution) {
+ try {
+ InitialContext initialContext = new InitialContext();
+
+ QueueConnectionFactory connectionFactory = (QueueConnectionFactory) initialContext.lookup(connectionFactoryName);
+ QueueConnection queueConnection = connectionFactory.createQueueConnection();
+ try {
+
+ QueueSession queueSession = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
+ try {
+
+ Queue queue = (Queue) initialContext.lookup(destinationName);
+ QueueSender queueSender = queueSession.createSender(queue);
+ try {
+ Message message = createMessage(queueSession);
+ queueSender.send(message);
+
+ } catch (Exception e) {
+ logAndRethrow(e);
+ } finally {
+ queueSender.close();
+ }
+
+ } catch (Exception e) {
+ logAndRethrow(e);
+ } finally {
+ queueSession.close();
+ }
+
+ } catch (Exception e) {
+ logAndRethrow(e);
+ } finally {
+ queueConnection.close();
}
+
+ } catch (Exception e) {
+ logAndRethrow(e);
}
- catch (JMSException e)
- {
- log.warn("JMSException while performing JmsActivity", e);
- }
- catch (NamingException e)
- {
- log.warn("NamingException while performing JmsActivity", e);
- }
}
- private Object substituteVariables(String input)
- {
- return (Object)ScriptManager.getScriptManager().evaluateExpression(input, null);
+ private void logAndRethrow(Exception e) {
+ if (e instanceof JbpmException) {
+ throw (JbpmException) e;
+ }
+ log.error("couldn't send jms message: "+e.getMessage(), e);
+ throw new JbpmException("couldn't send jms message: "+e.getMessage(), e);
}
- private void performQueueSend(ConnectionFactory connectionFactory, Queue queue) throws JMSException
- {
- if (!(connectionFactory instanceof QueueConnectionFactory))
- return;
- QueueConnection queueConnection = ((QueueConnectionFactory)connectionFactory).createQueueConnection();
- QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
- queueConnection.start();
- QueueSender queueSender = queueSession.createSender(queue);
- Message message = createMessage(queueSession);
- queueSender.send(message);
- queueSender.close();
- queueConnection.stop();
- queueConnection.close();
- queueSession.close();
- }
-
- private Message createMessage(Session session) throws JMSException {
+ private Message createMessage(Session session) throws Exception {
if ("text".equals(type)) {
return createTextMessage(session);
} else if ("object".equals(type)) {
return createObjectMessage(session);
} else if ("map".equals(type)) {
return createMapMessage(session);
- } else {
- return null;
}
+ throw new JbpmException("no type configured in jms activity");
}
-
- private MapMessage createMapMessage(Session session) throws JMSException {
+
+ private MapMessage createMapMessage(Session session) throws Exception {
MapMessage result = session.createMapMessage();
if (mapDescriptor != null) {
List<Descriptor> keyDescriptors = mapDescriptor.getKeyDescriptors();
List<Descriptor> valueDescriptors = mapDescriptor.getValueDescriptors();
for (int i = 0; i < keyDescriptors.size(); i++) {
- String key = (String)WireContext.create(keyDescriptors.get(i));
- Object value = WireContext.create(valueDescriptors.get(i));
+ String key = (String) WireContext.create(keyDescriptors.get(i));
+ Object value = (String) WireContext.create(valueDescriptors.get(i));
result.setObject(key, value);
}
}
return result;
}
-
- private TextMessage createTextMessage(Session session) throws JMSException {
- return session.createTextMessage((String)substituteVariables(text));
- }
-
- private ObjectMessage createObjectMessage(Session session) throws JMSException {
- Object object = substituteVariables(expression);
- if (!(object instanceof Serializable)) {
- throw new JbpmException(object + " is not serializable and cannot be used as payload of a jms object message");
- }
- return session.createObjectMessage((Serializable)substituteVariables(expression));
- }
- private Destination getDestination(Context context) throws NamingException
- {
- Destination result = null;
- Object object = context.lookup(destinationName);
- if (object instanceof Destination)
- {
- result = (Destination)object;
+ private TextMessage createTextMessage(Session session) throws Exception {
+ Object value = ScriptManager.getScriptManager().evaluateExpression(textExpression, null);
+ if (value!=null) {
+ return session.createTextMessage(value.toString());
}
- else
- {
- log.warn("Object bound to " + destinationName + " is no javax.jms.Destination");
- }
- return result;
+ throw new JbpmException("null value for expression '"+textExpression+"' in jms activity");
}
- private ConnectionFactory getConnectionFactory(Context context) throws NamingException
- {
- ConnectionFactory result = null;
- Object object = context.lookup(connectionFactoryName);
- if (object instanceof ConnectionFactory)
- {
- result = (ConnectionFactory)object;
+ private ObjectMessage createObjectMessage(Session session) throws Exception {
+ Object object = ScriptManager.getScriptManager().evaluateExpression(objectExpression, null);
+ if ( (object!=null)
+ && !(object instanceof Serializable)
+ ) {
+ throw new JbpmException("can't send jms message: creation of object message expression '"+objectExpression+"' must be done with serializable: "+object);
}
- else
- {
- log.warn("Object bound to " + connectionFactoryName + " is no javax.jms.ConnectionFactory");
- }
- return result;
+ return session.createObjectMessage((Serializable) object);
}
- public void setType(String type)
- {
+ public void setType(String type) {
this.type = type;
}
- public void setText(String text)
- {
- this.text = text;
+ public void setText(String text) {
+ this.textExpression = text;
}
-
+
public void setExpression(String expression) {
- this.expression = expression;
+ this.objectExpression = expression;
}
-
+
public void setMapDescriptor(MapDescriptor mapDescriptor) {
this.mapDescriptor = mapDescriptor;
}
- public void setConnectionFactoryName(String connectionFactoryName)
- {
+ public void setConnectionFactoryName(String connectionFactoryName) {
this.connectionFactoryName = connectionFactoryName;
}
- public void setDestinationName(String destinationName)
- {
+ public void setDestinationName(String destinationName) {
this.destinationName = destinationName;
}
}
Added: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/ConsoleHandler.class
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/ConsoleHandler.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/Jdk14Log.class
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/Jdk14Log.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/Log4jLog.class
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/Log4jLog.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/LogFactory.class
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/log/target/classes/org/jbpm/internal/log/LogFactory.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/log/target/maven-archiver/pom.properties
===================================================================
--- jbpm4/trunk/modules/log/target/maven-archiver/pom.properties (rev 0)
+++ jbpm4/trunk/modules/log/target/maven-archiver/pom.properties 2009-12-21 16:39:23 UTC (rev 6007)
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Mon Dec 21 17:34:35 CET 2009
+version=4.3-SNAPSHOT
+groupId=org.jbpm.jbpm4
+artifactId=jbpm-log
Property changes on: jbpm4/trunk/modules/log/target/maven-archiver/pom.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-base/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-base/pom.xml 2009-12-21 15:20:53 UTC (rev 6006)
+++ jbpm4/trunk/modules/test-base/pom.xml 2009-12-21 16:39:23 UTC (rev 6007)
@@ -68,6 +68,22 @@
<artifactId>mockrunner</artifactId>
<version>0.4.1</version>
</dependency>
+ <dependency>
+ <!-- mockrunner transitive dependency (not in mockrunner pom) -->
+ <groupId>org.mockejb</groupId>
+ <artifactId>mockejb</artifactId>
+ <version>0.6-beta2</version>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+ <!-- dependency>
+ <groupId>apache-oro</groupId>
+ <artifactId>jakarta-oro</artifactId>
+ <version>2.0.8</version>
+ </dependency -->
</dependencies>
<!-- Plugins -->
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-12-21 15:20:53 UTC (rev 6006)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-12-21 16:39:23 UTC (rev 6007)
@@ -103,7 +103,15 @@
}
}
}
+
+ public void createQueue(String connectionFactoryJndiName, String queueJndiName) {
+ MockRunnerExtensions.createQueue(connectionFactoryJndiName, queueJndiName);
+ }
+ public List getJmsMessagesFromQueue(String connectionFactoryJndiName, String queueJndiName) {
+ return MockRunnerExtensions.consumeMessage(connectionFactoryJndiName, queueJndiName);
+ }
+
protected String verifyDbClean() {
String errorMsg = null;
String recordsLeftMsg = Db.verifyClean(processEngine);
Added: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java 2009-12-21 16:39:23 UTC (rev 6007)
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jbpm.api.JbpmException;
+
+import com.mockrunner.ejb.JNDIUtil;
+import com.mockrunner.jms.JMSTestModule;
+import com.mockrunner.mock.jms.JMSMockObjectFactory;
+import com.mockrunner.mock.jms.MockQueue;
+import com.mockrunner.mock.jms.MockQueueConnectionFactory;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class MockRunnerExtensions {
+
+ static {
+ try {
+ new InitialContext().getEnvironment();
+ } catch (NamingException e) {
+ try {
+ JNDIUtil.initMockContextFactory();
+ } catch (Exception e2) {
+ e.printStackTrace();
+ throw new RuntimeException("coudn't initialize mock jndi: "+e2.getMessage(), e2);
+ }
+ }
+ }
+
+ static Map<String, JMSMockObjectFactory> jmsMockObjectFactories = new HashMap<String, JMSMockObjectFactory>();
+ static Map<String, JMSTestModule> jmsTestModules = new HashMap<String, JMSTestModule>();
+
+ public static void createQueue(String connectionFactoryJndiName, String queueJndiName) {
+ MockQueue queue = getJmsTestModule(connectionFactoryJndiName)
+ .getDestinationManager()
+ .createQueue(queueJndiName);
+
+ try {
+ new InitialContext().bind(queueJndiName, queue);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't bind mock queue '"+queueJndiName+"': "+e.getMessage(), e);
+ }
+ }
+
+ private static JMSTestModule getJmsTestModule(String connectionFactoryJndiName) {
+ JMSTestModule jmsTestModule = jmsTestModules.get(connectionFactoryJndiName);
+ if (jmsTestModule==null) {
+ JMSMockObjectFactory jmsMockObjectFactory = getMockObjectFactory(connectionFactoryJndiName);
+ jmsTestModule = new JMSTestModule(jmsMockObjectFactory);
+ jmsTestModules.put(connectionFactoryJndiName, jmsTestModule);
+ }
+ return jmsTestModule;
+ }
+
+ private static JMSMockObjectFactory getMockObjectFactory(String connectionFactoryJndiName) {
+ JMSMockObjectFactory jmsMockObjectFactory = jmsMockObjectFactories.get(connectionFactoryJndiName);
+ if (jmsMockObjectFactory==null) {
+ jmsMockObjectFactory = new JMSMockObjectFactory();
+ jmsMockObjectFactories.put(connectionFactoryJndiName, jmsMockObjectFactory);
+ MockQueueConnectionFactory mockQueueConnectionFactory = jmsMockObjectFactory.getMockQueueConnectionFactory();
+ try {
+ new InitialContext().bind(connectionFactoryJndiName, mockQueueConnectionFactory);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't bind mock queue connection factory '"+connectionFactoryJndiName+"': "+e.getMessage(), e);
+ }
+ }
+ return jmsMockObjectFactory;
+ }
+
+ public static List consumeMessage(String connectionFactoryJndiName, String queueJndiName) {
+ return getJmsTestModule(connectionFactoryJndiName).getCurrentMessageListFromQueue(queueJndiName);
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerTest.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerTest.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerTest.java 2009-12-21 16:39:23 UTC (rev 6007)
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import javax.jms.Queue;
+import javax.naming.InitialContext;
+
+import com.mockrunner.ejb.JNDIUtil;
+import com.mockrunner.jms.JMSTestModule;
+import com.mockrunner.mock.jms.JMSMockObjectFactory;
+import com.mockrunner.mock.jms.MockQueueConnectionFactory;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class MockRunnerTest extends BaseJbpmTestCase {
+
+ public void testMockRunner() throws Exception {
+ JNDIUtil.initMockContextFactory();
+ JMSMockObjectFactory jmsMockObjectFactory = new JMSMockObjectFactory();
+ MockQueueConnectionFactory mockQueueConnectionFactory = jmsMockObjectFactory.getMockQueueConnectionFactory();
+ JMSTestModule jmsTestModule = new JMSTestModule(jmsMockObjectFactory);
+
+
+ InitialContext initialContext = new InitialContext();
+
+ initialContext.bind("jms/ConnectionFactory", mockQueueConnectionFactory);
+
+ assertSame(mockQueueConnectionFactory, initialContext.lookup("jms/ConnectionFactory"));
+
+ Queue queue = jmsTestModule.getDestinationManager().createQueue("JmsActivityQueue");
+
+ initialContext.bind("queues/JmsActivityQueue", queue);
+
+ assertSame(queue, initialContext.lookup("queues/JmsActivityQueue"));
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTest.java (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTest.java 2009-12-21 16:39:23 UTC (rev 6007)
@@ -0,0 +1,63 @@
+/*
+ * 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.List;
+
+import javax.jms.MapMessage;
+
+import org.jbpm.test.JbpmCustomCfgTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JmsTest extends JbpmCustomCfgTestCase {
+
+ String deploymentId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/test/jms/process.jpdl.xml")
+ .deploy();
+
+ createQueue("jms/ConnectionFactory", "queue/ProductQueue");
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+
+ super.tearDown();
+ }
+
+ public void testSendJmsMessage() throws Exception {
+ executionService.startProcessInstanceByKey("Jms");
+
+ List messages = getJmsMessagesFromQueue("jms/ConnectionFactory", "queue/ProductQueue");
+ assertEquals(messages.toString(), 1, messages.size());
+
+ MapMessage mapMessage = (MapMessage) messages.get(0);
+ assertEquals("shampoo", mapMessage.getString("product"));
+ }
+}
Property changes on: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/jbpm.cfg.xml 2009-12-21 16:39:23 UTC (rev 6007)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.bpmn.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+
+</jbpm-configuration>
Property changes on: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/process.jpdl.xml 2009-12-21 16:39:23 UTC (rev 6007)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Jms">
+
+ <start g="20,20,48,48">
+ <transition to="send message" />
+ </start>
+
+ <jms name="send message"
+ connection-factory="jms/ConnectionFactory"
+ destination="queue/ProductQueue"
+ g="96,16,83,52">
+ <map>
+ <entry>
+ <key><string value="product"/></key>
+ <value><string value="shampoo"/></value>
+ </entry>
+ </map>
+ <transition to="wait" />
+ </jms>
+
+ <state name="wait" g="352,17,88,52"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list