[jboss-svn-commits] JBL Code SVN: r23246 - in labs/jbossesb/workspace/skeagh: api/service/src/main/java/org/jboss/esb/message and 14 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Oct 1 11:56:59 EDT 2008


Author: tfennelly
Date: 2008-10-01 11:56:58 -0400 (Wed, 01 Oct 2008)
New Revision: 23246

Added:
   labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/01-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/01-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/01-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java
Removed:
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/xml/message.xsd
Modified:
   labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java
   labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/ESBTestComponent.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java
Log:
More routing tests.
Added JavaSerializer.

Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -22,6 +22,8 @@
 import org.jboss.esb.message.Message;
 import org.jboss.esb.service.ServiceName;
 
+import java.io.Serializable;
+
 /**
  * Fault Context.
  * <p/>
@@ -31,7 +33,7 @@
  *
  * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
  */
-public class FaultContext
+public class FaultContext implements Serializable
 {
     /**
      * The fault.

Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -36,6 +36,7 @@
  */
 public class Message implements Serializable
 {
+    // TODO: Make Externalizable
 
     /**
      * Primary Payload.

Added: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.classpath;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+/**
+ * Implementation of an object input stream that delegates class loading to the thread
+ * context classloader in preference.
+ *
+ * @author kevin
+ */
+public class ContextObjectInputStream extends ObjectInputStream
+{
+    /**
+     * Construct a default instance of the context aware object input stream.
+     *
+     * @throws SecurityException if an active security manager prevents subclassing
+     * @throws IOException       for IO errors.
+     */
+    protected ContextObjectInputStream() throws IOException, SecurityException
+    {
+    }
+
+    /**
+     * Construct a context aware object input stream using the specified input stream.
+     *
+     * @param in The associated input stream.
+     * @throws IOException for IO errors reading from the stream.
+     */
+    public ContextObjectInputStream(final InputStream in) throws IOException
+    {
+        super(in);
+    }
+
+    /**
+     * Resolve the class using the active context.
+     *
+     * @param desc The object stream class description.
+     * @return The associated class.
+     * @throws ClassNotFoundException if the class cannot be found.
+     * @throws IOException            for I/O Errors.
+     */
+    @Override
+    protected Class<?> resolveClass(final ObjectStreamClass desc) throws IOException, ClassNotFoundException
+    {
+        return ClassUtil.forName(desc.getName(), ContextObjectInputStream.class);
+    }
+
+    /**
+     * Resolve the proxy class using the active context.
+     *
+     * @param interfaces The interfaces associated with the proxy.
+     * @return The associated class.
+     * @throws ClassNotFoundException if an interface cannot be found.
+     * @throws IOException            for I/O Errors.
+     */
+    @Override
+    protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException
+    {
+        return ClassUtil.resolveProxy(interfaces, ContextObjectInputStream.class);
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -41,6 +41,8 @@
 import org.jboss.esb.routing.ServiceInvoker;
 import org.jboss.esb.service.ServiceException;
 import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.serialization.java.JavaSerializer;
+import org.jboss.esb.serialization.SerializationException;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -209,9 +211,7 @@
                 {
                     if(service.getServiceMEP() == ServiceMEP.InOut)
                     {
-                        // We make a shallow clone in case it's a local service
-                        // invocation...
-                        serviceInvoker.send((Message) outMessage.clone(), replyTo);
+                        serviceInvoker.send(outMessage, replyTo);
                     }
                     else
                     {
@@ -228,26 +228,27 @@
                 if (faultTo != null)
                 {
                     FaultContext faultContext = InvocationContext.getContext().getFaultContext();
-                    Message faultMessage = new Message(BusMessage.create(theMessage));
+                    BusMessage busMessage = BusMessage.create(theMessage);
 
                     faultContext.setFaultMessage(theMessage);
                     faultContext.setFault(e);
                     faultContext.setFaultRecipient(faultTo);
+                    busMessage.setFault(e);
 
-                    logger.error("ServiceException in service '" + serviceName + "'.  Routing fault message to '" + faultTo + "'.", e);
-                    serviceInvoker.send(faultMessage, faultTo);
+                    logger.debug("ServiceException in service '" + serviceName + "'.  Routing fault message to '" + faultTo + "'.", e);
+                    serviceInvoker.send(new Message(busMessage), faultTo);
                     // If the routing of the fault message to the faultTo address fails, it will be routed to the 
                     // Dead Letter Service and retried later.
                 }
                 else
                 {
-                    logger.error("ServiceException in service '" + serviceName + "'.  'faultTo' address not specified.  Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", e);
+                    logger.debug("ServiceException in service '" + serviceName + "'.  'faultTo' address not specified.  Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", e);
                     routeToDeadLetterService(theMessage, e);
                 }
             }
             catch (Throwable t)
             {
-                logger.error("Non ServiceException in service '" + serviceName + "'.  Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", t);
+                logger.debug("Non ServiceException in service '" + serviceName + "'.  Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", t);
                 routeToDeadLetterService(theMessage, t);
             }
         }
@@ -305,11 +306,20 @@
 
                 for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
                 {
-                    // Create a shallow clone of the message in case there's an error or
-                    // there are multiple outrouters with processors on them...
-                    Message clone = (Message) outMessage.clone();
                     OutboundRouter outRouter = outboundRouterConfig.getRouter();
 
+                    // Create a clone of the message in case there's an error or
+                    // there are multiple outrouters with processors on them...
+                    Message clone;
+                    try
+                    {
+                        clone = JavaSerializer.copy(outMessage);
+                    }
+                    catch (SerializationException e)
+                    {
+                        throw new RuntimeException("Cannot route message.  Unable to copy message.", e);
+                    }
+
                     if (outRouter instanceof BusOutboundRouter)
                     {
                         if (!((BusOutboundRouter) outRouter).hasService(serviceName))
@@ -489,12 +499,21 @@
      */
     public static boolean routeToDeadLetterService(final Message theMessage, final Throwable theFault, final ServiceInvoker serviceInvoker)
     {
+        AddressingContext addressingContext = AddressingContext.getContext();
+
+        if(addressingContext.getTo().equals(DeadLetterPersistanceService.SERVICE_NAME))
+        {
+            return false;
+        }
+
         FaultContext faultContext = InvocationContext.getContext().getFaultContext();
+        BusMessage busMessage = BusMessage.create(theMessage);
 
         faultContext.setFaultMessage(theMessage);
         faultContext.setFault(theFault);
         faultContext.setFaultRecipient(DeadLetterPersistanceService.SERVICE_NAME);
+        busMessage.setFault(theFault);
 
-        return serviceInvoker.send(new Message(BusMessage.create(theMessage)), DeadLetterPersistanceService.SERVICE_NAME);
+        return serviceInvoker.send(new Message(busMessage), DeadLetterPersistanceService.SERVICE_NAME);
     }
 }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -67,7 +67,7 @@
             throw (ServiceException) throwException;
         }
 
-        if(expectingMessages)
+        if(!expectingMessages)
         {
             throw new RuntimeException("No expecting Dead Letter message deliveries. Call setExpectingMessages(true) to turn off this error.");
         }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -38,6 +38,8 @@
  */
 public final class BusMessage implements Serializable
 {
+    // TODO: Make Externalizable
+
     /**
      * Invocation Parameters.
      */
@@ -47,6 +49,10 @@
      */
     private AddressingContext addressingContext;
     /**
+     * The fault.
+     */
+    private Throwable fault;
+    /**
      * Message.
      */
     private Message message;
@@ -125,6 +131,24 @@
     }
 
     /**
+     * Get the associated fault.
+     * @return The associated fault.
+     */
+    public final Throwable getFault()
+    {
+        return fault;
+    }
+
+    /**
+     * Set the associated fault.
+     * @param fault The associated fault.
+     */
+    public final void setFault(final Throwable fault)
+    {
+        this.fault = fault;
+    }
+
+    /**
      * Get the processing event log.
      * <p/>
      * Only attached for debug/trace purposes.  See the "history.event.propagate" property

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -35,6 +35,8 @@
 import org.jboss.esb.service.ServiceName;
 import org.jboss.esb.util.AssertArgument;
 import org.jboss.esb.history.ProcessingEventLog;
+import org.jboss.esb.serialization.java.JavaSerializer;
+import org.jboss.esb.serialization.SerializationException;
 
 import java.util.Iterator;
 import java.util.List;
@@ -152,8 +154,21 @@
                     ProcessingEventLog.setEventLog(eventLog, dispatchInvocationContext);
                 }
 
-                // And dispatch the message...
-                inRouter.dispatch(message, dispatchInvocationContext);
+                // Create a clone of the message in this case.  We don't want the local
+                // invocation messing with anything else that might be going on...
+                Message clone;
+                try
+                {
+                    // TODO: Make this optional i.e. on by default, but can be turned off for performance reasons if required.
+                    clone = JavaSerializer.copy(message);
+                }
+                catch (SerializationException e)
+                {
+                    throw new RuntimeException("Cannot route message.  Unable to copy message.", e);
+                }
+
+                // And dispatch the message clone...
+                inRouter.dispatch(clone, dispatchInvocationContext);
                 
                 return dispatchInvocationContext.getFaultContext().getFault() == null;
             }

Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.serialization.java;
+
+import org.jboss.esb.classpath.ContextObjectInputStream;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.serialization.SerializationException;
+import org.jboss.esb.serialization.Serializer;
+import org.jboss.esb.util.AssertArgument;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+
+/**
+ * Java Serializer.
+ * <p/>
+ * Provides support for Java Object serialization/deserialization of
+ * an ESB message.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JavaSerializer implements Serializer
+{
+    /**
+     * Singleton Serializer.
+     */
+    private static final JavaSerializer serializer = new JavaSerializer();
+
+    /**
+     * Serialize the supplied {@link Message} to the supplied {@link OutputStream}.
+     *
+     * @param message   The Message.
+     * @param outStream The OutputStream.
+     * @throws SerializationException Failed to serialize message.
+     */
+    public final void serialize(final Message message, final OutputStream outStream) throws SerializationException
+    {
+        // Write the message...
+        ObjectOutputStream output;
+
+        try
+        {
+            output = new ObjectOutputStream(outStream);
+        }
+        catch (IOException e)
+        {
+            throw new SerializationException("Failed to create Java Object OutputStream.", e);
+        }
+
+        try
+        {
+            try
+            {
+                output.writeObject(message);
+            }
+            catch (IOException e)
+            {
+                throw new SerializationException("Failed to serialize Java Object to OutputStream.", e);
+            }
+        }
+        finally
+        {
+            try
+            {
+                output.close();
+            }
+            catch (IOException e)
+            {
+                throw new SerializationException("Failed to close Java Object OutputStream.", e);
+            }
+        }
+    }
+
+    /**
+     * Deserialize the {@link Message} from the supplied {@link InputStream}.
+     *
+     * @param messageStream The InputStream.
+     * @return The Message.
+     * @throws SerializationException Failed to deserialize message.
+     */
+    public final Message deserialize(final InputStream messageStream) throws SerializationException
+    {
+        ObjectInputStream input = null;
+        try
+        {
+            input = new ContextObjectInputStream(messageStream);
+        }
+        catch (IOException e)
+        {
+            throw new SerializationException("Failed to create Java Object InputStream.", e);
+        }
+        try
+        {
+            try
+            {
+                return (Message) input.readObject();
+            }
+            catch (IOException e)
+            {
+                throw new SerializationException("Failed to deserialize Java Object from InputStream.", e);
+            }
+        }
+        catch (ClassNotFoundException e)
+        {
+            throw new SerializationException("Unable to deserialize message instance.", e);
+        }
+        finally
+        {
+            try
+            {
+                input.close();
+            }
+            catch (IOException e)
+            {
+                throw new SerializationException("Failed to close Java Object InputStream.", e);
+            }
+        }
+    }
+
+    /**
+     * Make a complete copy the supplied ESB message.
+     * <p/>
+     * Serializes and then deserializes the message.
+     *
+     * @param message The message.
+     * @return
+     * @throws SerializationException
+     */
+    public static Message copy(final Message message) throws SerializationException
+    {
+        AssertArgument.isNotNull(message, "message");
+
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+
+        serializer.serialize(message, outStream);
+
+        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
+
+        return serializer.deserialize(inStream);
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/xml/message.xsd
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/xml/message.xsd	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/xml/message.xsd	2008-10-01 15:56:58 UTC (rev 23246)
@@ -1 +0,0 @@
-TODO...
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/ESBTestComponent.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/ESBTestComponent.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/ESBTestComponent.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -25,25 +25,28 @@
 import org.jboss.esb.context.AddressingContext;
 import org.jboss.esb.context.DeploymentContext;
 import org.jboss.esb.message.Message;
+import org.jboss.esb.service.ServiceException;
+import org.jboss.esb.routing.RoutingException;
 
 /**
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 public abstract class ESBTestComponent
 {
-    public String message;
+    public Object message;
     public static InvocationContext invocationContext;
     public static AddressingContext addressingContext;
     public static DeploymentContext deploymentContext;
     public ProcessingEventLog eventLog;
     public long sleep = 0L;
+    private Exception throwException = null;
 
     public void setSleep(long sleep)
     {
         this.sleep = sleep;
     }
 
-    public String getMessage()
+    public Object getMessage()
     {
         return message;
     }
@@ -83,13 +86,50 @@
 
     protected void captureData(Message message)
     {
-        this.message = (String) message.getPayload();
+        this.message = message.getPayload();
         invocationContext = InvocationContext.getContext();
         addressingContext = AddressingContext.getContext();
         deploymentContext = DeploymentContext.getContext();
         eventLog = ProcessingEventLog.getEventLog();
     }
 
+    public void throwException() throws ServiceException, RoutingException
+    {
+        if(throwException instanceof RuntimeException)
+        {
+            throw (RuntimeException) throwException;
+        }
+        else if(throwException instanceof ServiceException)
+        {
+            throw (ServiceException) throwException;
+        }
+        else if(throwException instanceof RoutingException)
+        {
+            throw (RoutingException) throwException;
+        }
+    }
+
+    public void setThrowException(Exception throwException)
+    {
+        if(throwException instanceof RuntimeException)
+        {
+            // Lovely...
+        }
+        else if(throwException instanceof ServiceException)
+        {
+            // Lovely...
+        }
+        else if(throwException instanceof RoutingException)
+        {
+            // Lovely...
+        }
+        else
+        {
+            throw new IllegalArgumentException("Must be a " + RuntimeException.class.getName() + " or " + ServiceException.class.getName() + ".");
+        }
+        this.throwException = throwException;
+    }
+
     protected void sleep()
     {
         try

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -19,9 +19,11 @@
  */
 package org.jboss.esb;
 
+import junit.framework.TestCase;
 import org.jboss.esb.message.Message;
 import org.jboss.esb.routing.OutboundRouter;
 import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.service.ServiceException;
 
 /**
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -33,5 +35,13 @@
     {
         sleep();
         captureData(message);
+        try
+        {
+            throwException();
+        }
+        catch (ServiceException e)
+        {
+            TestCase.fail("Unexpected exception: " + e.getMessage());
+        }
     }
 }
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -22,16 +22,28 @@
 import org.jboss.esb.message.Message;
 import org.jboss.esb.service.Service;
 import org.jboss.esb.service.ServiceException;
+import org.jboss.esb.routing.RoutingException;
+import junit.framework.TestCase;
 
 /**
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 public class TestService extends ESBTestComponent implements Service
 {
+
+
     public Message process(Message message) throws ServiceException
     {
         sleep();
         captureData(message);
+        try
+        {
+            throwException();
+        }
+        catch (RoutingException e)
+        {
+            TestCase.fail("Unexpected exception: " + e.getMessage());
+        }
 
         return message;
     }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java	2008-10-01 15:15:09 UTC (rev 23245)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -35,7 +35,7 @@
 {
 
     /*
-     * The message should go (across the 3 deployments):
+     * The message should go (across the 2 deployments):
      *      [inrouter_ServiceA -> ServiceA] -|
      *                 [replyTo{ServiceB}] <-|-> [outrouter_ServiceA]
      */

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/01-deployment.xml (from rev 23234, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/01-deployment.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/01-deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/01-deployment.xml	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,16 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+    <services>
+
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" mep="In-Out">
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter">
+                <faultTo serviceCategory="Service" serviceName="B" />
+            </inRouter>
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
+        </service>
+
+        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.TestService" />
+        
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/01-deployment.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java (from rev 23241, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.routing.scenario_011;
+
+import junit.framework.TestCase;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.federate.bus.BusMessage;
+import org.jboss.esb.jms.JmsTestRunner;
+import org.jboss.esb.service.ServiceException;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class RoutingTest extends TestCase
+{
+
+    /*
+     * The message should go:
+     *      [inrouter_ServiceA -> ServiceA] -|
+     *                 [faultTo{ServiceB}] <-|
+     */
+    public void test() throws Exception
+    {
+        new JmsTestRunner() {
+            @Override
+            public void test() throws Exception
+            {
+                ServiceName serviceNameA = new ServiceName("Service", "A");
+                ServiceName serviceNameB = new ServiceName("Service", "B");
+                DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+
+                deployment1.setDeploymentName("deployment1");
+                deployment1.setDeploymentId("deployment1-Id");
+                deployment1.deploy();
+                try
+                {
+                    TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceNameA, "inrouter", deployment1).getRouter();
+                    TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+                    TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
+                    TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment1).getRouter();
+                    String faultString = "A Service Exception - should route to faultTo address.";
+
+                    serviceA.setThrowException(new ServiceException(faultString));
+
+                    inrouter.sendMessage("Hi there!!", true);
+
+                    serviceA.waitForMessage(10000);
+                    serviceB.waitForMessage(10000);
+
+                    // Check that the message has been routed across deployments, from the inrouter
+                    // to the service instance and then to the outrouter...
+                    assertEquals("Hi there!!", serviceA.getMessage());
+                    BusMessage faultMessage = (BusMessage) serviceB.getMessage();
+                    assertEquals("Hi there!!", faultMessage.getMessage().getPayload());
+                    assertEquals("Service:A", faultMessage.getAddressingContext().getTo().toString());
+                    assertEquals("Service:B", faultMessage.getAddressingContext().getFaultTo().toString());
+                    assertTrue(faultMessage.getFault() instanceof ServiceException);                    
+                    assertEquals(faultString, faultMessage.getFault().getMessage());
+                    assertEquals(null, outrouter.getMessage());
+                }
+                finally
+                {
+                    deployment1.undeploy();
+                }
+            }
+        }.run();
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/01-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/01-deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/01-deployment.xml	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,11 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+    <services>
+
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" mep="In-Out">
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
+        </service>
+        
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/01-deployment.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.routing.scenario_012;
+
+import junit.framework.TestCase;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestService;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.failure.DeadLetterPersistanceService;
+import org.jboss.esb.failure.MockDeadLetterService;
+import org.jboss.esb.federate.bus.BusMessage;
+import org.jboss.esb.jms.JmsTestRunner;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class RoutingTest extends TestCase
+{
+
+    /*
+     * The message should go:
+     *      [inrouter_ServiceA -> ServiceA] -|
+     *                 [DeadLetterService] <-|
+     */
+    public void test() throws Exception
+    {
+        new JmsTestRunner() {
+            @Override
+            public void test() throws Exception
+            {
+                ServiceName serviceNameA = new ServiceName("Service", "A");
+                DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+
+                deployment1.setDeploymentName("deployment1");
+                deployment1.setDeploymentId("deployment1-Id");
+                deployment1.deploy();
+                try
+                {
+                    TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceNameA, "inrouter", deployment1).getRouter();
+                    TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+                    MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
+                    String faultString = "A Runtime Exception - should route to Dead Letter Service.";
+
+                    serviceA.setThrowException(new RuntimeException(faultString));
+                    dlService.setExpectingMessages(true);
+
+                    inrouter.sendMessage("Hi there!!", true);
+
+                    serviceA.waitForMessage(10000);
+
+                    // Check that the message has been routed across deployments, from the inrouter
+                    // to the service instance and then to the outrouter...
+                    assertEquals("Hi there!!", serviceA.getMessage());
+                    BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
+                    assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+                    assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
+                    assertTrue(dlsMessage.getFault() instanceof RuntimeException);
+                    assertEquals(faultString, dlsMessage.getFault().getMessage());
+                }
+                finally
+                {
+                    deployment1.undeploy();
+                }
+            }
+        }.run();
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/01-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/01-deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/01-deployment.xml	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,11 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+    <services>
+
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" mep="In-Out">
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
+        </service>
+
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/01-deployment.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.routing.scenario_013;
+
+import junit.framework.TestCase;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestService;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.failure.DeadLetterPersistanceService;
+import org.jboss.esb.failure.MockDeadLetterService;
+import org.jboss.esb.federate.bus.BusMessage;
+import org.jboss.esb.jms.JmsTestRunner;
+import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.service.ServiceException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class RoutingTest extends TestCase
+{
+
+    /*
+     * The message should go:
+     *      [inrouter_ServiceA -> ServiceA] -|
+     *                 [DeadLetterService] <-|
+     *
+     * It's a ServiceException (not a runtime), but no faultTo address was specified, so
+     * it should route to the DLS.
+     */
+    public void test() throws Exception
+    {
+        new JmsTestRunner() {
+            @Override
+            public void test() throws Exception
+            {
+                ServiceName serviceNameA = new ServiceName("Service", "A");
+                DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+
+                deployment1.setDeploymentName("deployment1");
+                deployment1.setDeploymentId("deployment1-Id");
+                deployment1.deploy();
+                try
+                {
+                    TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceNameA, "inrouter", deployment1).getRouter();
+                    TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+                    MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
+                    String faultString = "A Service Exception - should route to Dead Letter Service because there's no faultTo address.";
+
+                    serviceA.setThrowException(new ServiceException(faultString));
+                    dlService.setExpectingMessages(true);
+
+                    inrouter.sendMessage("Hi there!!", true);
+
+                    serviceA.waitForMessage(10000);
+
+                    // Check that the message has been routed across deployments, from the inrouter
+                    // to the service instance and then to the outrouter...
+                    assertEquals("Hi there!!", serviceA.getMessage());
+                    BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
+                    assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+                    assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
+                    assertTrue(dlsMessage.getFault() instanceof ServiceException);
+                    assertEquals(faultString, dlsMessage.getFault().getMessage());
+                }
+                finally
+                {
+                    deployment1.undeploy();
+                }
+            }
+        }.run();
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java	2008-10-01 15:56:58 UTC (rev 23246)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.serialization.java;
+
+import junit.framework.TestCase;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.serialization.SerializationException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JavaSerializerTest extends TestCase
+{
+
+    public void test() throws SerializationException
+    {
+        Message original = new Message("Hello world");
+
+        original.getAttachments().put("a", 12345);
+
+        Message copy = JavaSerializer.copy(original);
+
+        assertTrue(copy != original);
+        assertTrue(copy.getPayload() != original.getPayload());
+        assertTrue(copy.getAttachments().get("a") != original.getAttachments().get("a"));
+
+        assertEquals(copy.getPayload(), original.getPayload());
+        assertEquals(copy.getAttachments().get("a"), original.getAttachments().get("a"));
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list