[jbpm-commits] JBoss JBPM SVN: r6022 - in jbpm4/trunk: modules/test-base/src/main/java/org/jbpm/test and 11 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Dec 22 12:49:41 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-12-22 12:49:40 -0500 (Tue, 22 Dec 2009)
New Revision: 6022
Added:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsTopicListener.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsQueueTest.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTopicTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/queueprocess.jpdl.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/topicprocess.jpdl.xml
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
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.object.process.jpdl.xml
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.text.process.jpdl.xml
jbpm4/trunk/qa/debug.enterprise.setup.bat
jbpm4/trunk/qa/debug.jboss.setup.bat
jbpm4/trunk/qa/enterprise/
jbpm4/trunk/qa/enterprise/jbpm-test-destinations-service.xml
Removed:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java
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/process.jpdl.xml
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/JbpmJmsTestCase.java
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/map/
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/object/
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/text/
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/map/process.jpdl.xml
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/object/process.jpdl.xml
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/text/process.jpdl.xml
jbpm4/trunk/qa/debug.on.jboss.setup.bat
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/JmsBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java
jbpm4/trunk/qa/build.xml
Log:
JBPM-2695 added jms testing and udpates
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-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsActivity.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -24,6 +24,7 @@
import java.io.Serializable;
import java.util.List;
+import javax.jms.Destination;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.ObjectMessage;
@@ -34,6 +35,11 @@
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
import javax.naming.InitialContext;
import org.jbpm.api.JbpmException;
@@ -60,44 +66,90 @@
protected MapDescriptor mapDescriptor = null;
protected String connectionFactoryName = null;
protected String destinationName = null;
+ protected boolean transacted = true;
+ protected int acknowledgeMode = Session.AUTO_ACKNOWLEDGE;
public void perform(OpenExecution execution) {
try {
InitialContext initialContext = new InitialContext();
- QueueConnectionFactory connectionFactory = (QueueConnectionFactory) initialContext.lookup(connectionFactoryName);
- QueueConnection queueConnection = connectionFactory.createQueueConnection();
+ Destination destination = (Destination) initialContext.lookup(destinationName);
+ if (destination instanceof Queue) {
+ QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) initialContext.lookup(connectionFactoryName);
+ sendToQueue((Queue) destination, queueConnectionFactory);
+
+ } else if (destination instanceof Topic) {
+ TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) initialContext.lookup(connectionFactoryName);
+ sendToTopic((Topic) destination, topicConnectionFactory);
+
+ } else {
+ throw new JbpmException("invalid destination type for '"+destinationName+"': "+destination.getClass().getName());
+ }
+
+ } catch (Exception e) {
+ logAndRethrow(e);
+ }
+ }
+
+ private void sendToQueue(Queue queue, QueueConnectionFactory queueConnectionFactory) throws Exception {
+ QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
+ try {
+
+ QueueSession queueSession = queueConnection.createQueueSession(transacted, acknowledgeMode);
try {
- QueueSession queueSession = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
+ QueueSender queueSender = queueSession.createSender(queue);
try {
+ Message message = createMessage(queueSession);
+ queueSender.send(message);
- 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 {
+ queueSender.close();
+ }
+ } catch (Exception e) {
+ logAndRethrow(e);
+ } finally {
+ queueSession.close();
+ }
+
+ } catch (Exception e) {
+ logAndRethrow(e);
+ } finally {
+ queueConnection.close();
+ }
+ }
+
+ private void sendToTopic(Topic topic, TopicConnectionFactory topicConnectionFactory) throws Exception {
+ TopicConnection topicConnection = topicConnectionFactory.createTopicConnection();
+ try {
+
+ TopicSession topicSession = topicConnection.createTopicSession(transacted, acknowledgeMode);
+ try {
+
+ TopicPublisher topicPublisher = topicSession.createPublisher(topic);
+ try {
+ Message message = createMessage(topicSession);
+ topicPublisher.send(message);
+
} catch (Exception e) {
logAndRethrow(e);
} finally {
- queueSession.close();
+ topicPublisher.close();
}
-
+
} catch (Exception e) {
logAndRethrow(e);
} finally {
- queueConnection.close();
+ topicSession.close();
}
-
+
} catch (Exception e) {
logAndRethrow(e);
+ } finally {
+ topicConnection.close();
}
}
@@ -155,24 +207,31 @@
public void setType(String type) {
this.type = type;
}
-
public void setText(String text) {
this.textExpression = text;
}
-
public void setExpression(String expression) {
this.objectExpression = expression;
}
-
public void setMapDescriptor(MapDescriptor mapDescriptor) {
this.mapDescriptor = mapDescriptor;
}
-
public void setConnectionFactoryName(String connectionFactoryName) {
this.connectionFactoryName = connectionFactoryName;
}
-
public void setDestinationName(String destinationName) {
this.destinationName = destinationName;
}
+ public boolean isTransacted() {
+ return transacted;
+ }
+ public void setTransacted(boolean transacted) {
+ this.transacted = transacted;
+ }
+ public int getAcknowledgeMode() {
+ return acknowledgeMode;
+ }
+ public void setAcknowledgeMode(int acknowledgeMode) {
+ this.acknowledgeMode = acknowledgeMode;
+ }
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsBinding.java 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsBinding.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -21,6 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
+import javax.jms.Session;
+
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
@@ -31,62 +33,77 @@
/**
* @author Koen Aers
*/
-public class JmsBinding extends JpdlBinding
-{
+public class JmsBinding extends JpdlBinding {
public static final String TAG = "jms";
- public JmsBinding()
- {
+ public JmsBinding() {
super(TAG);
}
- protected JmsBinding(String tagName)
- {
+ protected JmsBinding(String tagName) {
super(tagName);
}
- public Object parseJpdl(Element element, Parse parse, JpdlParser parser)
- {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
JmsActivity jmsActivity = createJmsActivity();
+ // attributes /////////////////////////////////////////////////////////////
+
+ String connectionFactoryName = XmlUtil.attribute(element, "connection-factory", true, parse);
+ jmsActivity.setConnectionFactoryName(connectionFactoryName);
+
+ String destinationName = XmlUtil.attribute(element, "destination", true, parse);
+ jmsActivity.setDestinationName(destinationName);
+
+ Boolean transacted = XmlUtil.attributeBoolean(element, "transacted", false, parse, null);
+ if (transacted != null) {
+ jmsActivity.setTransacted(transacted);
+ }
+
+ String acknowledge = XmlUtil.attribute(element, "acknowledge");
+ if (acknowledge != null) {
+ if (acknowledge.equalsIgnoreCase("auto")) {
+ jmsActivity.setAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
+ } else if (acknowledge.equalsIgnoreCase("client")) {
+ jmsActivity.setAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
+ } else if (acknowledge.equalsIgnoreCase("dups-ok")) {
+ jmsActivity.setAcknowledgeMode(Session.DUPS_OK_ACKNOWLEDGE);
+ } else {
+ parse.addProblem("unknown jms acknowledge: '"+acknowledge+"'", element);
+ }
+ }
+
+ // elements ///////////////////////////////////////////////////////////////
+
Element textElement = XmlUtil.element(element, "text", false, parse);
- if (textElement != null)
- {
+ if (textElement != null) {
String text = XmlUtil.getContentText(textElement);
jmsActivity.setType("text");
jmsActivity.setText(text);
}
Element objectElement = XmlUtil.element(element, "object", false, parse);
- if (objectElement != null)
- {
+ if (objectElement != null) {
jmsActivity.setType("object");
jmsActivity.setExpression(XmlUtil.attribute(objectElement, "expr"));
}
-
- Element mapElement = XmlUtil.element(element, "map", false, parse);
+
+ Element mapElement = XmlUtil.element(element, "map", false, parse);
if (mapElement != null) {
jmsActivity.setType("map");
Descriptor descriptor = parser.parseDescriptor(mapElement, parse);
- if (descriptor instanceof MapDescriptor) {
- jmsActivity.setMapDescriptor((MapDescriptor)descriptor);
+ if (descriptor instanceof MapDescriptor) {
+ jmsActivity.setMapDescriptor((MapDescriptor) descriptor);
} else {
parse.addProblem("the parser did not return a descriptor of type MapDescriptor");
}
}
- String connectionFactoryName = XmlUtil.attribute(element, "connection-factory", true, parse);
- jmsActivity.setConnectionFactoryName(connectionFactoryName);
-
- String destinationName = XmlUtil.attribute(element, "destination", true, parse);
- jmsActivity.setDestinationName(destinationName);
-
return jmsActivity;
}
- protected JmsActivity createJmsActivity()
- {
+ protected JmsActivity createJmsActivity() {
return new JmsActivity();
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -70,28 +70,30 @@
return true;
}
- public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
- List<Element> transitionElements = XmlUtil.elements(element, "transition");
- UnresolvedTransitions unresolvedTransitions = parse.contextStackFind(UnresolvedTransitions.class);
- for (Element transitionElement: transitionElements) {
- String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
-
- Element timerElement = XmlUtil.element(transitionElement, "timer");
- if (timerElement!=null) {
- if (transitionName!=null) {
- TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
- timerDefinitionImpl.setSignalName(transitionName);
- } else {
- parse.addProblem("a transition name is required when a timer is placed on a transition", element);
- }
- }
-
- TransitionImpl transition = activity.createOutgoingTransition();
- transition.setName(transitionName);
-
- unresolvedTransitions.add(transition, transitionElement);
-
- jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
- }
- }
+// TODO remove this dead code
+//
+// public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
+// List<Element> transitionElements = XmlUtil.elements(element, "transition");
+// UnresolvedTransitions unresolvedTransitions = parse.contextStackFind(UnresolvedTransitions.class);
+// for (Element transitionElement: transitionElements) {
+// String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+//
+// Element timerElement = XmlUtil.element(transitionElement, "timer");
+// if (timerElement!=null) {
+// if (transitionName!=null) {
+// TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
+// timerDefinitionImpl.setSignalName(transitionName);
+// } else {
+// parse.addProblem("a transition name is required when a timer is placed on a transition", element);
+// }
+// }
+//
+// TransitionImpl transition = activity.createOutgoingTransition();
+// transition.setName(transitionName);
+//
+// unresolvedTransitions.add(transition, transitionElement);
+//
+// jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+// }
+// }
}
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-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -25,6 +25,8 @@
import java.util.List;
import java.util.Set;
+import javax.jms.Session;
+
import org.jbpm.api.Configuration;
import org.jbpm.api.Execution;
import org.jbpm.api.ExecutionService;
@@ -104,14 +106,38 @@
}
}
- public void createQueue(String connectionFactoryJndiName, String queueJndiName) {
- MockRunnerExtensions.createQueue(connectionFactoryJndiName, queueJndiName);
+ public static void jmsCreateQueue(String connectionFactoryJndiName, String queueJndiName) {
+ JmsExtensions.createQueue(connectionFactoryJndiName, queueJndiName);
}
+
+ public static Object jmsConsumeMessageFromQueue(String connectionFactoryJndiName, String queueJndiName) {
+ return jmsConsumeMessageFromQueue(connectionFactoryJndiName, queueJndiName, true, Session.AUTO_ACKNOWLEDGE, 1000);
+ }
+
+ public static Object jmsConsumeMessageFromQueue(String connectionFactoryJndiName, String queueJndiName, boolean transacted, int acknowledgeMode, long timeout) {
+ return JmsExtensions.consumeMessageFromQueue(connectionFactoryJndiName, queueJndiName, transacted, acknowledgeMode, timeout);
+ }
+
+ public static void jmsRemoveQueue(String connectionFactoryJndiName, String queueJndiName) {
+ JmsExtensions.removeQueue(connectionFactoryJndiName, queueJndiName);
+ }
+
+ public static void jmsCreateTopic(String connectionFactoryJndiName, String topicJndiName) {
+ JmsExtensions.createTopic(connectionFactoryJndiName, topicJndiName);
+ }
- public List getJmsMessagesFromQueue(String connectionFactoryJndiName, String queueJndiName) {
- return MockRunnerExtensions.consumeMessage(connectionFactoryJndiName, queueJndiName);
+ public static List<Object> jmsStartTopicListener(String connectionFactoryJndiName, String topicJndiName) {
+ return JmsExtensions.startTopicListener(connectionFactoryJndiName, topicJndiName);
}
+ public static void jmsStopTopicListener(String connectionFactoryJndiName, String topicJndiName) {
+ JmsExtensions.stopTopicListener(connectionFactoryJndiName, topicJndiName);
+ }
+
+ public static void jmsRemoveTopic(String connectionFactoryJndiName, String topicJndiName) {
+ JmsExtensions.removeTopic(connectionFactoryJndiName, topicJndiName);
+ }
+
protected String verifyDbClean() {
String errorMsg = null;
String recordsLeftMsg = Db.verifyClean(processEngine);
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java (from rev 6015, jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,197 @@
+/*
+ * 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.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import junit.framework.TestCase;
+
+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;
+import com.mockrunner.mock.jms.MockTopic;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JmsExtensions {
+
+ 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);
+
+ bindToJndi(queueJndiName, queue);
+ }
+
+ public static void removeQueue(String connectionFactoryJndiName, String queueJndiName) {
+ getJmsTestModule(connectionFactoryJndiName)
+ .getDestinationManager()
+ .removeQueue(queueJndiName);
+
+ unbindFromJndi(queueJndiName);
+ }
+
+ public static void createTopic(String connectionFactoryJndiName, String topicJndiName) {
+ MockTopic topic = getJmsTestModule(connectionFactoryJndiName)
+ .getDestinationManager()
+ .createTopic(topicJndiName);
+
+ bindToJndi(topicJndiName, topic);
+ }
+
+ public static void removeTopic(String connectionFactoryJndiName, String topicJndiName) {
+ getJmsTestModule(connectionFactoryJndiName)
+ .getDestinationManager()
+ .removeTopic(topicJndiName);
+
+ unbindFromJndi(topicJndiName);
+ }
+
+ protected static void bindToJndi(String jndiName, Object object) {
+ try {
+ new InitialContext().bind(jndiName, object);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't bind object '"+object+"' to jndi name '"+jndiName+"': "+e.getMessage(), e);
+ }
+ }
+
+ protected static void unbindFromJndi(String jndiName) {
+ try {
+ new InitialContext().unbind(jndiName);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't unbind object from jndi name '"+jndiName+"': "+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<Object> startTopicListener(String connectionFactoryJndiName, String topicJndiName) {
+ JmsTopicListener jmsTopicListener = JmsTopicListener.getJmsTopicListener(connectionFactoryJndiName, topicJndiName);
+ if (jmsTopicListener==null) {
+ jmsTopicListener = new JmsTopicListener(connectionFactoryJndiName, topicJndiName);
+ }
+
+ return jmsTopicListener.getMessages();
+ }
+
+ public static void stopTopicListener(String connectionFactoryJndiName, String topicJndiName) {
+ JmsTopicListener jmsTopicListener = JmsTopicListener.getJmsTopicListener(connectionFactoryJndiName, topicJndiName);
+ if (jmsTopicListener!=null) {
+ jmsTopicListener.stop();
+ }
+ }
+
+ public static Object consumeMessageFromQueue(String connectionFactoryJndiName, String queueJndiName, boolean transacted, int acknowledgeMode, long timeout) {
+ try {
+ InitialContext context = new InitialContext();
+ QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) context.lookup(connectionFactoryJndiName);
+ Queue queue = (Queue)context.lookup(queueJndiName);
+ QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
+ try {
+ queueConnection.start();
+ try {
+ QueueSession queueSession = queueConnection.createQueueSession(transacted, acknowledgeMode);
+ try {
+ MessageConsumer messageConsumer = queueSession.createConsumer(queue);
+ try {
+ Message message = messageConsumer.receive(timeout);
+ if (message==null) {
+ TestCase.fail("no message on queue "+queueJndiName);
+ }
+ return message;
+ } finally {
+ messageConsumer.close();
+ }
+ } finally {
+ queueSession.close();
+ }
+ } finally {
+ queueConnection.stop();
+ }
+ } finally {
+ queueConnection.close();
+ }
+
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException("couldn't receive message from queue '"+queueJndiName+"': "+e.getMessage(), e);
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsExtensions.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsTopicListener.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsTopicListener.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsTopicListener.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,133 @@
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.QueueSession;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.naming.InitialContext;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JmsTopicListener implements MessageListener {
+
+ static Map<Object, JmsTopicListener> topicListeners = new HashMap<Object, JmsTopicListener>();
+
+ TopicConnectionFactory topicConnectionFactory = null;
+ Topic topic = null;
+ TopicConnection topicConnection = null;
+ TopicSession topicSession = null;
+ TopicSubscriber topicSubscriber = null;
+
+ List<Object> messages = null;
+
+ public void onMessage(Message message) {
+ messages.add(message);
+ }
+
+ public static Object createJmsTopicListenerKey(String connectionFactoryJndiName, String topicJndiName) {
+ List<String> topicListenerKey = new ArrayList<String>();
+ topicListenerKey.add(connectionFactoryJndiName);
+ topicListenerKey.add(topicJndiName);
+ return topicListenerKey;
+ }
+
+ public static JmsTopicListener getJmsTopicListener(String connectionFactoryJndiName, String topicJndiName) {
+ return topicListeners.get(createJmsTopicListenerKey(connectionFactoryJndiName, topicJndiName));
+ }
+
+ public JmsTopicListener(String connectionFactoryJndiName, String topicJndiName) {
+ start(connectionFactoryJndiName, topicJndiName);
+ topicListeners.put(createJmsTopicListenerKey(connectionFactoryJndiName, topicJndiName), this);
+ }
+
+ private void start(String connectionFactoryJndiName, String topicJndiName) {
+ try {
+ messages = Collections.synchronizedList(new ArrayList<Object>());
+
+ InitialContext context = new InitialContext();
+ topicConnectionFactory = (TopicConnectionFactory) context.lookup(connectionFactoryJndiName);
+ topic = (Topic) context.lookup(topicJndiName);
+ topicConnection = topicConnectionFactory.createTopicConnection();
+ topicSession = topicConnection.createTopicSession(true, QueueSession.AUTO_ACKNOWLEDGE);
+ topicSubscriber = topicSession.createSubscriber(topic);
+ topicSubscriber.setMessageListener(this);
+
+ topicConnection.start();
+
+ } catch (Exception e) {
+ stop();
+ throw new RuntimeException("couldn't subscribe message listener to topic '"+topicJndiName+"': "+e.getMessage(), e);
+ }
+ }
+
+ public void stop() {
+ if (topicConnection!=null) {
+ try {
+ topicConnection.stop();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ if (topicSubscriber!=null) {
+ try {
+ topicSubscriber.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ topicSubscriber = null;
+ }
+ if (topicSession!=null) {
+ try {
+ topicSession.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ topicSession = null;
+ }
+ if (topicConnection!=null) {
+ try {
+ topicConnection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ topicConnection = null;
+ }
+ }
+
+ public List<Object> getMessages() {
+ return messages;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JmsTopicListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: 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 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MockRunnerExtensions.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,101 +0,0 @@
-/*
- * 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);
- }
-}
Copied: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsQueueTest.java (from rev 6015, 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/JmsQueueTest.java (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsQueueTest.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,60 @@
+/*
+ * 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;
+
+import org.jbpm.test.JbpmCustomCfgTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JmsQueueTest extends JbpmCustomCfgTestCase {
+
+ String deploymentId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/test/jms/queueprocess.jpdl.xml")
+ .deploy();
+
+ jmsCreateQueue("jms/ConnectionFactory", "queue/ProductQueue");
+ }
+
+ protected void tearDown() throws Exception {
+ jmsRemoveQueue("jms/ConnectionFactory", "queue/ProductQueue");
+
+ repositoryService.deleteDeploymentCascade(deploymentId);
+
+ super.tearDown();
+ }
+
+ public void testQueueMessage() throws Exception {
+ executionService.startProcessInstanceByKey("JmsQueue");
+
+ MapMessage mapMessage = (MapMessage) jmsConsumeMessageFromQueue("jms/ConnectionFactory", "queue/ProductQueue");
+ assertEquals("shampoo", mapMessage.getString("product"));
+ }
+}
Property changes on: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsQueueTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: 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 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTest.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,63 +0,0 @@
-/*
- * 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"));
- }
-}
Added: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTopicTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTopicTest.java (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jms/JmsTopicTest.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,68 @@
+/*
+ * 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 JmsTopicTest extends JbpmCustomCfgTestCase {
+
+ String deploymentId;
+ List<Object> messages;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/test/jms/topicprocess.jpdl.xml")
+ .deploy();
+
+ jmsCreateTopic("jms/ConnectionFactory", "topic/ProductTopic");
+ messages = jmsStartTopicListener("jms/ConnectionFactory", "topic/ProductTopic");
+ }
+
+ protected void tearDown() throws Exception {
+ jmsStopTopicListener("jms/ConnectionFactory", "topic/ProductTopic");
+ jmsRemoveTopic("jms/ConnectionFactory", "topic/ProductTopic");
+
+ repositoryService.deleteDeploymentCascade(deploymentId);
+
+ super.tearDown();
+ }
+
+ public void testTestTopicMessage() throws Exception {
+ executionService.startProcessInstanceByKey("JmsTopic");
+
+ 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/JmsTopicTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: 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 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/process.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,24 +0,0 @@
-<?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>
Copied: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/queueprocess.jpdl.xml (from rev 6015, 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/queueprocess.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/queueprocess.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="JmsQueue">
+
+ <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/queueprocess.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/topicprocess.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/topicprocess.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jms/topicprocess.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="JmsTopic">
+
+ <start g="20,20,48,48">
+ <transition to="send message" />
+ </start>
+
+ <jms name="send message"
+ connection-factory="jms/ConnectionFactory"
+ destination="topic/ProductTopic"
+ 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/topicprocess.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -37,53 +37,45 @@
*/
public class TaskTimerTaskTest extends JbpmTestCase {
- // Test case for JBPM-2537
public void testTaskClosedWhenTimerFires() {
deployJpdlXmlString(
- "<process name='test1'>" +
- " <start g='-9,192,48,48' name='start1'>" +
- " <transition g='-44,-18' name='to task3' to='task3' />" +
+ "<process name='TaskTimer'>" +
+ " <start name='start'>" +
+ " <transition to='do work' />" +
" </start>" +
- " <task g='272,189,92,52' name='task1'>" +
- " <transition g='-42,-18' name='to end1' to='end1' />" +
- " <transition g='-45,-18' name='to wait' to='waitHere'>" +
+ " <task name='do work' assignee='johndoe'>" +
+ " <transition name='done' to='go home' />" +
+ " <transition name='lunch' to='go to cafeteria'>" +
" <timer duedate='10 seconds' />" +
" </transition>" +
" </task>" +
- " <task g='454,316,92,52' name='task2'>" +
- " <transition g='-42,-18' name='to end2' to='end2' />" +
- " </task>" +
- " <task g='113,189,92,52' name='task3'>" +
- " <transition g='-44,-18' to='task1' name='to end1' />" +
- " </task>" +
- " <state name='waitHere'>" +
- " <transition to='end1' />" +
- " </state>" +
- " <end g='490,192,48,48' name='end1' />" +
- " <end g='626,319,48,48' name='end2' />" +
+ " <state name='go home' />" +
+ " <state name='go to cafeteria' />" +
"</process>");
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("test1");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskTimer");
- Task currentTask = taskService.createTaskQuery().uniqueResult();
- assertEquals("task3", currentTask.getName());
- taskService.completeTask(currentTask.getId());
+ assertEquals(1, taskService.createTaskQuery()
+ .assignee("johndoe")
+ .list()
+ .size() );
- currentTask = taskService.createTaskQuery().uniqueResult();
- assertEquals("task1", currentTask.getName());
+ Job timer = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .timers()
+ .uniqueResult();
- Job timeout = managementService.createJobQuery().timers().uniqueResult();
- managementService.executeJob(timeout.getId());
+ assertNotNull(timer);
- assertActivityActive(processInstance.getId(), "waitHere");
+ managementService.executeJob(timer.getId());
- // Task1 should be completed now
- List<Task> currentTasks = taskService.createTaskQuery().list();
-
- // TODO: Uncomment when fixing issue!
- // assertTrue("Error: there are still tasks active: "
- // + listAllOpenTasks(processInstance.getId()), currentTasks.isEmpty());
+ assertActivityActive(processInstance.getId(), "go to cafeteria");
+// TODO JBPM-2537
+// assertEquals(0, taskService.createTaskQuery()
+// .assignee("johndoe")
+// .list()
+// .size() );
}
Deleted: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/JbpmJmsTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/JbpmJmsTestCase.java 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/JbpmJmsTestCase.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,56 +0,0 @@
-package org.jbpm.test.jms;
-
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.apache.cactus.ServletTestSuite;
-import org.jbpm.test.JbpmTestCase;
-
-public abstract class JbpmJmsTestCase extends JbpmTestCase {
-
- String deploymentId;
-
- protected QueueConnection queueConnection = null;
- protected QueueSession queueSession = null;
- protected MessageConsumer messageConsumer = null;
-
- public static Test suite() {
- ServletTestSuite servletTestSuite = new ServletTestSuite();
- servletTestSuite.addTestSuite(JbpmJmsTestCase.class);
- return servletTestSuite;
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- setUpJms();
- }
-
- protected void setUpJms() throws Exception {
- Context context = new InitialContext();
- QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory)context.lookup("ConnectionFactory");
- Queue queue = (Queue)context.lookup("queue/jbpm-test-queue");
- queueConnection = (QueueConnection)queueConnectionFactory.createConnection();
- queueSession = queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
- queueConnection.start();
- messageConsumer = queueSession.createConsumer(queue);
- }
-
- protected void tearDown() throws Exception {
- tearDownJms();
- super.tearDown();
- }
-
- protected void tearDownJms() throws Exception {
- queueConnection.stop();
- queueSession.close();
- queueConnection.close();
- }
-
-}
Copied: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java (from rev 6015, jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/map/MapMessageTest.java)
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java (rev 0)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,33 @@
+package org.jbpm.test.jms;
+
+import javax.jms.MapMessage;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestSuite;
+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();
+
+ 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");
+ assertTrue(mapMessage.itemExists("x"));
+ assertEquals("foo", mapMessage.getObject("x"));
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueMapMessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java (from rev 6015, jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/object/ObjectMessageTest.java)
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java (rev 0)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,37 @@
+package org.jbpm.test.jms;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.ObjectMessage;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestSuite;
+import org.jbpm.test.JbpmTestCase;
+
+public class QueueObjectMessageTest extends JbpmTestCase {
+
+ public static Test suite() {
+ ServletTestSuite servletTestSuite = new ServletTestSuite();
+ servletTestSuite.addTestSuite(QueueObjectMessageTest.class);
+ return servletTestSuite;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ registerDeployment(repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/test/jms/queue.object.process.jpdl.xml")
+ .deploy());
+ }
+
+ public void testQueueMessage() throws Exception {
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("object", "this is the object");
+ executionService.startProcessInstanceByKey("JMS_object_queue", variables);
+ ObjectMessage objectMessage = (ObjectMessage) jmsConsumeMessageFromQueue("XAConnectionFactory", "queue/jbpm-test-queue");
+ assertEquals("this is the object", objectMessage.getObject());
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueObjectMessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java (from rev 6015, jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/text/TextMessageTest.java)
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java (rev 0)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,30 @@
+package org.jbpm.test.jms;
+
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestSuite;
+import org.jbpm.test.JbpmTestCase;
+
+public class QueueTextMessageTest extends JbpmTestCase {
+
+ public static Test suite() {
+ ServletTestSuite servletTestSuite = new ServletTestSuite();
+ servletTestSuite.addTestSuite(QueueTextMessageTest.class);
+ return servletTestSuite;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registerDeployment(repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/test/jms/queue.text.process.jpdl.xml")
+ .deploy());
+ }
+
+ public void testQueueMessage() throws Exception {
+ executionService.startProcessInstanceByKey("JMS_text_queue");
+ TextMessage textMessage = (TextMessage) jmsConsumeMessageFromQueue("XAConnectionFactory", "queue/jbpm-test-queue");
+ assertEquals("This is the body", textMessage.getText());
+ }
+}
Property changes on: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/QueueTextMessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.messaging.destination:service=Queue,name=jbpm-test-queue"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
-</server>
\ No newline at end of file
Deleted: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/map/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/map/process.jpdl.xml 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/map/process.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="JMS_map_queue" xmlns="http://jbpm.org/4.3/jpdl">
-
- <start g="20,20,48,48">
- <transition to="send message" />
- </start>
-
- <jms name="send message"
- connection-factory="ConnectionFactory"
- destination="queue/jbpm-test-queue"
- g="96,16,83,52">
- <map>
- <entry>
- <key><string value="x"/></key>
- <value><string value="foo"/></value>
- </entry>
- </map>
- <transition to="wait" />
- </jms>
-
- <state name="wait" g="352,17,88,52"/>
-
-</process>
Deleted: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/object/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/object/process.jpdl.xml 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/object/process.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="JMS_object_queue" xmlns="http://jbpm.org/4.3/jpdl">
-
- <start g="20,20,48,48">
- <transition to="send message" />
- </start>
-
- <jms name="send message"
- connection-factory="ConnectionFactory"
- destination="queue/jbpm-test-queue"
- g="96,16,83,52">
- <object expr="${object}"/>
- <transition to="wait" />
- </jms>
-
- <state name="wait" g="352,17,88,52"/>
-
-</process>
Copied: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml (from rev 6015, jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/map/process.jpdl.xml)
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="JMS_map_queue">
+
+ <start g="20,20,48,48">
+ <transition to="send message" />
+ </start>
+
+ <jms name="send message"
+ connection-factory="XAConnectionFactory"
+ destination="queue/jbpm-test-queue"
+ g="96,16,83,52">
+ <map>
+ <entry>
+ <key><string value="x"/></key>
+ <value><string value="foo"/></value>
+ </entry>
+ </map>
+ <transition to="wait" />
+ </jms>
+
+ <state name="wait" g="352,17,88,52"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.map.process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.object.process.jpdl.xml (from rev 6015, jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/object/process.jpdl.xml)
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.object.process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.object.process.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="JMS_object_queue">
+
+ <start g="20,20,48,48">
+ <transition to="send message" />
+ </start>
+
+ <jms name="send message"
+ connection-factory="XAConnectionFactory"
+ destination="queue/jbpm-test-queue"
+ g="96,16,83,52">
+ <object expr="${object}"/>
+ <transition to="wait" />
+ </jms>
+
+ <state name="wait" g="352,17,88,52"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.object.process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.text.process.jpdl.xml (from rev 6015, jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/text/process.jpdl.xml)
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.text.process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.text.process.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="JMS_text_queue">
+
+ <start g="20,20,48,48">
+ <transition to="send message" />
+ </start>
+
+ <jms name="send message"
+ connection-factory="XAConnectionFactory"
+ destination="queue/jbpm-test-queue"
+ g="96,16,83,52">
+ <text>This is the body</text>
+ <transition to="wait" />
+ </jms>
+
+ <state name="wait" g="352,17,88,52"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/queue.text.process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/text/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/text/process.jpdl.xml 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/jms/text/process.jpdl.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="JMS_text_queue" xmlns="http://jbpm.org/4.3/jpdl">
-
- <start g="20,20,48,48">
- <transition to="send message" />
- </start>
-
- <jms name="send message"
- connection-factory="ConnectionFactory"
- destination="queue/jbpm-test-queue"
- g="96,16,83,52">
- <text>This is the body</text>
- <transition to="wait" />
- </jms>
-
- <state name="wait" g="352,17,88,52"/>
-
-</process>
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/qa/build.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -28,10 +28,6 @@
<property name="jbpm.distro.dir" value="../modules/distro/target" />
<property name="jbpm.distro.path" value="${jbpm.distro.dir}/jbpm-${jbpm.version}.zip" />
- <condition property="is.hsqldb">
- <equals arg1="${database}" arg2="hsqldb" />
- </condition>
-
<condition property="is.oracle">
<equals arg1="${database}" arg2="oracle" />
</condition>
@@ -59,6 +55,10 @@
<ant antfile="${jbpm.home}/install/build.xml" target="drop.jbpm.schema" />
</target>
+ <!-- ################ -->
+ <!-- ### TOMCAT ### -->
+ <!-- ################ -->
+
<!-- TOMCAT SETUP -->
<target name="testsuite.tomcat.setup"
depends="reinstall.jbpm">
@@ -105,57 +105,88 @@
<ant antfile="${jbpm.home}/install/build.xml" target="stop.hsqldb.server" />
</target>
+ <!-- ################ -->
+ <!-- ### JBOSS ### -->
+ <!-- ################ -->
+
<!-- JBOSS SETUP -->
<target name="testsuite.jboss.setup"
- depends="jboss.test.setup.base"
+ depends="internal.jboss.test.setup.base"
description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
- <!-- start hsqldb -->
<ant antfile="${jbpm.home}/install/build.xml" target="start.hsqldb.server" />
<ant antfile="${jbpm.home}/install/build.xml" target="create.jbpm.schema" />
-
- <!-- start jboss -->
<ant antfile="${jbpm.home}/install/build.xml" target="start.jboss" />
</target>
+ <!-- JBOSS TEARDOWN -->
+ <target name="testsuite.jboss.teardown"
+ description="drops the jbpm schema and stops jboss">
+ <ant antfile="${jbpm.home}/install/build.xml" target="stop.jboss" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="drop.jbpm.schema" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="stop.hsqldb.server" />
+ </target>
+
+ <!-- JBOSS SETUP DEBUG -->
<target name="testsuite.jboss.setup.for.debug"
- depends="jboss.test.setup.base"
+ depends="internal.jboss.test.setup.base"
description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
- <!-- start hsqldb -->
<ant antfile="${jbpm.home}/install/build.xml" target="start.hsqldb.server" />
<ant antfile="${jbpm.home}/install/build.xml" target="create.jbpm.schema" />
- <!-- enable debug on jboss -->
<ant antfile="${jbpm.home}/install/build.xml" target="enable.jboss.debug" />
</target>
- <!-- JBOSS TEARDOWN -->
- <target name="testsuite.jboss.teardown"
- description="drops the jbpm schema and stops jboss">
- <ant antfile="${jbpm.home}/install/build.xml" target="stop.jboss" />
- <ant antfile="${jbpm.home}/install/build.xml" target="drop.jbpm.schema" />
- <ant antfile="${jbpm.home}/install/build.xml" target="stop.hsqldb.server" />
+ <!-- JBOSS INTERNAL SETUP BASE -->
+ <target name="internal.jboss.test.setup.base"
+ depends="reinstall.jbpm">
+ <ant antfile="${jbpm.home}/install/build.xml" target="reinstall.jboss" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="install.jbpm.into.jboss" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="create.user.webapp" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="install.hsqldb.server" />
+
+ <!-- to build the jbpm test webapp we start by copying the user webapp -->
+ <mkdir dir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war" />
+ <copy todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war">
+ <fileset dir="${jbpm.home}/install/generated/user-webapp"/>
+ </copy>
+
+ <!-- customize the jbpm configuration for the testsuite -->
+ <copy todir="${jboss.home}/server/default/deploy/jbpm/jbpm-service.sar" overwrite="true">
+ <fileset dir="jboss.jbpm.cfg" />
+ </copy>
+
+ <!-- customize the configuration for the jbpm-test-webapp -->
+ <copy todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war" overwrite="true">
+ <fileset dir="cactus.webapp.cfg" />
+ </copy>
+
+ <!-- delete the jbpm configuration files -->
+ <delete dir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/classes" />
+ <delete file="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib/jta.jar" />
+
+ <!-- add examples.jar -->
+ <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
+ <copy file="${jbpm.home}/examples/target/examples.jar" todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
+
+ <!-- add junit.jar -->
+ <copy file="${jbpm.home}/lib/junit.jar" todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
+
+ <!-- add the cactus libs -->
+ <copy todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib">
+ <fileset dir="../modules/test-cactus/target/jbpm.test.webapp.libs" />
+ </copy>
</target>
-
+
+
+ <!-- ################# -->
+ <!-- ### ENTERPRISE ## -->
+ <!-- ################# -->
+
<!-- ENTERPRISE SETUP -->
<target name="testsuite.enterprise.setup"
- depends="jboss.test.setup.base"
+ depends="internal.enterprise.test.setup.base"
description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
-
- <!-- create the test queue -->
- <copy file="../modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml"
- todir="${jboss.home}/server/default/deploy/jbpm-test" />
-
- <!-- deploy the test ejbs -->
- <copy file="../modules/test-enterprise/test-enterprise-ejb/target/jbpm-test-enterprise-ejb-${jbpm.version}.jar"
- todir="${jboss.home}/server/default/deploy/jbpm-test"/>
-
- <!-- copy the test classes to the test web app -->
- <copy file="../modules/test-enterprise/test-enterprise-suite/target/jbpm-test-enterprise-suite-${jbpm.version}-tests.jar"
- todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
-
- <!-- start hsqldb -->
<ant antfile="${jbpm.home}/install/build.xml" target="start.hsqldb.server" />
<ant antfile="${jbpm.home}/install/build.xml" target="create.jbpm.schema" />
- <!-- start jboss -->
<ant antfile="${jbpm.home}/install/build.xml" target="start.jboss" />
</target>
@@ -166,7 +197,31 @@
<ant antfile="${jbpm.home}/install/build.xml" target="drop.jbpm.schema" />
<ant antfile="${jbpm.home}/install/build.xml" target="stop.hsqldb.server" />
</target>
-
+
+ <target name="testsuite.enterprise.setup.for.debug"
+ depends="internal.enterprise.test.setup.base"
+ description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
+ <ant antfile="${jbpm.home}/install/build.xml" target="start.hsqldb.server" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="create.jbpm.schema" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="enable.jboss.debug" />
+ </target>
+
+ <target name="internal.enterprise.test.setup.base"
+ depends="internal.jboss.test.setup.base"
+ description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
+ <!-- create the test queue -->
+ <copy file="enterprise/jbpm-test-destinations-service.xml"
+ todir="${jboss.home}/server/default/deploy/jbpm-test" />
+
+ <!-- deploy the test ejbs -->
+ <copy file="../modules/test-enterprise/test-enterprise-ejb/target/jbpm-test-enterprise-ejb-${jbpm.version}.jar"
+ todir="${jboss.home}/server/default/deploy/jbpm-test"/>
+
+ <!-- copy the test classes to the test web app -->
+ <copy file="../modules/test-enterprise/test-enterprise-suite/target/jbpm-test-enterprise-suite-${jbpm.version}-tests.jar"
+ todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
+ </target>
+
<!-- ################ -->
<!-- ### UPGRADE ### -->
@@ -174,11 +229,14 @@
<property name="old.jbpm.home" value="${jbpm.parent.dir}/jbpm-${old.jbpm.version}" />
<target name="testsuite.upgrade.setup" depends="reinstall.jbpm">
<fail message="old.jbpm.version is a mandatory property" unless="old.jbpm.version" />
- <!-- install old jbpm version -->
+
+ <!-- install old jbpm version -->
<delete dir="${old.jbpm.home}" />
<unzip src="upgrade/target/jbpm-distro-${old.jbpm.version}.jar" dest="${jbpm.parent.dir}" />
+
<!-- copy the oracle driver jar -->
- <antcall target="copy.oracle.driver" />
+ <antcall target="copy.oracle.driver" />
+
<!-- create jdbc properties files for PVM2 based on the originals -->
<delete dir="upgrade/target/jdbc" />
<mkdir dir="upgrade/target/jdbc" />
@@ -193,18 +251,21 @@
<copy todir="upgrade/target/jdbc" overwrite="true" failonerror="false">
<fileset dir="${user.home}/.jbpm4/jdbc" />
</copy>
- <!-- install the jbpm-test-upgrade lib -->
+
+ <!-- install the jbpm-test-upgrade lib -->
<delete dir="upgrade/target/jbpm-test-upgrade" />
<mkdir dir="upgrade/target/jbpm-test-upgrade" />
<unzip dest="upgrade/target/jbpm-test-upgrade" src="upgrade/target/jbpm-test-upgrade.jar" />
- <delete file="upgrade/target/jbpm-test-upgrade/hibernate.properties" />
+ <delete file="upgrade/target/jbpm-test-upgrade/hibernate.properties" />
+
<!-- create jbpm schema using the old jbpm distro -->
<condition property="is.old.jbpm.40">
<equals arg1="${old.jbpm.version}" arg2="4.0" />
</condition>
<antcall target="create.jbpm.schema.in.jbpm.40" />
<antcall target="create.jbpm.schema.in.jbpm.41plus" />
- <!-- start couple of processes using the old jbpm version -->
+
+ <!-- start couple of processes using the old jbpm version -->
<copy todir="upgrade/target/jbpm-test-upgrade" overwrite="true">
<fileset dir="upgrade/cfg" />
</copy>
@@ -219,15 +280,16 @@
</fileset>
</classpath>
</java>
- <!-- upgrade -->
+
+ <!-- upgrade -->
<copy todir="${jbpm.home}/install/jdbc" overwrite="true">
<fileset dir="upgrade/target/jdbc" />
</copy>
- <ant antfile="${jbpm.home}/install/build.xml" target="upgrade.jbpm.schema" inheritall="false">
- <property name="database" value="${database}" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="upgrade.jbpm.schema" inheritall="false">
+ <property name="database" value="${database}" />
<property name="tx" value="standalone.testsuite" />
<!--property name="logging" value="debug" /-->
- </ant>
+ </ant>
</target>
<target name="copy.oracle.driver" if="is.oracle">
@@ -235,21 +297,26 @@
<copy file="upgrade/target/ojdbc14.jar" todir="${jbpm.home}/lib" />
</target>
+
+ <!--
+ <condition property="is.hsqldb">
+ <equals arg1="${database}" arg2="hsqldb" />
+ </condition>
<target name="start.hsqldb" if="is.hsqldb">
<delete dir="upgrade/target/hsqldb" />
- <mkdir dir="upgrade/target/hsqldb" />
- <java classname="org.hsqldb.Server" dir="upgrade/target/hsqldb" fork="true">
- <arg line="-address localhost -port 1701 -dbname.0 jbpmDatabase" />
- <classpath>
- <fileset dir="upgrade/target">
- <include name="hsqldb.jar"/>
- </fileset>
- </classpath>
- </java>
+ <mkdir dir="upgrade/target/hsqldb" />
+ <java classname="org.hsqldb.Server" dir="upgrade/target/hsqldb" fork="true">
+ <arg line="-address localhost -port 1701 -dbname.0 jbpmDatabase" />
+ <classpath>
+ <fileset dir="upgrade/target">
+ <include name="hsqldb.jar"/>
+ </fileset>
+ </classpath>
+ </java>
</target>
-
+
<target name="stop.hsqldb" if="is.hsqldb">
- <property file="upgrade/target/jdbc/${database}.properties" />
+ <property file="upgrade/target/jdbc/${database}.properties" />
<path id="hsqldb.classpath">
<fileset dir="upgrade/target">
<include name="hsqldb.jar"/>
@@ -263,6 +330,7 @@
autocommit="true"
classpathref="hsqldb.classpath">SHUTDOWN</sql>
</target>
+ -->
<target name="create.jbpm.schema.in.jbpm.40" if="is.old.jbpm.40">
<echo message="creating schema in jbpm 4.0" />
@@ -270,17 +338,17 @@
<copy todir="${old.jbpm.home}/db/jdbc">
<fileset dir="upgrade/target/jdbc" />
</copy>
- <replace file="upgrade/target/jbpm-test-upgrade/jbpm.cfg.xml">
- <replacetoken><![CDATA[<import resource="jbpm.businesscalendar.cfg.xml" />]]></replacetoken>
- <replacevalue></replacevalue>
- </replace>
- <ant antfile="${old.jbpm.home}/db/build.xml" target="create.jbpm.schema" inheritall="false">
- <property name="database" value="${database}" />
- </ant>
+ <replace file="upgrade/target/jbpm-test-upgrade/jbpm.cfg.xml">
+ <replacetoken><![CDATA[<import resource="jbpm.businesscalendar.cfg.xml" />]]></replacetoken>
+ <replacevalue></replacevalue>
+ </replace>
+ <ant antfile="${old.jbpm.home}/db/build.xml" target="create.jbpm.schema" inheritall="false">
+ <property name="database" value="${database}" />
+ </ant>
<copy file="${old.jbpm.home}/db/hibernate.cfg/${database}.hibernate.cfg.xml"
- tofile="upgrade/target/jbpm-test-upgrade/jbpm.hibernate.cfg.xml"
- overwrite="true">
- <filterset filtersfile="upgrade/target/jdbc/${database}.properties" />
+ tofile="upgrade/target/jbpm-test-upgrade/jbpm.hibernate.cfg.xml"
+ overwrite="true">
+ <filterset filtersfile="upgrade/target/jdbc/${database}.properties" />
</copy>
</target>
@@ -302,62 +370,15 @@
<target name="testsuite.upgrade.teardown">
<ant antfile="${jbpm.home}/install/build.xml" target="drop.jbpm.schema" inheritall="false" />
- <antcall target="stop.hsqldb" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="stop.hsqldb.server" />
</target>
+
<!-- ############################################ -->
<!-- ### REUSABLE TARGETS ### -->
<!-- ### These targets can be called directly ### -->
<!-- ############################################ -->
- <!-- re-install jbpm and setup jboss for cactus testing -->
- <target name="jboss.test.setup.base"
- depends="reinstall.jbpm">
- <ant antfile="${jbpm.home}/install/build.xml" target="reinstall.jboss" />
- <ant antfile="${jbpm.home}/install/build.xml" target="install.jbpm.into.jboss" />
- <ant antfile="${jbpm.home}/install/build.xml" target="create.user.webapp" />
- <ant antfile="${jbpm.home}/install/build.xml" target="install.hsqldb.server" />
-
- <!-- make the example test classes and test delegation classes available as a user lib
- <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
- <mkdir dir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
- <copy file="${jbpm.home}/examples/target/examples.jar"
- todir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
- -->
-
- <!-- to build the jbpm test webapp we start by copying the user webapp -->
- <mkdir dir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war" />
- <copy todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war">
- <fileset dir="${jbpm.home}/install/generated/user-webapp"/>
- </copy>
-
- <!-- customize the jbpm configuration for the testsuite -->
- <copy todir="${jboss.home}/server/default/deploy/jbpm/jbpm-service.sar" overwrite="true">
- <fileset dir="jboss.jbpm.cfg" />
- </copy>
-
- <!-- customize the configuration for the jbpm-test-webapp -->
- <copy todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war" overwrite="true">
- <fileset dir="cactus.webapp.cfg" />
- </copy>
-
- <!-- delete the jbpm configuration files -->
- <delete dir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/classes" />
- <delete file="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib/jta.jar" />
-
- <!-- add examples.jar -->
- <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
- <copy file="${jbpm.home}/examples/target/examples.jar" todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
-
- <!-- add junit.jar -->
- <copy file="${jbpm.home}/lib/junit.jar" todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
-
- <!-- add the cactus libs -->
- <copy todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib">
- <fileset dir="../modules/test-cactus/target/jbpm.test.webapp.libs" />
- </copy>
- </target>
-
<!-- REINSTALL JBPM -->
<target name="reinstall.jbpm"
description="deletes the jbpm installation and then reinstalls jbpm">
Added: jbpm4/trunk/qa/debug.enterprise.setup.bat
===================================================================
--- jbpm4/trunk/qa/debug.enterprise.setup.bat (rev 0)
+++ jbpm4/trunk/qa/debug.enterprise.setup.bat 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,9 @@
+cmd /C mvn -U -Pdistro,integration clean install
+cmd /C ant -f qa/build.xml -Djboss.version=5.1.0.GA testsuite.enterprise.setup.for.debug
+start "JBOSS DEBUG" /DC:\Software\jbpm-4.3-SNAPSHOT\jboss-5.1.0.GA\bin run.bat
+cd modules\test-enterprise\test-enterprise-suite
+
+ at echo off
+echo
+echo after jboss booted and you connected your eclipse to it in a debug session execute following command
+echo mvn -Pruntest test
Copied: jbpm4/trunk/qa/debug.jboss.setup.bat (from rev 6015, jbpm4/trunk/qa/debug.on.jboss.setup.bat)
===================================================================
--- jbpm4/trunk/qa/debug.jboss.setup.bat (rev 0)
+++ jbpm4/trunk/qa/debug.jboss.setup.bat 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,4 @@
+ at echo off
+
+cmd /C mvn -U -Pdistro,enterprise clean install
+cmd /C ant -f qa/build.xml -Djboss.version=5.1.0.GA testsuite.enterprise.setup.for.debug
Deleted: jbpm4/trunk/qa/debug.on.jboss.setup.bat
===================================================================
--- jbpm4/trunk/qa/debug.on.jboss.setup.bat 2009-12-22 16:59:58 UTC (rev 6021)
+++ jbpm4/trunk/qa/debug.on.jboss.setup.bat 2009-12-22 17:49:40 UTC (rev 6022)
@@ -1,4 +0,0 @@
- at echo off
-
-cmd /C mvn -U -Pdistro,integration clean install
-cmd /C ant -f qa/build.xml -Djboss.version=5.1.0.GA testsuite.jboss.setup.for.debug
Copied: jbpm4/trunk/qa/enterprise/jbpm-test-destinations-service.xml (from rev 6015, jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml)
===================================================================
--- jbpm4/trunk/qa/enterprise/jbpm-test-destinations-service.xml (rev 0)
+++ jbpm4/trunk/qa/enterprise/jbpm-test-destinations-service.xml 2009-12-22 17:49:40 UTC (rev 6022)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=jbpm-test-queue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
\ No newline at end of file
Property changes on: jbpm4/trunk/qa/enterprise/jbpm-test-destinations-service.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list