[jbpm-commits] JBoss JBPM SVN: r5985 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples and 18 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Dec 17 19:39:59 EST 2009


Author: koen.aers at jboss.com
Date: 2009-12-17 19:39:59 -0500 (Thu, 17 Dec 2009)
New Revision: 5985

Added:
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/ejb/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/map/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/map/MapMessageTest.java
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/object/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/object/ObjectMessageTest.java
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/text/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/text/TextMessageTest.java
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/ejb/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/ejb/process.jpdl.xml
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/map/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/map/process.jpdl.xml
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/object/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/object/process.jpdl.xml
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/text/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/text/process.jpdl.xml
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/jms/
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/jms/JbpmJmsMockTestCase.java
Removed:
   jbpm4/trunk/modules/test-enterprise/test-enterprise-ejb/src/main/java/org/jbpm/test/enterprise/mdb/
Modified:
   jbpm4/trunk/modules/examples/.classpath
   jbpm4/trunk/modules/examples/pom.xml
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsBinding.java
   jbpm4/trunk/modules/test-base/pom.xml
   jbpm4/trunk/modules/test-cactus/pom.xml
   jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java
   jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/map/MapMessageTest.java
Log:
In memory test of the JMS activity with MockRunner

Modified: jbpm4/trunk/modules/examples/.classpath
===================================================================
--- jbpm4/trunk/modules/examples/.classpath	2009-12-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/examples/.classpath	2009-12-18 00:39:59 UTC (rev 5985)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: jbpm4/trunk/modules/examples/pom.xml
===================================================================
--- jbpm4/trunk/modules/examples/pom.xml	2009-12-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/examples/pom.xml	2009-12-18 00:39:59 UTC (rev 5985)
@@ -77,6 +77,24 @@
       <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>

Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/map/MapMessageTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/map/MapMessageTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/map/MapMessageTest.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -0,0 +1,38 @@
+package org.jbpm.examples.jms.map;
+
+import javax.jms.Connection;
+import javax.jms.MapMessage;
+import javax.jms.MessageConsumer;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+
+import org.jbpm.test.jms.JbpmJmsMockTestCase;
+
+public class MapMessageTest extends JbpmJmsMockTestCase {
+	
+  protected void setUp() throws Exception {
+    super.setUp();  
+    bindToContext("ConnectionFactory", getConnectionFactory());
+    bindToContext("queue/jbpm-test-queue", getQueue());
+    registerDeployment(repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/examples/jms/map/process.jpdl.xml")
+        .deploy());  
+  }
+  
+  public void testJmsMap() throws Exception {
+    Connection connection = getConnectionFactory().createConnection();
+    Session session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    connection.start();
+    MessageConsumer messageConsumer = session.createConsumer(getQueue());
+    
+    executionService.startProcessInstanceByKey("JMS_map_queue");
+    MapMessage mapMessage = (MapMessage)messageConsumer.receive();
+    assertTrue(mapMessage.itemExists("x"));
+    assertEquals("foo", mapMessage.getObject("x"));
+
+    connection.stop();
+    session.close();
+    connection.close();    
+  }
+
+}


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

Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/object/ObjectMessageTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/object/ObjectMessageTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/object/ObjectMessageTest.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -0,0 +1,46 @@
+package org.jbpm.examples.jms.object;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.MessageConsumer;
+import javax.jms.ObjectMessage;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+
+import org.jbpm.test.jms.JbpmJmsMockTestCase;
+
+public class ObjectMessageTest extends JbpmJmsMockTestCase
+{
+
+  protected void setUp() throws Exception
+  {
+    super.setUp();
+    bindToContext("ConnectionFactory", getConnectionFactory());
+    bindToContext("queue/jbpm-test-queue", getQueue());
+    registerDeployment(repositoryService
+        .createDeployment()
+        .addResourceFromClasspath("org/jbpm/examples/jms/object/process.jpdl.xml")
+        .deploy());
+  }
+
+  public void testQueueMessage() throws Exception
+  {
+    Connection connection = getConnectionFactory().createConnection();
+    Session session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    connection.start();
+    MessageConsumer messageConsumer = session.createConsumer(getQueue());
+    
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("object", "this is the object");
+    executionService.startProcessInstanceByKey("JMS_object_queue", variables);
+    ObjectMessage objectMessage = (ObjectMessage)messageConsumer.receive();
+    assertEquals("this is the object", objectMessage.getObject());
+
+    connection.stop();
+    session.close();
+    connection.close();    
+  }
+
+}


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

Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/text/TextMessageTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/text/TextMessageTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/jms/text/TextMessageTest.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -0,0 +1,66 @@
+/*
+ * 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.examples.jms.text;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.jbpm.test.jms.JbpmJmsMockTestCase;
+
+/**
+ * @author Koen Aers
+ */
+public class TextMessageTest extends JbpmJmsMockTestCase
+{
+
+  protected void setUp() throws Exception 
+  {
+    super.setUp();
+    bindToContext("ConnectionFactory", getConnectionFactory());
+    bindToContext("queue/jbpm-test-queue", getQueue());
+    registerDeployment(repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/examples/jms/text/process.jpdl.xml")
+        .deploy());
+  }
+
+  public void testTextMessage() throws JMSException
+  {
+    Connection connection = getConnectionFactory().createConnection();
+    Session session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    connection.start();
+    MessageConsumer messageConsumer = session.createConsumer(getQueue());
+    
+    executionService.startProcessInstanceByKey("JMS_text_queue");
+    TextMessage textMessage = (TextMessage)messageConsumer.receive();
+    assertEquals("This is the body", textMessage.getText());
+   
+    connection.stop();
+    session.close();
+    connection.close();
+    
+  }
+
+}


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

Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/ejb/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/ejb/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/ejb/process.jpdl.xml	2009-12-18 00:39:59 UTC (rev 5985)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="EJB" xmlns="http://jbpm.org/4.3/jpdl">
+
+  <start g="20,20,48,48">
+    <transition to="calculate" />
+  </start>
+
+  <java name="calculate" 
+        jndi="CalculatorBean"
+        method="add"
+        var="answer"
+        g="96,16,83,52">
+        
+    <arg><int value="25"/></arg>
+    <arg><int value="38"/></arg>
+    
+    <transition to="wait" />
+  </java>
+  
+  <state name="wait" g="352,17,88,52"/>
+
+</process>


Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/ejb/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/map/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/map/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/map/process.jpdl.xml	2009-12-18 00:39:59 UTC (rev 5985)
@@ -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="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>


Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/map/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/object/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/object/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/object/process.jpdl.xml	2009-12-18 00:39:59 UTC (rev 5985)
@@ -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="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>


Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/object/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/text/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/text/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/text/process.jpdl.xml	2009-12-18 00:39:59 UTC (rev 5985)
@@ -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="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>


Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/jms/text/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java	2009-12-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -44,6 +44,7 @@
     JavaActivity javaActivity = new JavaActivity();
 
     if (XmlUtil.attribute(element, "method", true, parse, null)!=null) {
+      
       UserCodeReference invocationReference = parser.parseUserCodeReference(element, parse);
       javaActivity.setInvocationReference(invocationReference);
       
@@ -54,6 +55,8 @@
 
       javaActivity.setMethodName(objectDescriptor.getMethodName());
       objectDescriptor.setMethodName(null);
+    } else {
+    	// TODO Add problem to parse
     }
 
     String variableName = XmlUtil.attribute(element, "var");

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-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JmsBinding.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -25,8 +25,6 @@
 import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.wire.Descriptor;
 import org.jbpm.pvm.internal.wire.descriptor.MapDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Binding;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.w3c.dom.Element;
 
