[jboss-svn-commits] JBL Code SVN: r14350 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/internal/soa/esb/message and 20 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Aug 18 11:54:26 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-08-18 11:54:26 -0400 (Sat, 18 Aug 2007)
New Revision: 14350
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMappingException.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/FromMessageMapperUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/ToMessageMapperUnitTest.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/impl/
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMappingUnitTest.java
Removed:
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/MessageMapperUnitTest.java
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/LegacyMessageComposerAdapter.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/BusinessRulesProcessor.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ContentBasedWiretap.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/DefaultESBPropertiesSetterUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/TestPojo.java
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/jboss-esb-unfiltered.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/testSingleCommands.xml
labs/jbossesb/trunk/product/services/jbpm/src/test/resources/testMappingDefinition.xml
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java
Log:
JBESB-841 part 2. adding the use of MVEL for mapping between esb and bpm.
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -50,7 +50,6 @@
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.couriers.CourierTimeoutException;
-import org.jboss.soa.esb.couriers.FaultMessageException;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.helpers.NamingContext;
import org.jboss.soa.esb.listeners.message.errors.Factory;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -36,7 +36,6 @@
import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.couriers.CourierTimeoutException;
-import org.jboss.soa.esb.couriers.FaultMessageException;
import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
import org.jboss.soa.esb.listeners.message.errors.Factory;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/LegacyMessageComposerAdapter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/LegacyMessageComposerAdapter.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/LegacyMessageComposerAdapter.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -25,7 +25,6 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.util.ClassUtil;
import java.lang.reflect.Constructor;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/BusinessRulesProcessor.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/BusinessRulesProcessor.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/BusinessRulesProcessor.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -32,6 +32,7 @@
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.services.routing.MessageRouterException;
@@ -55,6 +56,8 @@
try {
List<Object> objectList = _mapper.createObjectList(message, _messagePathList);
_cbr.route(_ruleSet, _ruleLanguage, _ruleReload, message, objectList);
+ } catch (ObjectMappingException ome) {
+ throw new ActionProcessingException(ome.getMessage(), ome);
} catch (MessageRouterException mre) {
throw new ActionProcessingException(mre.getMessage(), mre);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ContentBasedWiretap.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -36,6 +36,7 @@
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.mapping.ObjectMapper;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
import org.jboss.soa.esb.services.registry.Registry;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.services.registry.RegistryFactory;
@@ -54,7 +55,7 @@
public static final String OBJECT_PATH_TAG = "object-path";
- public static final String OBJECT_PATH = "path";
+ public static final String OBJECT_PATH = "esb";
public static final String DEFAULT_CBR_CLASS = "org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter";
@@ -125,30 +126,34 @@
protected final void routeMessage(Message message)
throws MessageRouterException {
- List<Object> objectList = _mapper.createObjectList(message,
- _messagePathList);
- List<String> destinations = _cbr.route(_ruleSet, _ruleLanguage,
- _ruleReload, message, objectList);
- List<Service> outgoingDestinations = new ArrayList<Service>();
- for (String destination : destinations) {
- if (_destinations.containsKey(destination)) {
- outgoingDestinations.add(_destinations.get(destination));
+ try {
+ List<Object> objectList = _mapper.createObjectList(message,
+ _messagePathList);
+ List<String> destinations = _cbr.route(_ruleSet, _ruleLanguage,
+ _ruleReload, message, objectList);
+ List<Service> outgoingDestinations = new ArrayList<Service>();
+ for (String destination : destinations) {
+ if (_destinations.containsKey(destination)) {
+ outgoingDestinations.add(_destinations.get(destination));
+ }
}
- }
- if (outgoingDestinations.size() > 0) {
- try {
- messageMulticaster.sendToSubset(message, outgoingDestinations);
- } catch (RegistryException e) {
- throw new MessageRouterException(e);
- } catch (MessageDeliverException e) {
- throw new MessageRouterException(e);
+ if (outgoingDestinations.size() > 0) {
+ try {
+ messageMulticaster.sendToSubset(message, outgoingDestinations);
+ } catch (RegistryException e) {
+ throw new MessageRouterException(e);
+ } catch (MessageDeliverException e) {
+ throw new MessageRouterException(e);
+ }
+ } else {
+ noDestinations();
+
+ if (destinations.size() > 0) {
+ invalidRuleConfiguration(message, destinations);
+ }
}
- } else {
- noDestinations();
-
- if (destinations.size() > 0) {
- invalidRuleConfiguration(message, destinations);
- }
+ } catch (ObjectMappingException ome) {
+ throw new MessageRouterException(ome);
}
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -85,7 +85,7 @@
try {
List<Service> services = model.getServices();
- HashMap<String, String> hm = new HashMap();
+ HashMap<String, String> hm = new HashMap<String, String>();
for (Service service : services) {
if (hm.containsKey(service.getName())) {
throw new ConfigurationException("Service names must be unique. The service name " + service.getName()
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -31,7 +31,6 @@
import org.jboss.soa.esb.listeners.gateway.remotestrategies.RemoteFileSystemStrategyException;
import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.util.ClassUtil;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -30,7 +30,6 @@
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.apache.log4j.Logger;
import java.io.File;
import java.io.IOException;
@@ -44,9 +43,7 @@
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class RemoteFileMessageComposer implements MessageComposer {
-
- private static Logger logger = Logger.getLogger(RemoteFileMessageComposer.class);
-
+
private FTPEpr ftpEpr;
private File downloadDir;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -19,6 +19,7 @@
*/
package org.jboss.soa.esb.message.mapping;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -52,8 +53,11 @@
* from the message.
*
* @return List of Objects.
+ *
+ * @throws ObjectMappingException
*/
public List<Object> createObjectList (Message message,List<String> messageObjectPathList)
+ throws ObjectMappingException
{
List<Object> objectList = new ArrayList<Object>();
if (messageObjectPathList!=null) {
@@ -80,8 +84,30 @@
}
}
return objectList;
- }
+ }
/**
+ * Set objects on the message using a OGNL expression syntax to describe the position
+ * in the message where the object needs to be attached.
+ *
+ * @param message - the message on which the objects will be placed
+ * @param expressionAndObject map containing objects with their expression
+ * @return the message with the objects attached.
+ *
+ * @throws ObjectMappingException
+ */
+ public Message setObjectsOnMessage (Message message,Map<Object, String> expressionAndObject)
+ throws ObjectMappingException
+ {
+ if (expressionAndObject!=null) {
+ for (Object object: expressionAndObject.keySet())
+ {
+ String expression = expressionAndObject.get(object);
+ setObjectOnMessage(message, expression, object);
+ }
+ }
+ return message;
+ }
+ /**
* Extracts objects from the message, using a ESB Message Object Path. The
* path should follow the syntax:
*
@@ -93,7 +119,7 @@
* <bean> : optionally you traverse a bean graph by specifying bean names;
*
* examples :
- * property.Order, gets the property object named "Order"
+ * properties.Order, gets the property object named "Order"
* attachment.1, gets the first attachment Object
* attachment.FirstAttachment, gets the attachment named 'FirstAttachment'
* attachment.1.Order, calls getOrder() on the attached Object.
@@ -104,59 +130,134 @@
* More <bean> elements can be added to the query to traverse the bean graph.
*
* @param message - an ESB Message.
- * @param esbMessageObjectPath - path to the object.
+ * @param expression - path to the object.
* @return Object obtained from the message.
+ *
+ * @throws ObjectMappingException
*/
- public Object getObjectFromMessage(Message message, String esbMessageObjectPath)
+ public Object getObjectFromMessage(Message message, String expression)
+ throws ObjectMappingException
{
Object object=null;
- String[] path = esbMessageObjectPath.split("\\.");
+ String[] path = expression.split("\\.");
if (path.length<2) {
- logger.error(esbMessageObjectPath + " should be of type 'location.name'");
- return null;
- } else {
- String location = path[0];
- String name = path[1];
- if ("body".equalsIgnoreCase(location)) {
- Body body = message.getBody();
- object =
- BODY_CONTENT.equals(name)
- ? body.getByteArray()
- : body.get(name);
- } else if ("properties".equalsIgnoreCase(location)) {
- object = message.getProperties().getProperty(name);
- } else if ("attachment".equalsIgnoreCase(location)) {
- if (isNumeric(name)) {
- int index = Integer.valueOf(name);
- object = message.getAttachment().itemAt(index);
- } else {
- object = message.getAttachment().get(name);
- }
- } else if ("header".equalsIgnoreCase(location)) {
- object = message.getHeader().getCall();
+ if (path.length==1) {
+ //assuming we mean the body
+ expression = "body." + expression;
+ path = expression.split("\\.");
} else {
- logger.error(esbMessageObjectPath + " should start with one of [header,body,properties,attachment]");
- return null;
+ throw new ObjectMappingException(expression + " should start with [<location>.]<name>");
}
+ }
+ String location = path[0];
+ String name = path[1];
+ if ("body".equalsIgnoreCase(location)) {
+ Body body = message.getBody();
+ object =
+ BODY_CONTENT.equals(name)
+ ? body.getByteArray()
+ : body.get(name);
+ } else if ("properties".equalsIgnoreCase(location)) {
+ object = message.getProperties().getProperty(name);
+ } else if ("attachment".equalsIgnoreCase(location)) {
+ if (isNumeric(name)) {
+ int index = Integer.valueOf(name);
+ object = message.getAttachment().itemAt(index);
+ } else {
+ object = message.getAttachment().get(name);
+ }
+ } else if ("header".equalsIgnoreCase(location)) {
+ object = message.getHeader().getCall();
+ } else {
+ throw new ObjectMappingException(expression + " should start with one of [header,body,properties,attachment]");
}
//If needed use MVEL for evaluation of the rest of the path
if (path.length>2) {
- int beginIndex = esbMessageObjectPath.indexOf(".",esbMessageObjectPath.indexOf(".")+1)+1;
- String expression = esbMessageObjectPath.substring(beginIndex);
+ int beginIndex = expression.indexOf(".",expression.indexOf(".")+1)+1;
+ expression = expression.substring(beginIndex);
object = MVEL.getProperty(expression, object);
}
return object;
}
/**
- * Checks to see if the name is number.
+ * Sets an object somewhere on the Message, based on the value of the expression.
+ * The expression is OGNL based. MVEL is used to do the actual mapping.
*
- * @param name
- * @return
+ * @param message - on which the object will be placed.
+ * @param expression - desribes the place in the Message where the object should be placed
+ * @param object - the object which will be attached to the message.
+ * @throws ObjectMappingException
*/
+ public void setObjectOnMessage(Message message, String expression, Object object)
+ throws ObjectMappingException
+ {
+ String[] path = expression.split("\\.");
+ if (path.length<2) {
+ if (path.length==1) {
+ //assuming we mean the body
+ expression = "body." + expression;
+ path = expression.split("\\.");
+ } else {
+ throw new ObjectMappingException(expression + " should start with [<location>.]<name>");
+ }
+ }
+ String location = path[0];
+ String name = path[1];
+ if ("body".equalsIgnoreCase(location)) {
+ Body body = message.getBody();
+ if (BODY_CONTENT.equals(name)) {
+ body.setByteArray(getBytes((Serializable) object));
+ } else {
+ body.add(name, object);
+ }
+ } else if ("properties".equalsIgnoreCase(location)) {
+ message.getProperties().setProperty(name, object);
+ } else if ("attachment".equalsIgnoreCase(location)) {
+ if (isNumeric(name)) {
+ int index = Integer.valueOf(name);
+ message.getAttachment().addItemAt(index, object);
+ } else {
+ message.getAttachment().put(name, object);
+ }
+ } else if ("header".equalsIgnoreCase(location)) {
+ MVEL.setProperty(message, expression, object);
+ } else {
+ throw new ObjectMappingException(expression + " should start with one of [header,body,properties,attachment]");
+ }
+ }
+
+
+ /**
+ * Checks to see if parameter name is number.
+ *
+ * @param name - parameter to be analyzed
+ * @return true if name is numeric, false in all other cases.
+ */
private boolean isNumeric(String name) {
for (int i=0; i<name.length(); i++) {
if (!Character.isDigit(name.charAt(i))) return false;
}
return true;
}
+ /**
+ * Turns an object into a byte[].
+ *
+ * @param object to be serialized to bytes.
+ * @return byte[] representation of the object passed in
+ * @throws ObjectMappingException
+ */
+ /*
+ * This code is too good to loose, and besides if you fix it breaks a mirade
+ * of unittests. We should simple loose the byte[] in our Message. No sense
+ * in fixing up all this stuff. In java everything is an object, so there
+ * is NO need for a byteArray.
+ */
+ public byte[] getBytes(Serializable object) throws ObjectMappingException
+ {
+ if (object instanceof byte[]) {
+ return (byte[])object;
+ } else {
+ return object.toString().getBytes();
+ }
+ }
}
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMappingException.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMappingException.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMappingException.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.message.mapping;
+
+/**
+ * @author kstam
+ *
+ */
+public class ObjectMappingException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ObjectMappingException(){
+ super();
+ }
+
+ public ObjectMappingException (String msg){
+ super(msg);
+ }
+
+ public ObjectMappingException (String msg, Throwable cause){
+ super (msg, cause);
+ }
+}
Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMappingException.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/DefaultESBPropertiesSetterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/DefaultESBPropertiesSetterUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/DefaultESBPropertiesSetterUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -22,7 +22,9 @@
package org.jboss.soa.esb.listeners.gateway;
import static org.junit.Assert.assertEquals;
+
import java.net.URI;
+
import javax.jms.JMSException;
import junit.framework.JUnit4TestAdapter;
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -27,13 +27,13 @@
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.common.tests.BaseTest;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
-import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.message.Message;
public class FileGatewayListenerUnitTest extends BaseTest
{
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -32,7 +32,6 @@
import org.jboss.soa.esb.listeners.message.BasicMessageComposer;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter;
-import org.jboss.soa.esb.services.registry.RegistryException;
/**
* Tests for the Groovy Gateway.
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -19,13 +19,14 @@
*/
package org.jboss.soa.esb.listeners.gateway;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.net.InetAddress;
import java.net.URI;
import junit.framework.JUnit4TestAdapter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.couriers.MockCourier;
@@ -41,7 +42,6 @@
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter;
-import org.jboss.soa.esb.services.registry.RegistryException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -27,36 +27,29 @@
import java.io.File;
import java.net.MalformedURLException;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import junit.framework.JUnit4TestAdapter;
import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.util.embedded.EmbeddableException;
-import org.jboss.internal.soa.esb.util.embedded.ftp.FtpTestUtil;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
import org.jboss.internal.soa.esb.couriers.MockCourier;
import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.internal.soa.esb.util.embedded.EmbeddableException;
+import org.jboss.internal.soa.esb.util.embedded.ftp.FtpTestUtil;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.schedule.SchedulingException;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.MalformedEPRException;
-import org.jboss.soa.esb.addressing.eprs.JMSEpr;
-import org.jboss.soa.esb.couriers.Courier;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.gateway.remotestrategies.ReadOnlyRemoteFileSystemStrategy;
import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener;
import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheTestUtil;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleThreadState;
-import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.schedule.SchedulingException;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.AfterClass;
/**
* Unit test for ReadOnlyRemoteGatewayListener that uses an embedded ftp server.
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -24,13 +24,12 @@
import java.io.File;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
import org.jboss.soa.esb.addressing.eprs.FTPEpr;
import org.jboss.soa.esb.common.tests.BaseTest;
import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleState;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
public class RemoteGatewayListenerIntegrationTest extends BaseTest
{
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -34,19 +34,19 @@
import junit.framework.JUnit4TestAdapter;
import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
import org.jboss.internal.soa.esb.util.embedded.EmbeddableException;
import org.jboss.internal.soa.esb.util.embedded.ftp.FtpTestUtil;
import org.jboss.internal.soa.esb.util.embedded.ftp.NoConfigFileFtpServer;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.schedule.SchedulingException;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.schedule.SchedulingException;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.junit.After;
import org.junit.AfterClass;
Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/FromMessageMapperUnitTest.java (from rev 14322, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/MessageMapperUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/FromMessageMapperUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/FromMessageMapperUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.message.mapping;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.eprs.FileEpr;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+
+/**
+ * @author kstam
+ *
+ */
+public class FromMessageMapperUnitTest extends TestCase {
+
+ public void testBytes() throws ObjectMappingException, UnsupportedEncodingException
+ {
+ ObjectMapper mapper = new ObjectMapper();
+ String byteString = "testing";
+ byte[] byteArray = mapper.getBytes(byteString);
+ assertEquals(new String(byteArray),byteString);
+ }
+ public void testHeader() throws URISyntaxException, ObjectMappingException {
+ ObjectMapper mapper = new ObjectMapper();
+ Message message = MessageFactory.getInstance().getMessage();
+ List<String> variableList = new ArrayList<String>();
+
+ EPR eprTo = new FileEpr("testTo");
+ message.getHeader().getCall().setTo(eprTo);
+
+ EPR eprFrom = new FileEpr("testFrom");
+ message.getHeader().getCall().setFrom(eprFrom);
+
+ variableList.add("header.call.to");
+ variableList.add("header.call.from");
+ List<Object> pojos=mapper.createObjectList(message, variableList);
+
+ Object object1 = pojos.get(0);
+ assertTrue(object1.equals(eprTo));
+
+ Object object2 = pojos.get(1);
+ assertTrue(object2.equals(eprFrom));
+
+ }
+ public void testProperty () throws ObjectMappingException {
+ ObjectMapper mapper = new ObjectMapper();
+ Message message = MessageFactory.getInstance().getMessage();
+ List<String> variableList = new ArrayList<String>();
+
+ message.getProperties().setProperty("property1", "some object");
+ variableList.add("properties.property1");
+
+ TestPojo testPojo1 = new TestPojo();
+ testPojo1.setCount(1);
+ testPojo1.setName("test1");
+ TestPojo testPojo2 = new TestPojo();
+ testPojo2.setCount(1);
+ testPojo2.setName("test2");
+ testPojo1.setTestPojo(testPojo2);
+ message.getProperties().setProperty("property2", testPojo1);
+ variableList.add("properties.property2.testPojo");
+
+ List<Object> pojos=mapper.createObjectList(message, variableList);
+
+ Object pojo1 = pojos.get(0);
+ assertTrue("some object".equals(pojo1));
+
+ Object pojo2 = pojos.get(1);
+ assertTrue(testPojo2.equals(pojo2));
+ }
+
+ public void testProperty_flatten() throws ObjectMappingException {
+ ObjectMapper mapper = new ObjectMapper();
+ Message message = MessageFactory.getInstance().getMessage();
+ List<String> variableList = new ArrayList<String>();
+
+ Collection<TestPojo> allPojos = new ArrayList<TestPojo>();
+
+ TestPojo testPojo1 = new TestPojo();
+ testPojo1.setCount(1);
+ testPojo1.setName("test1");
+
+ TestPojo testPojo2 = new TestPojo();
+ testPojo2.setCount(1);
+ testPojo2.setName("test2");
+
+ allPojos.add(testPojo1);
+ allPojos.add(testPojo2);
+
+ message.getProperties().setProperty("allThePojos", allPojos);
+ variableList.add("properties.allThePojos");
+
+ List<Object> pojos=mapper.createObjectList(message, variableList);
+
+ Object pojo1 = pojos.get(0);
+ assertTrue(testPojo1.equals(pojo1));
+
+ Object pojo2 = pojos.get(1);
+ assertTrue(testPojo2.equals(pojo2));
+ }
+
+ public void testAttachment_hashmap() throws ObjectMappingException {
+ ObjectMapper mapper = new ObjectMapper();
+ Message message = MessageFactory.getInstance().getMessage();
+ List<String> variableList = new ArrayList<String>();
+
+ message.getAttachment().put("attachment1", "some object");
+ variableList.add("attachment.attachment1");
+
+ TestPojo testPojo1 = new TestPojo();
+ testPojo1.setCount(1);
+ testPojo1.setName("test1");
+ TestPojo testPojo2 = new TestPojo();
+ testPojo2.setCount(1);
+ testPojo2.setName("test2");
+ testPojo1.setTestPojo(testPojo2);
+ message.getAttachment().put("attachment2", testPojo1);
+ variableList.add("attachment.attachment2.testPojo");
+
+ List<Object> pojos=mapper.createObjectList(message, variableList);
+
+ Object pojo1 = pojos.get(0);
+ assertTrue("some object".equals(pojo1));
+
+ Object pojo2 = pojos.get(1);
+ assertTrue(testPojo2.equals(pojo2));
+ }
+
+ public void testAttachment_list() throws ObjectMappingException{
+ ObjectMapper mapper = new ObjectMapper();
+ Message message = MessageFactory.getInstance().getMessage();
+ List<String> variableList = new ArrayList<String>();
+
+ message.getAttachment().addItem("some object");
+ variableList.add("attachment.0");
+
+ TestPojo testPojo1 = new TestPojo();
+ testPojo1.setCount(1);
+ testPojo1.setName("test1");
+ TestPojo testPojo2 = new TestPojo();
+ testPojo2.setCount(1);
+ testPojo2.setName("test2");
+ testPojo1.setTestPojo(testPojo2);
+ message.getAttachment().addItem(testPojo1);
+ variableList.add("attachment.1.testPojo");
+
+ List<Object> pojos=mapper.createObjectList(message, variableList);
+
+ Object pojo1 = pojos.get(0);
+ assertTrue("some object".equals(pojo1));
+
+ Object pojo2 = pojos.get(1);
+ assertTrue(testPojo2.equals(pojo2));
+ }
+
+ public void testBody() throws ObjectMappingException {
+ ObjectMapper mapper = new ObjectMapper();
+ Message message = MessageFactory.getInstance().getMessage();
+ List<String> variableList = new ArrayList<String>();
+
+ message.getBody().add("body1", "some object");
+ variableList.add("body.body1");
+
+ TestPojo testPojo1 = new TestPojo();
+ testPojo1.setCount(1);
+ testPojo1.setName("test1");
+ TestPojo testPojo2 = new TestPojo();
+ testPojo2.setCount(1);
+ testPojo2.setName("test2");
+ testPojo1.setTestPojo(testPojo2);
+ message.getBody().add("body2", testPojo1);
+ variableList.add("body.body2.testPojo");
+
+ TestPojo testPojo3 = new TestPojo();
+ //if the location is not specified we assume it is the body
+ message.getBody().add("pojo3", testPojo3);
+ variableList.add("pojo3");
+
+ List<Object> pojos=mapper.createObjectList(message, variableList);
+
+ Object pojo1 = pojos.get(0);
+ assertTrue("some object".equals(pojo1));
+
+ Object pojo2 = pojos.get(1);
+ assertTrue(testPojo2.equals(pojo2));
+
+ Object pojo3 = pojos.get(2);
+ assertTrue(testPojo3.equals(pojo3));
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/MessageMapperUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/MessageMapperUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/MessageMapperUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -1,185 +0,0 @@
-/**
- *
- */
-package org.jboss.soa.esb.message.mapping;
-
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.eprs.FileEpr;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-
-
-/**
- * @author kstam
- *
- */
-public class MessageMapperUnitTest extends TestCase {
-
- public void testHeader() throws URISyntaxException {
- ObjectMapper mapper = new ObjectMapper();
- Message message = MessageFactory.getInstance().getMessage();
- List<String> variableList = new ArrayList<String>();
-
- EPR eprTo = new FileEpr("testTo");
- message.getHeader().getCall().setTo(eprTo);
-
- EPR eprFrom = new FileEpr("testFrom");
- message.getHeader().getCall().setFrom(eprFrom);
-
- variableList.add("header.call.to");
- variableList.add("header.call.from");
- List<Object> pojos=mapper.createObjectList(message, variableList);
-
- Object object1 = pojos.get(0);
- assertTrue(object1.equals(eprTo));
-
- Object object2 = pojos.get(1);
- assertTrue(object2.equals(eprFrom));
-
- }
- public void testProperty () {
- ObjectMapper mapper = new ObjectMapper();
- Message message = MessageFactory.getInstance().getMessage();
- List<String> variableList = new ArrayList<String>();
-
- message.getProperties().setProperty("property1", "some object");
- variableList.add("properties.property1");
-
- TestPojo testPojo1 = new TestPojo();
- testPojo1.setCount(1);
- testPojo1.setName("test1");
- TestPojo testPojo2 = new TestPojo();
- testPojo2.setCount(1);
- testPojo2.setName("test2");
- testPojo1.setTestPojo(testPojo2);
- message.getProperties().setProperty("property2", testPojo1);
- variableList.add("properties.property2.testPojo");
-
- List<Object> pojos=mapper.createObjectList(message, variableList);
-
- Object pojo1 = pojos.get(0);
- assertTrue("some object".equals(pojo1));
-
- Object pojo2 = pojos.get(1);
- assertTrue(testPojo2.equals(pojo2));
- }
-
- public void testProperty_flatten () {
- ObjectMapper mapper = new ObjectMapper();
- Message message = MessageFactory.getInstance().getMessage();
- List<String> variableList = new ArrayList<String>();
-
- Collection<TestPojo> allPojos = new ArrayList<TestPojo>();
-
- TestPojo testPojo1 = new TestPojo();
- testPojo1.setCount(1);
- testPojo1.setName("test1");
-
- TestPojo testPojo2 = new TestPojo();
- testPojo2.setCount(1);
- testPojo2.setName("test2");
-
- allPojos.add(testPojo1);
- allPojos.add(testPojo2);
-
- message.getProperties().setProperty("allThePojos", allPojos);
- variableList.add("properties.allThePojos");
-
- List<Object> pojos=mapper.createObjectList(message, variableList);
-
- Object pojo1 = pojos.get(0);
- assertTrue(testPojo1.equals(pojo1));
-
- Object pojo2 = pojos.get(1);
- assertTrue(testPojo2.equals(pojo2));
- }
-
- public void testAttachment_hashmap() {
- ObjectMapper mapper = new ObjectMapper();
- Message message = MessageFactory.getInstance().getMessage();
- List<String> variableList = new ArrayList<String>();
-
- message.getAttachment().put("attachment1", "some object");
- variableList.add("attachment.attachment1");
-
- TestPojo testPojo1 = new TestPojo();
- testPojo1.setCount(1);
- testPojo1.setName("test1");
- TestPojo testPojo2 = new TestPojo();
- testPojo2.setCount(1);
- testPojo2.setName("test2");
- testPojo1.setTestPojo(testPojo2);
- message.getAttachment().put("attachment2", testPojo1);
- variableList.add("attachment.attachment2.testPojo");
-
- List<Object> pojos=mapper.createObjectList(message, variableList);
-
- Object pojo1 = pojos.get(0);
- assertTrue("some object".equals(pojo1));
-
- Object pojo2 = pojos.get(1);
- assertTrue(testPojo2.equals(pojo2));
- }
-
- public void testAttachment_list() {
- ObjectMapper mapper = new ObjectMapper();
- Message message = MessageFactory.getInstance().getMessage();
- List<String> variableList = new ArrayList<String>();
-
- message.getAttachment().addItem("some object");
- variableList.add("attachment.0");
-
- TestPojo testPojo1 = new TestPojo();
- testPojo1.setCount(1);
- testPojo1.setName("test1");
- TestPojo testPojo2 = new TestPojo();
- testPojo2.setCount(1);
- testPojo2.setName("test2");
- testPojo1.setTestPojo(testPojo2);
- message.getAttachment().addItem(testPojo1);
- variableList.add("attachment.1.testPojo");
-
- List<Object> pojos=mapper.createObjectList(message, variableList);
-
- Object pojo1 = pojos.get(0);
- assertTrue("some object".equals(pojo1));
-
- Object pojo2 = pojos.get(1);
- assertTrue(testPojo2.equals(pojo2));
- }
-
- public void testBody() {
- ObjectMapper mapper = new ObjectMapper();
- Message message = MessageFactory.getInstance().getMessage();
- List<String> variableList = new ArrayList<String>();
-
- message.getBody().add("body1", "some object");
- variableList.add("body.body1");
-
- TestPojo testPojo1 = new TestPojo();
- testPojo1.setCount(1);
- testPojo1.setName("test1");
- TestPojo testPojo2 = new TestPojo();
- testPojo2.setCount(1);
- testPojo2.setName("test2");
- testPojo1.setTestPojo(testPojo2);
- message.getBody().add("body2", testPojo1);
- variableList.add("body.body2.testPojo");
-
- List<Object> pojos=mapper.createObjectList(message, variableList);
-
- Object pojo1 = pojos.get(0);
- assertTrue("some object".equals(pojo1));
-
- Object pojo2 = pojos.get(1);
- assertTrue(testPojo2.equals(pojo2));
- }
-
-}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/TestPojo.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/TestPojo.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/TestPojo.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -1,6 +1,25 @@
-/**
- *
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.message.mapping;
import java.io.Serializable;
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/ToMessageMapperUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/ToMessageMapperUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/ToMessageMapperUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.message.mapping;
+
+import java.net.URISyntaxException;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.eprs.FileEpr;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+
+/**
+ * @author kstam
+ *
+ */
+public class ToMessageMapperUnitTest extends TestCase {
+
+ public void testHeader() throws URISyntaxException, ObjectMappingException
+ {
+ EPR toEpr = new FileEpr("test1");
+ Message message = MessageFactory.getInstance().getMessage();
+
+ String expression="header.call.to";
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.setObjectOnMessage(message, expression, toEpr);
+
+ assertEquals(message.getHeader().getCall().getTo(),toEpr);
+
+ }
+
+ public void testBody() throws ObjectMappingException
+ {
+ TestPojo pojo1 = new TestPojo();
+ pojo1.setName("pojo1");
+
+ Message message = MessageFactory.getInstance().getMessage();
+
+ String expression="body.pojo1Name";
+
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.setObjectOnMessage(message, expression, pojo1);
+
+ assertEquals(message.getBody().get("pojo1Name"),pojo1);
+ }
+}
Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/mapping/ToMessageMapperUnitTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/jboss-esb-unfiltered.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/jboss-esb-unfiltered.xml 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/jboss-esb-unfiltered.xml 2007-08-18 15:54:26 UTC (rev 14350)
@@ -112,13 +112,12 @@
<property name="command" value="NewProcessInstanceCommand" />
<property name="process-definition-name" value="processDefinition2"/>
<property name="actor" value="FrankSinatra"/>
- <property name="esb-to-jbpm">
+ <property name="object-paths">
<!-- esb-name maps to getBody().get("eVar1") -->
- <variables>
- <variable esb-name="eVar1" jbpm-name="counter" value="45" />
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
- </variables>
- </property>
+ <object-path esb="eVar1" jbpm="counter" value="45" />
+ <object-path esb="BODY_CONTENT" jbpm="theBody" />
+ </property>
+
</action>
<action name="displayProcessInfo"
@@ -131,13 +130,10 @@
class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
<property name="command" value="SignalCommand" />
<property name="process-definition-name" value="processDefinition2"/>
- <property name="esb-to-jbpm">
+ <property name="object-paths">
<!-- esb-name maps to getBody().get("eVar1") -->
- <variables>
- <variable esb-name="eVar1" jbpm-name="counter" value="45" />
- <property name="process-definition-name" value="processDefinition2"/>
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
- </variables>
+ <object-path esb="eVar1" jbpm="counter" value="45" />
+ <object-path esb="BODY_CONTENT" jbpm="theBody" />
</property>
</action>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration1/processDefinition/processdefinition.xml 2007-08-18 15:54:26 UTC (rev 14350)
@@ -16,10 +16,10 @@
<esbServiceName>Service1</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -32,10 +32,10 @@
<esbServiceName>Service2</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -48,10 +48,10 @@
<esbServiceName>Service3</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -66,10 +66,10 @@
<esbServiceName>ResultsService</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/jboss-esb.xml 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/jboss-esb.xml 2007-08-18 15:54:26 UTC (rev 14350)
@@ -103,11 +103,9 @@
<property name="command" value="NewProcessInstanceCommand" />
<property name="process-definition-name" value="processDefinition1"/>
<property name="actor" value="FrankSinatra"/>
- <property name="esb-to-jbpm">
+ <property name="object-paths">
<!-- esb-name maps to getBody().get("eVar1") -->
- <variables>
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
- </variables>
+ <object-path esb="BODY_CONTENT" jbpm="theBody" />
</property>
</action>
@@ -115,11 +113,9 @@
class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
<property name="command" value="SignalCommand" />
<property name="process-definition-name" value="processDefinition1"/>
- <property name="esb-to-jbpm">
- <variables>
- <variable esb-name="eVar1" jbpm-name="counter" value="45" />
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
- </variables>
+ <property name="object-paths">
+ <object-path esb="eVar1" jbpm="counter" value="45" />
+ <object-path esb="BODY_CONTENT" jbpm="theBody" />
</property>
</action>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration2/processDefinition/processdefinition.xml 2007-08-18 15:54:26 UTC (rev 14350)
@@ -16,10 +16,10 @@
<esbServiceName>Service1</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -32,10 +32,10 @@
<esbServiceName>Service2</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -54,10 +54,10 @@
<esbServiceName>Service5</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -70,10 +70,10 @@
<esbServiceName>Service6</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -87,10 +87,10 @@
<esbServiceName>Service7</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -108,10 +108,10 @@
<esbCategoryName>BPM_Orchestration2_ResultsService</esbCategoryName>
<esbServiceName>ResultsService</esbServiceName>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -127,10 +127,10 @@
<esbServiceName>Service3</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
@@ -143,10 +143,10 @@
<esbServiceName>Service4</esbServiceName>
<millisToWaitForResponse>5000</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="theBody" esb-name="BODY_CONTENT" />
+ <mapping jbpm="theBody" esb="BODY_CONTENT" />
</returnVars>
</action>
</event>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml 2007-08-18 15:54:26 UTC (rev 14350)
@@ -68,8 +68,8 @@
value="MyBusinessRules.drl" />
<property name="ruleReload" value="true" />
<property name="object-paths">
- <object-path path="body.TheOrderHeader" />
- <object-path path="body.TheCustomer" />
+ <object-path esb="body.TheOrderHeader" />
+ <object-path esb="body.TheCustomer" />
</property>
</action>
@@ -86,8 +86,8 @@
value="MyBusinessRulesDiscount.drl" />
<property name="ruleReload" value="true" />
<property name="object-paths">
- <object-path path="body.TheOrderHeader" />
- <object-path path="body.TheCustomer" />
+ <object-path esb="body.TheOrderHeader" />
+ <object-path esb="body.TheCustomer" />
</property>
</action>
@@ -114,8 +114,8 @@
service-category="BasicShipping" service-name="ShipperService" />
</property>
<property name="object-paths">
- <object-path path="body.TheOrderHeader" />
- <object-path path="body.TheCustomer" />
+ <object-path esb="body.TheOrderHeader" />
+ <object-path esb="body.TheCustomer" />
</property>
</action>
</actions>
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -78,9 +78,10 @@
public static final String INCLUDE_ALL_VARS_TAG ="include-all-variables";
public static final String INCLUDE_LOGS_TAG ="include-logs";
public static final String VARIABLES_TAG ="variables";
+ public static final String OBJECT_PATH_TAG ="object-path";
public static final String ONE_VARIABLE_TAG ="variable";
- public static final String ESB_VARNAME_TAG ="esb-name";
- public static final String JBPM_VARNAME_TAG ="jbpm-name";
+ public static final String ESB_VARNAME_TAG ="esb";
+ public static final String JBPM_VARNAME_TAG ="bpm";
public static final String ACTORS_TAG ="actors";
public static final String ONE_ACTOR_TAG ="actor";
public static final String OVERWRITE_SWIMLANE_TAG ="overwrite-swimlane";
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -38,6 +38,7 @@
import org.jboss.soa.esb.message.Body;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.mapping.ObjectMapper;
import org.jboss.soa.esb.services.jbpm.Constants;
import org.jboss.soa.esb.services.jbpm.util.Helper;
import org.jbpm.context.exe.ContextInstance;
@@ -69,9 +70,9 @@
public static final String MAPPING_TAG = "mapping";
- public static final String JBPM_NAME_ATTR = "jbpm-name";
+ public static final String JBPM_NAME_ATTR = "jbpm";
- public static final String ESB_NAME_ATTR = "esb-name";
+ public static final String ESB_NAME_ATTR = "esb";
public static final String PROCESS_SCOPE_ATTR = "process-scope";
@@ -132,125 +133,110 @@
protected void varsToRequest (Message request) throws Exception
{
- ContextInstance ctxInstance = _token.getProcessInstance()
- .getContextInstance();
- Body body = request.getBody();
- boolean gblPrcScope = (null == globalProcessScope) ? false
- : globalProcessScope;
- if (null == jbpmToEsbVars)
- {
- Map map = (gblPrcScope) ? ctxInstance.getVariables() : ctxInstance
- .getVariables(_token);
- if (null != map)
- for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry curr = (Map.Entry) iter.next();
- body.add(curr.getKey().toString(), curr.getValue());
- }
- return;
- }
- List list = jbpmToEsbVars.elements(MAPPING_TAG);
- // do nothing if empty list
- if (list.size() < 1)
- return;
-
- for (Object iter : list)
- {
- Element curr = (Element) iter;
- String jbpmKey = curr.attributeValue(JBPM_NAME_ATTR);
- String esbKey = curr.attributeValue(ESB_NAME_ATTR);
- String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
- boolean isPrcScope = (null == processScope) ? gblPrcScope : Boolean
- .parseBoolean(processScope);
- Object obj = (isPrcScope) ? ctxInstance.getVariable(jbpmKey)
- : ctxInstance.getVariable(jbpmKey, _token);
- if (null != obj)
- {
- if (Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbKey))
- {
- if (obj instanceof byte[])
- body.setByteArray((byte[]) obj);
- else
- body.setByteArray(obj.toString().getBytes());
- }
- else
- body.add(esbKey, obj);
- }
- }
+ ContextInstance ctxInstance = _token.getProcessInstance()
+ .getContextInstance();
+ Body body = request.getBody();
+ boolean gblPrcScope = (null == globalProcessScope) ? false
+ : globalProcessScope;
+ if (null == jbpmToEsbVars)
+ {
+ Map map = (gblPrcScope) ? ctxInstance.getVariables() : ctxInstance
+ .getVariables(_token);
+ if (null != map)
+ for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
+ {
+ Map.Entry curr = (Map.Entry) iter.next();
+ body.add(curr.getKey().toString(), curr.getValue());
+ }
+ return;
+ }
+ List list = jbpmToEsbVars.elements(MAPPING_TAG);
+ // do nothing if empty list
+ if (list.size() < 1)
+ return;
+
+ for (Object iter : list)
+ {
+ Element curr = (Element) iter;
+ String jbpmKey = curr.attributeValue(JBPM_NAME_ATTR);
+ String esbKey = curr.attributeValue(ESB_NAME_ATTR);
+ String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
+ boolean isPrcScope = (null == processScope) ? gblPrcScope : Boolean
+ .parseBoolean(processScope);
+ Object obj = (isPrcScope) ? ctxInstance.getVariable(jbpmKey)
+ : ctxInstance.getVariable(jbpmKey, _token);
+ if (null != obj) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setObjectOnMessage(request, esbKey, obj);
+ }
+ }
} // ________________________________
protected void varsFromResponse (Message response) throws Exception
{
- ContextInstance ctxInstance = _token.getProcessInstance()
- .getContextInstance();
- Body body = response.getBody();
- boolean gblPrcScope = (null == globalProcessScope) ? false
- : globalProcessScope;
- if (null == returnVars)
- {
- Map map = (gblPrcScope) ? ctxInstance.getVariables() : ctxInstance
- .getVariables(_token);
- if (null != map)
- for (Iterator iter = map.keySet().iterator(); iter.hasNext();)
- {
- String key = iter.next().toString();
- Object obj = body.get(key);
- if (null != obj)
- {
- if (gblPrcScope)
- ctxInstance.setVariable(key, obj);
- else
- ctxInstance.setVariable(key, obj, _token);
- }
- }
- return;
- }
- List list = returnVars.elements(MAPPING_TAG);
- // do nothing if empty list
- if (list.size() < 1)
- return;
-
- for (Object iter : list)
- {
- Element curr = (Element) iter;
- String jbpmVar = curr.attributeValue(JBPM_NAME_ATTR);
- String esbVar = curr.attributeValue(ESB_NAME_ATTR);
- String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
- boolean isPrcScope = (null == processScope) ? gblPrcScope : Boolean
- .parseBoolean(processScope);
- Object obj = (Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbVar)) ? body
- .getByteArray()
- : body.get(esbVar);
- Object oldVal = (isPrcScope) ? ctxInstance.getVariable(jbpmVar)
- : ctxInstance.getVariable(jbpmVar, _token);
- if (null == oldVal)
- {
- if (null != obj)
- {
- if (isPrcScope)
- ctxInstance.createVariable(jbpmVar, obj);
- else
- ctxInstance.createVariable(jbpmVar, obj, _token);
- }
- }
- else
- {
- if (null == obj)
- {
- if (isPrcScope)
- ctxInstance.deleteVariable(jbpmVar);
- else
- ctxInstance.deleteVariable(jbpmVar, _token);
- }
- else
- {
- if (isPrcScope)
- ctxInstance.setVariable(jbpmVar, obj);
- else
- ctxInstance.setVariable(jbpmVar, obj, _token);
- }
- }
- }
+ ContextInstance ctxInstance = _token.getProcessInstance()
+ .getContextInstance();
+ Body body = response.getBody();
+ boolean gblPrcScope = (null == globalProcessScope) ? false
+ : globalProcessScope;
+ if (null == returnVars)
+ {
+ Map map = (gblPrcScope) ? ctxInstance.getVariables() : ctxInstance
+ .getVariables(_token);
+ if (null != map)
+ for (Iterator iter = map.keySet().iterator(); iter.hasNext();)
+ {
+ String key = iter.next().toString();
+ Object obj = body.get(key);
+ if (null != obj)
+ {
+ if (gblPrcScope)
+ ctxInstance.setVariable(key, obj);
+ else
+ ctxInstance.setVariable(key, obj, _token);
+ }
+ }
+ return;
+ }
+ List list = returnVars.elements(MAPPING_TAG);
+ // do nothing if empty list
+ if (list.size() < 1)
+ return;
+
+ for (Object iter : list)
+ {
+ Element curr = (Element) iter;
+ String jbpmVar = curr.attributeValue(JBPM_NAME_ATTR);
+ String esbVar = curr.attributeValue(ESB_NAME_ATTR);
+ String processScope = curr.attributeValue(PROCESS_SCOPE_ATTR);
+ boolean isPrcScope = (null == processScope) ? gblPrcScope : Boolean
+ .parseBoolean(processScope);
+ Object obj = (Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbVar)) ? body
+ .getByteArray()
+ : body.get(esbVar);
+ Object oldVal = (isPrcScope) ? ctxInstance.getVariable(jbpmVar)
+ : ctxInstance.getVariable(jbpmVar, _token);
+ if (null == oldVal) {
+ if (null != obj) {
+ if (isPrcScope)
+ ctxInstance.createVariable(jbpmVar, obj);
+ else
+ ctxInstance.createVariable(jbpmVar, obj, _token);
+ }
+ } else {
+ if (null == obj) {
+ if (isPrcScope)
+ ctxInstance.deleteVariable(jbpmVar);
+ else
+ ctxInstance.deleteVariable(jbpmVar, _token);
+ } else {
+ if (isPrcScope)
+ ctxInstance.setVariable(jbpmVar, obj);
+ else
+ ctxInstance.setVariable(jbpmVar, obj, _token);
+ }
+ }
+ }
} // ________________________________
protected Message getMessageTemplate () throws Exception
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -30,8 +30,9 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Body;
import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.mapping.ObjectMapper;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
import org.jboss.soa.esb.services.jbpm.Constants;
-import org.jboss.soa.esb.util.Util;
import org.jbpm.context.exe.VariableContainer;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
@@ -61,61 +62,19 @@
static VariableMapping variablesFromConfig(ConfigTree tree, boolean acceptValue)
throws ConfigurationException
- {
- String tag = Constants.VARIABLES_TAG;
- ConfigTree[] childs = tree.getChildren(tag);
- if (null==childs || childs.length<1)
- return null;
- if (childs.length>1)
- throw new ConfigurationException("Only one <"+tag
- +"> element allowed in configuration");
-
- tag = Constants.ONE_VARIABLE_TAG;
- childs = childs[0].getChildren(tag);
- if (null==childs || childs.length<1)
- throw new ConfigurationException("At least one <"+tag
- +"> child element required for <"+Constants.VARIABLES_TAG+">");
- VariableMapping ret = new VariableMapping();
- for (ConfigTree curr: childs)
- {
- String name = curr.getAttribute("name");
- String esbName = curr.getAttribute(Constants.ESB_VARNAME_TAG);
- String jbpmName = curr.getAttribute(Constants.JBPM_VARNAME_TAG);
- if (null!=name)
- {
- if (null!=esbName || null!=jbpmName)
- throw new ConfigurationException("When 'name' is specified, neither '"
- +Constants.JBPM_VARNAME_TAG+"' nor"
- +Constants.ESB_VARNAME_TAG +"' are accepted");
- esbName = jbpmName = name;
- }
- else
- {
- if (Util.isNullString(esbName) || Util.isNullString(jbpmName))
- throw new ConfigurationException("Either 'name' or the pair '"
- +Constants.JBPM_VARNAME_TAG+"' and "
- +Constants.ESB_VARNAME_TAG +"' must be specified");
- }
- String value = curr.getAttribute("value");
-// if (acceptValue)
-// {
-// if (null==value)
-// throw new ConfigurationException("'value' attribute is required for the '"
-// +tree.getAttribute(BpmProcessor.COMMAND_ATTRIBUTE_TAG)
-// +"' command");
-// }
-// else
-// {
-// if (null!=value)
-// throw new ConfigurationException("'value' attribute is incompatible with the '"
-// +tree.getAttribute(BpmProcessor.COMMAND_ATTRIBUTE_TAG)
-// +"' command");
-// }
- // add entry even if value is null, so we'll have mapping anyways
- ret.setVariable(esbName, jbpmName, value);
- }
+ {
+ VariableMapping ret = new VariableMapping();
+ ConfigTree[] objectList = tree.getChildren(Constants.OBJECT_PATH_TAG);
+ if (objectList != null) {
+ for (ConfigTree curr : objectList) {
+ String esbName = curr.getAttribute(Constants.ESB_VARNAME_TAG);
+ String jbpmName = curr.getAttribute(Constants.JBPM_VARNAME_TAG);
+ String value = curr.getAttribute("value");
+ ret.setVariable(esbName, jbpmName, value);
+ }
+ }
return ret;
- } //________________________________
+ }
static String[] actorsFromConfig(ConfigTree tree, boolean acceptValue)
throws ConfigurationException
@@ -147,8 +106,15 @@
ret[i1++] = name;
}
return ret;
- } //________________________________
+ }
+ /**
+ * Maps variables in the jBPM variable map to an ESB message using a
+ * mapping which may contain MVEL expressions
+ *
+ * @param message
+ * @param mapping
+ */
static void jbpmVarsToMessage(Message message, VariableMapping mapping)
{
Body body = message.getBody();
@@ -156,6 +122,7 @@
if (null==obj)
return;
+ //First lets get the variable map
Map map = null;
if (obj instanceof ProcessInstance)
map= ((ProcessInstance)obj).getContextInstance().getVariables();
@@ -168,25 +135,30 @@
else
throw new IllegalArgumentException("Unknown return jbpmObject in message");
- for (Iterator II = map.entrySet().iterator(); II.hasNext();)
+ //now for all entries in the map, lets see if we have the jbpm key name in the mapping
+ for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();)
{
- Map.Entry curr = (Map.Entry)II.next();
- String keyInMsg = (null==mapping) ? (String)curr.getKey()
- : mapping.getEsbName((String)curr.getKey());
- Object value = curr.getValue();
+ Map.Entry variable = (Map.Entry)iterator.next();
+ String keyInMsg = null;
+ if (mapping == null) {
+ keyInMsg = (String)variable.getKey();
+ } else {
+ keyInMsg = mapping.getEsbName((String)variable.getKey());
+ }
+ Object value = variable.getValue();
if (null!=keyInMsg && null!=value)
{
- if (Constants.BODY_CONTENT_VARIABLE_NAME.equals(keyInMsg))
- {
- if (value instanceof byte[])
- body.setByteArray((byte[])value);
- else
- body.setByteArray(value.toString().getBytes());
- }
- else
- body.add(keyInMsg, value);
+ //set the object on the message
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ objectMapper.setObjectOnMessage(message, keyInMsg, value);
+ } catch (ObjectMappingException ome) {
+ throw new IllegalArgumentException(ome.getMessage(), ome);
+ }
}
}
+ //now remove the jBPM object from the message
+ body.remove(Constants.JBPM_RETURN_OBJECT);
} // _______________________________
static void populateVariableValues (Message message, VariableMapping mapping)
@@ -200,10 +172,14 @@
{
String esbName = curr.getKey();
String jbpmName = mapping.getJbpmName(esbName);
- Object value =
- Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbName)
- ? body.getByteArray()
- : body.get(esbName);
+
+ ObjectMapper objectMapper = new ObjectMapper();
+ Object value = null;
+ try {
+ value = objectMapper.getObjectFromMessage(message, esbName);
+ } catch (ObjectMappingException ome) {
+ throw new IllegalArgumentException(ome.getMessage(), ome);
+ }
// if object not found in body, use default value (from config)
if (null==value)
value = curr.getValue();
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -63,7 +63,7 @@
body.add(key,_includeAllVars);
} // _______________________________
- public Message postFormat(Message response)
+ public Message postFormat(Message response)
{
if (null!=_variables)
FacadeUtil.jbpmVarsToMessage(response,_variables);
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -22,24 +22,34 @@
public int size() { return _values.size(); }
- public String setMapping(String esbName, String jbpmName)
+ private String setMapping(String esbName, String jbpmName)
{
if (Util.isNullString(esbName) && Util.isNullString(jbpmName))
- throw new IllegalArgumentException("You must specify at least one valid variable name (esb or jBPM)");
+ throw new IllegalArgumentException("You must specify at least one valid variable name (esb or bpm)");
if (Util.isNullString(jbpmName))
- jbpmName = esbName;
+ jbpmName = getName(esbName);
if (Util.isNullString(esbName))
- esbName = jbpmName;
+ esbName = getName(jbpmName);
String oldMapping = _esbNames.get(jbpmName);
if (null!=oldMapping && !oldMapping.equals(jbpmName))
throw new IllegalArgumentException
- ("Illegal mapping esb=<"+esbName+"> was mapped to jbpm=<"+oldMapping+ "> cannot remap to "+jbpmName);
+ ("Illegal mapping esb=<"+esbName+"> was mapped to bpm=<"+oldMapping+ "> cannot remap to "+jbpmName);
_esbNames .put(esbName, jbpmName);
_jbpmNames .put(jbpmName, esbName);
// Internally, esbName is the key to the variable values
return esbName;
}
+
+ protected String getName(String path)
+ {
+ String name = path;
+ int index = path.lastIndexOf(".");
+ if (index > 0) {
+ name = path.substring(index+1);
+ }
+ return name;
+ }
public void setVariable(String esbName, String jbpmName, Object value)
{
Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandlerUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -108,7 +108,10 @@
_logger.info("Token Var x2= "+second);
assertTrue(second.equals(instance.getContextInstance().getVariable("x2",instance.getRootToken())));
_logger.info("Token Var x3= "+body);
- assertTrue(body.equals(new String((byte[])instance.getContextInstance().getVariable("x3",instance.getRootToken()))));
+
+ byte[] byteArray = (byte[]) instance.getContextInstance().getVariable("x3",instance.getRootToken());
+ String string = new String(byteArray);
+ assertEquals(body,string);
instance.signal();
assertTrue(
Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -139,8 +139,7 @@
assertTrue(Constants.RETCODE_OK.equals(ret));
// Keep the variables for comparison in future steps
- ConfigTree[] vars = actions[index].getFirstChild(Constants.VARIABLES_TAG)
- .getChildren(Constants.ONE_VARIABLE_TAG);
+ ConfigTree[] vars = actions[index].getChildren(Constants.OBJECT_PATH_TAG);
command = new BpmProcessor(actions[index++]);
request = Helper.commandMessageTemplate();
@@ -148,9 +147,7 @@
_logger.info(JbpmTestUtil.dumpResponse(response, command.getOpCode()));
ret = Helper.getStringValue(response, Constants.RETURN_CODE);
assertTrue(Constants.RETCODE_OK.equals(ret));
-
-
-
+
Long tokenId = (Long)response.getBody().get(Constants.TOKEN_ID);
Long processId = (Long)response.getBody().get(Constants.PROCESS_INSTANCE_ID);
@@ -166,6 +163,7 @@
Body body = response.getBody();
assertTrue(vars[1].getAttribute("value").equals(body.get("xxx")));
assertTrue(vars[2].getAttribute("value").equals(body.get("yyy")));
+ assertTrue(vars[3].getAttribute("value").equals(body.get("newVar")));
command = new BpmProcessor(actions[index++]);
request = Helper.commandMessageTemplate();
Added: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMappingUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMappingUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMappingUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import static org.junit.Assert.assertEquals;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.junit.Test;
+
+
+/**
+ * @author kstam
+ *
+ */
+public class VariableMappingUnitTest
+{
+
+ @Test
+ public void testGetName()
+ {
+ VariableMapping mapper = new VariableMapping();
+ String path = "body.someobjectname";
+ String name = mapper.getName(path);
+ assertEquals("someobjectname",name);
+ }
+
+
+
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(VariableMappingUnitTest.class);
+ }
+}
Property changes on: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMappingUnitTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/testSingleCommands.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/testSingleCommands.xml 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/testSingleCommands.xml 2007-08-18 15:54:26 UTC (rev 14350)
@@ -28,24 +28,23 @@
process-definition-name="simple"
actor="FrankSinatra"
>
- <variables>
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" value="DEF DEF DEF"/>
- <variable esb-name="eVar1" jbpm-name="j1" value="AAAbbb111" />
- <variable esb-name="eVar2" jbpm-name="vJ22" value="998877" />
- </variables>
+ <object-path esb="BODY_CONTENT" bpm="theBody" value="DEF DEF DEF"/>
+ <object-path esb="body.eVar1" bpm="j1" value="AAAbbb111" />
+ <object-path esb="eVar2" bpm="vJ22" value="998877" />
+ <object-path esb="body.newVar" value="123" />
</action>
<action name="nowGetItBack"
class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor"
command="GetProcessInstanceCommand"
>
- <include-logs value="true"/>
- <include-all-variables value="true"/>
- <variables>
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
- <variable esb-name="yyy" jbpm-name="vJ22" />
- <variable esb-name="xxx" jbpm-name="j1" />
- </variables>
+ <include-logs value="true"/>
+ <include-all-variables value="true"/>
+ <object-path esb="BODY_CONTENT" bpm="theBody" />
+ <object-path esb="yyy" bpm="vJ22" />
+ <object-path esb="xxx" bpm="j1" />
+ <object-path bpm="newVar" />
+
</action>
<action name="testBodyContent"
@@ -53,9 +52,7 @@
command="VariablesCommand"
>
<include-logs value="true"/>
- <variables>
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
- </variables>
+ <object-path esb="BODY_CONTENT" bpm="theBody" />
</action>
<action name="nowCancelIt"
@@ -68,10 +65,7 @@
class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor"
command="GetProcessInstanceCommand"
>
-
- <variables>
- <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
- </variables>
+ <object-path esb="BODY_CONTENT" bpm="theBody" />
</action>
</testActions>
Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/resources/testMappingDefinition.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/resources/testMappingDefinition.xml 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/resources/testMappingDefinition.xml 2007-08-18 15:54:26 UTC (rev 14350)
@@ -10,14 +10,14 @@
<esbServiceName>MOCK_SERVICE</esbServiceName>
<millisToWaitForResponse>1</millisToWaitForResponse>
<jbpmToEsbVars>
- <mapping jbpm-name="v1" esb-name="esbObj1" />
- <mapping jbpm-name="g2" esb-name="esbObj2" process-scope="true" />
- <mapping jbpm-name="body" esb-name="BODY_CONTENT" />
+ <mapping jbpm="v1" esb="esbObj1" />
+ <mapping jbpm="g2" esb="esbObj2" process-scope="true" />
+ <mapping jbpm="body" esb="BODY_CONTENT" />
</jbpmToEsbVars>
<returnVars>
- <mapping jbpm-name="x1" esb-name="esbObj1" process-scope="true" />
- <mapping jbpm-name="x2" esb-name="esbObj2" />
- <mapping jbpm-name="x3" esb-name="BODY_CONTENT" />
+ <mapping jbpm="x1" esb="esbObj1" process-scope="true" />
+ <mapping jbpm="x2" esb="esbObj2" />
+ <mapping jbpm="x3" esb="BODY_CONTENT" />
</returnVars>
</action>
</transition>
Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -34,6 +34,7 @@
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.message.format.MessageType;
import org.jboss.soa.esb.message.mapping.ObjectMapper;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
import org.jboss.soa.esb.services.routing.MessageRouterException;
import org.junit.Test;
@@ -45,7 +46,7 @@
public class BusinessProcessorRoutingUnitTest
{
@Test
- public void discount()
+ public void discount() throws ObjectMappingException
{
//new messages
Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
@@ -76,7 +77,7 @@
}
@Test
- public void nodiscount()
+ public void nodiscount() throws ObjectMappingException
{
//new messages
Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java 2007-08-18 15:50:31 UTC (rev 14349)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java 2007-08-18 15:54:26 UTC (rev 14350)
@@ -34,6 +34,7 @@
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.message.format.MessageType;
import org.jboss.soa.esb.message.mapping.ObjectMapper;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
import org.jboss.soa.esb.services.routing.MessageRouterException;
import org.junit.Test;
@@ -45,7 +46,7 @@
public class BusinessProcessorUnitTest
{
@Test
- public void discount()
+ public void discount() throws ObjectMappingException
{
//new messages
Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
More information about the jboss-svn-commits
mailing list