@@ -63,21 +61,18 @@
     Element objectElement = XmlUtil.element(element, "object", false, parse);
     if (objectElement != null)
     {
-      String expr = XmlUtil.attribute(objectElement, "expr");
-      if (expr != null)
-      {
-        jmsActivity.setType("object");
-        jmsActivity.setExpression(expr);
-      }
+      jmsActivity.setType("object");
+      jmsActivity.setExpression(XmlUtil.attribute(objectElement, "expr"));
     }
     
     Element mapElement = XmlUtil.element(element, "map", false, parse); 
     if (mapElement != null) {
-      Descriptor descriptor = parser.parseObjectDescriptor(mapElement, parse);
-      if (descriptor instanceof MapDescriptor) {
+      jmsActivity.setType("map");
+      Descriptor descriptor = parser.parseDescriptor(mapElement, parse);
+      if (descriptor instanceof MapDescriptor) {        
         jmsActivity.setMapDescriptor((MapDescriptor)descriptor);
       } else {
-        System.out.println("descriptor is not of class MadDescriptor");
+        parse.addProblem("the parser did not return a descriptor of type MapDescriptor");
       }
     }
 

Modified: jbpm4/trunk/modules/test-base/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-base/pom.xml	2009-12-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/test-base/pom.xml	2009-12-18 00:39:59 UTC (rev 5985)
@@ -63,6 +63,11 @@
       <artifactId>spring-mock</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>com.mockrunner</groupId>
+      <artifactId>mockrunner</artifactId>
+      <version>0.4.1</version>
+    </dependency>
   </dependencies>
   
   <!-- Plugins -->

Added: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/jms/JbpmJmsMockTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/jms/JbpmJmsMockTestCase.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/jms/JbpmJmsMockTestCase.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -0,0 +1,99 @@
+package org.jbpm.test.jms;
+import javax.jms.ConnectionFactory;
+import javax.jms.Queue;
+
+import org.jbpm.test.JbpmTestCase;
+
+import com.mockrunner.ejb.EJBTestModule;
+import com.mockrunner.jms.DestinationManager;
+import com.mockrunner.jms.JMSTestModule;
+import com.mockrunner.mock.ejb.EJBMockObjectFactory;
+import com.mockrunner.mock.jms.JMSMockObjectFactory;
+
+
+public class JbpmJmsMockTestCase extends JbpmTestCase
+{
+
+  private EJBMockObjectFactory ejbMockFactory;
+  private JMSMockObjectFactory jmsMockFactory;
+  private EJBTestModule ejbTestModule;
+  private JMSTestModule jmsTestModule;
+  
+  private ConnectionFactory connectionFactory;
+  private Queue queue;
+
+  private EJBTestModule createEJBTestModule()
+  {
+    return new EJBTestModule(getEJBMockObjectFactory());
+  }
+  
+  private EJBMockObjectFactory createEJBMockObjectFactory()
+  {
+    return new EJBMockObjectFactory();
+  }
+
+  private EJBMockObjectFactory getEJBMockObjectFactory()
+  {
+      synchronized(EJBMockObjectFactory.class) 
+      {
+          if(ejbMockFactory == null)
+          {
+              ejbMockFactory = createEJBMockObjectFactory();
+          }
+      }
+      return ejbMockFactory;
+  }
+
+  private JMSTestModule createJMSTestModule(JMSMockObjectFactory mockFactory)
+  {
+      return new JMSTestModule(mockFactory);
+  }
+
+  private JMSMockObjectFactory createJMSMockObjectFactory()
+  {
+      return new JMSMockObjectFactory();
+  }
+  
+  private JMSMockObjectFactory getJMSMockObjectFactory()
+  {
+      synchronized(JMSMockObjectFactory.class) 
+      {
+          if(jmsMockFactory == null)
+          {
+              jmsMockFactory = createJMSMockObjectFactory();
+          }
+      }
+      return jmsMockFactory;
+  }
+  
+  private DestinationManager getDestinationManager()
+  {
+      return jmsTestModule.getDestinationManager();
+  }
+  
+  protected ConnectionFactory getConnectionFactory() {
+    if (connectionFactory == null) {
+      connectionFactory = getJMSMockObjectFactory().createMockConnectionFactory();
+    }
+    return connectionFactory;
+  }
+  
+  protected Queue getQueue() {
+    if (queue == null) {
+      queue = getDestinationManager().createQueue("testQueue");
+    }
+    return queue;
+  }
+  
+  protected void bindToContext(String name, Object object) {
+    ejbTestModule.bindToContext(name, object);
+  }
+
+  protected void setUp() throws Exception 
+  {
+    super.setUp();
+    jmsTestModule = createJMSTestModule(getJMSMockObjectFactory());
+    ejbTestModule = createEJBTestModule();
+  }
+
+}


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

Modified: jbpm4/trunk/modules/test-cactus/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-cactus/pom.xml	2009-12-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/test-cactus/pom.xml	2009-12-18 00:39:59 UTC (rev 5985)
@@ -157,6 +157,82 @@
       </build>
     </profile>
     
+    <profile>
+      <id>enterprise</id>
+      <properties>
+        <skipTests>true</skipTests>
+      </properties>
+      <build>
+        <plugins>
+		      <plugin>
+		        <groupId>org.apache.maven.plugins</groupId>
+		        <artifactId>maven-dependency-plugin</artifactId>
+		        <executions>
+		          <execution>
+		            <id>copy.libs</id>
+		            <phase>package</phase>
+		            <goals>
+		              <goal>copy</goal>
+		            </goals>
+		            <configuration>
+                  <outputDirectory>target/jbpm.test.webapp.libs</outputDirectory>
+		              <artifactItems>
+		                <artifactItem>
+		                  <groupId>aspectj</groupId>
+		                  <artifactId>aspectjrt</artifactId>
+		                </artifactItem>
+                    <artifactItem>
+                      <groupId>cactus</groupId>
+                      <artifactId>cactus.core</artifactId>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>cactus</groupId>
+                      <artifactId>cactus.integration.ant</artifactId>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>cactus</groupId>
+                      <artifactId>cactus.integration.shared.api</artifactId>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>commons-logging</groupId>
+                      <artifactId>commons-logging</artifactId>
+                      <version>1.1</version>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>commons-logging</groupId>
+                      <artifactId>commons-logging</artifactId>
+                      <version>1.1</version>
+                    </artifactItem>
+                    <artifactItem>
+								      <groupId>org.jbpm.jbpm4</groupId>
+								      <artifactId>jbpm-examples</artifactId>
+								      <classifier>tests</classifier>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>org.jbpm.jbpm4</groupId>
+                      <artifactId>jbpm-test-db</artifactId>
+                      <classifier>tests</classifier>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>org.jbpm.jbpm4</groupId>
+                      <artifactId>jbpm-console-reports</artifactId>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>org.subethamail</groupId>
+                      <artifactId>subethasmtp-wiser</artifactId>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>org.subethamail</groupId>
+                      <artifactId>subethasmtp-smtp</artifactId>
+                    </artifactItem>
+		              </artifactItems>
+		            </configuration>
+		          </execution>
+		        </executions>
+		      </plugin>
+        </plugins>
+      </build>
+    </profile>
     
     <profile>
       <id>runtest</id>

Modified: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java	2009-12-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -1,26 +1,31 @@
 package org.jbpm.test.ejb;
 
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
 import junit.framework.Test;
-import junit.framework.TestCase;
 
 import org.apache.cactus.ServletTestSuite;
-import org.jbpm.test.enterprise.stateless.bean.Calculator;
+import org.jbpm.test.JbpmTestCase;
 
-public class EjbTest extends TestCase {
+public class EjbTest extends JbpmTestCase {
 	
-	public static Test suite() {
-		ServletTestSuite servletTestSuite = new ServletTestSuite();
-		servletTestSuite.addTestSuite(EjbTest.class);
-		return servletTestSuite;
-	}
-	
+  public static Test suite() {
+    ServletTestSuite servletTestSuite = new ServletTestSuite();
+    servletTestSuite.addTestSuite(EjbTest.class);
+    return servletTestSuite;
+  }
+    
+  protected void setUp() throws Exception {
+    super.setUp();  
+    registerDeployment(repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/test/ejb/process.jpdl.xml")
+        .deploy());  
+  }
+  
 	public void testEjbInvocation() throws Exception {
-		Context context = new InitialContext();
-		Calculator calculator = (Calculator)context.lookup("CalculatorBean/local");
-		assertEquals(59, calculator.add(24, 35));
+    String executionId = executionService
+        .startProcessInstanceByKey("EJB")
+        .getProcessInstance()
+        .getId();
+		assertEquals(59, executionService.getVariable(executionId, "answer"));
 	}
 
 }

Modified: 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/map/MapMessageTest.java	2009-12-17 23:23:31 UTC (rev 5984)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/jms/map/MapMessageTest.java	2009-12-18 00:39:59 UTC (rev 5985)
@@ -15,19 +15,18 @@
     return servletTestSuite;
   }
   	
-//  protected void setUp() throws Exception {
-//    super.setUp();  
-//    registerDeployment(repositoryService.createDeployment()
-//        .addResourceFromClasspath("org/jbpm/test/jms/map/process.jpdl.xml")
-//        .deploy());  
-//  }
+  protected void setUp() throws Exception {
+    super.setUp();  
+    registerDeployment(repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/test/jms/map/process.jpdl.xml")
+        .deploy());  
+  }
   
   public void testJmsText() throws Exception {
-    assertTrue(true);
-//    executionService.startProcessInstanceByKey("JMS_map_queue");
-//    MapMessage mapMessage = (MapMessage)messageConsumer.receive();
-//    assertTrue(mapMessage.itemExists("x"));
-//    assertEquals("foo", mapMessage.getObject("x"));
+    executionService.startProcessInstanceByKey("JMS_map_queue");
+    MapMessage mapMessage = (MapMessage)messageConsumer.receive();
+    assertTrue(mapMessage.itemExists("x"));
+    assertEquals("foo", mapMessage.getObject("x"));
   }
 
 }



More information about the jbpm-commits mailing list