servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r394227 [3/3] - in /incubator/servicemix/trunk: ./ servicemix-assembly/ servicemix-common/src/main/java/org/apache/servicemix/common/ servicemix-core/src/main/java/org/apache/servicemix/ servicemix-core/src/main/java/org/apache/servicemix/e...
Date Fri, 14 Apr 2006 23:38:46 GMT
Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/ContentBasedRouterTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/ContentBasedRouterTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/ContentBasedRouterTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/ContentBasedRouterTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOut;
+import javax.xml.namespace.QName;
+
+import org.apache.activemq.util.IdGenerator;
+import org.apache.servicemix.eip.patterns.ContentBasedRouter;
+import org.apache.servicemix.eip.support.RoutingRule;
+import org.apache.servicemix.eip.support.XPathPredicate;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.store.memory.MemoryStore;
+import org.apache.servicemix.tck.ReceiverComponent;
+import org.w3c.dom.Node;
+
+public class ContentBasedRouterTest extends AbstractEIPTest {
+
+    private ContentBasedRouter router;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        router = new ContentBasedRouter();
+        router.setRules(new RoutingRule[] {
+                new RoutingRule(
+                        new XPathPredicate("/hello/@id = '1'"),
+                        createServiceExchangeTarget(new QName("target1"))),
+                new RoutingRule(
+                        new XPathPredicate("/hello/@id = '2'"),
+                        createServiceExchangeTarget(new QName("target2"))),
+                new RoutingRule(
+                        null,
+                        createServiceExchangeTarget(new QName("target3")))
+        });
+        configureRouter();
+        activateComponent(router, "router");
+    }
+    
+    protected void configureRouter() throws Exception {
+        router.setStore(new MemoryStore(new IdGenerator()) {
+            public void store(String id, Object exchange) throws IOException {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                new ObjectOutputStream(baos).writeObject(exchange);
+                super.store(id, exchange);
+            }
+        });
+    }
+    
+    public void testInOnly() throws Exception {
+        ReceiverComponent rec1 = activateReceiver("target1");
+        ReceiverComponent rec2 = activateReceiver("target2");
+        ReceiverComponent rec3 = activateReceiver("target3");
+        
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("router"));
+        me.getInMessage().setContent(createSource("<hello id='1' />"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        rec1.getMessageList().assertMessagesReceived(1); 
+        rec2.getMessageList().assertMessagesReceived(0);
+        rec3.getMessageList().assertMessagesReceived(0);
+
+        rec1.getMessageList().flushMessages();
+        rec2.getMessageList().flushMessages();
+        rec3.getMessageList().flushMessages();
+
+        me = client.createInOnlyExchange();
+        me.setService(new QName("router"));
+        me.getInMessage().setContent(createSource("<hello id='2' />"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        rec1.getMessageList().assertMessagesReceived(0);
+        rec2.getMessageList().assertMessagesReceived(1);
+        rec3.getMessageList().assertMessagesReceived(0);
+
+        rec1.getMessageList().flushMessages();
+        rec2.getMessageList().flushMessages();
+        rec3.getMessageList().flushMessages();
+
+        me = client.createInOnlyExchange();
+        me.setService(new QName("router"));
+        me.getInMessage().setContent(createSource("<hello id='3' />"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        rec1.getMessageList().assertMessagesReceived(0);
+        rec2.getMessageList().assertMessagesReceived(0);
+        rec3.getMessageList().assertMessagesReceived(1);
+    }
+
+    public void testInOut() throws Exception {
+        activateComponent(new ReturnMockComponent("<from1/>"), "target1");
+        activateComponent(new ReturnMockComponent("<from2/>"), "target2");
+        activateComponent(new ReturnMockComponent("<from3/>"), "target3");
+        
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("router"));
+        me.getInMessage().setContent(createSource("<hello id='1' />"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        Node node = new SourceTransformer().toDOMNode(me.getOutMessage());
+        assertEquals("from1", node.getFirstChild().getNodeName());
+        client.done(me);
+        
+        me = client.createInOutExchange();
+        me.setService(new QName("router"));
+        me.getInMessage().setContent(createSource("<hello id='2' />"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        node = new SourceTransformer().toDOMNode(me.getOutMessage());
+        assertEquals("from2", node.getFirstChild().getNodeName());
+        client.done(me);
+        
+        me = client.createInOutExchange();
+        me.setService(new QName("router"));
+        me.getInMessage().setContent(createSource("<hello id='3' />"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        node = new SourceTransformer().toDOMNode(me.getOutMessage());
+        assertEquals("from3", node.getFirstChild().getNodeName());
+        client.done(me);
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.RobustInOnly;
+import javax.xml.namespace.QName;
+
+import org.apache.activemq.util.IdGenerator;
+import org.apache.servicemix.eip.patterns.Pipeline;
+import org.apache.servicemix.store.memory.MemoryStore;
+import org.apache.servicemix.tck.ReceiverComponent;
+
+public class PipelineTest extends AbstractEIPTest {
+
+    protected Pipeline pipeline;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        pipeline = new Pipeline();
+        pipeline.setTransformer(createServiceExchangeTarget(new QName("transformer")));
+        pipeline.setTarget(createServiceExchangeTarget(new QName("target")));
+        configurePipeline();
+        activateComponent(pipeline, "pipeline");
+    }
+    
+    protected void configurePipeline() throws Exception {
+        pipeline.setStore(new MemoryStore(new IdGenerator()) {
+            public void store(String id, Object exchange) throws IOException {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                new ObjectOutputStream(baos).writeObject(exchange);
+                super.store(id, exchange);
+            }
+        });
+    }
+
+    public void testInOut() throws Exception {
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+    }
+    
+    public void testInOptionalOut() throws Exception {
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+    }
+    
+    public void testInOnly() throws Exception {
+        activateComponent(new ReturnOutComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        target.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOnlyWithTransformerFault() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        target.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOnlyWithTransformerError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        target.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOnlyWithTargetError() throws Exception {
+        activateComponent(new ReturnOutComponent(), "transformer");
+        activateComponent(new ReturnErrorComponent(), "target");
+
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnly() throws Exception {
+        activateComponent(new ReturnOutComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        target.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithTransformerFault() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        target.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithTransformerFaultAndError() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.fail(me, new Exception("I do not like faults"));
+        
+        target.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithTransformerError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        target.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithTargetFault() throws Exception {
+        activateComponent(new ReturnOutComponent(), "transformer");
+        activateComponent(new ReturnFaultComponent(), "target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithTargetFaultAndError() throws Exception {
+        activateComponent(new ReturnOutComponent(), "transformer");
+        activateComponent(new ReturnFaultComponent(), "target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.fail(me, new Exception("I do not like faults"));
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithTargetError() throws Exception {
+        activateComponent(new ReturnOutComponent(), "transformer");
+        activateComponent(new ReturnErrorComponent(), "target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        listener.assertExchangeCompleted();
+    }
+    
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import javax.jbi.messaging.InOnly;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.tck.Receiver;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class SpringConfigurationTest extends SpringTestSupport {
+
+    public void testConfig() throws Exception {
+        ServiceMixClient client = new DefaultServiceMixClient(jbi);
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("http://test", "wireTap"));
+        me.getInMessage().setContent(new StringSource("<test><echo/><world/></test>"));
+        client.sendSync(me);
+        
+        ((Receiver) getBean("trace1")).getMessageList().assertMessagesReceived(1);
+        ((Receiver) getBean("trace2")).getMessageList().assertMessagesReceived(1);
+        ((Receiver) getBean("trace3")).getMessageList().assertMessagesReceived(1);
+        
+        // Wait for all messages to be processed
+        Thread.sleep(50);
+    }
+
+    protected AbstractXmlApplicationContext createBeanFactory() {
+        return new ClassPathXmlApplicationContext("org/apache/servicemix/eip/spring.xml");
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRecipientListTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRecipientListTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRecipientListTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRecipientListTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.RobustInOnly;
+import javax.xml.namespace.QName;
+
+import org.apache.activemq.util.IdGenerator;
+import org.apache.servicemix.eip.patterns.StaticRecipientList;
+import org.apache.servicemix.eip.support.ExchangeTarget;
+import org.apache.servicemix.store.memory.MemoryStore;
+import org.apache.servicemix.tck.ReceiverComponent;
+
+public class StaticRecipientListTest extends AbstractEIPTest {
+
+    protected StaticRecipientList recipientList;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        recipientList = new StaticRecipientList();
+        recipientList.setRecipients(
+                new ExchangeTarget[] {
+                        createServiceExchangeTarget(new QName("recipient1")),
+                        createServiceExchangeTarget(new QName("recipient2")),
+                        createServiceExchangeTarget(new QName("recipient3"))
+                });
+        configureRecipientList();
+        activateComponent(recipientList, "recipientList");
+    }
+
+    protected void configureRecipientList() {
+        recipientList.setStore(new MemoryStore(new IdGenerator()) {
+            public void store(String id, Object exchange) throws IOException {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                new ObjectOutputStream(baos).writeObject(exchange);
+                super.store(id, exchange);
+            }
+        });
+    }
+    
+    public void testInOut() throws Exception {
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("recipientList"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+    }
+    
+    public void testInOptionalOut() throws Exception {
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("recipientList"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+    }
+    
+    public void testInOnly() throws Exception {
+        ReceiverComponent r1 = activateReceiver("recipient1");
+        ReceiverComponent r2 = activateReceiver("recipient2");
+        ReceiverComponent r3 = activateReceiver("recipient3");
+        
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("recipientList"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        r1.getMessageList().assertMessagesReceived(1);
+        r2.getMessageList().assertMessagesReceived(1);
+        r3.getMessageList().assertMessagesReceived(1);
+    }
+    
+    public void testRobustInOnly() throws Exception {
+        ReceiverComponent r1 = activateReceiver("recipient1");
+        ReceiverComponent r2 = activateReceiver("recipient2");
+        ReceiverComponent r3 = activateReceiver("recipient3");
+        
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("recipientList"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        r1.getMessageList().assertMessagesReceived(1);
+        r2.getMessageList().assertMessagesReceived(1);
+        r3.getMessageList().assertMessagesReceived(1);
+    }
+    
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.RobustInOnly;
+import javax.xml.namespace.QName;
+
+import org.apache.activemq.util.IdGenerator;
+import org.apache.servicemix.eip.patterns.StaticRoutingSlip;
+import org.apache.servicemix.eip.support.ExchangeTarget;
+import org.apache.servicemix.store.memory.MemoryStore;
+
+
+public class StaticRoutingSlipTest extends AbstractEIPTest {
+
+    protected StaticRoutingSlip routingSlip;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        routingSlip = new StaticRoutingSlip();
+        routingSlip.setTargets(
+                new ExchangeTarget[] {
+                        createServiceExchangeTarget(new QName("target1")),
+                        createServiceExchangeTarget(new QName("target2")),
+                        createServiceExchangeTarget(new QName("target3"))
+                });
+        configureRoutingSlip();
+        activateComponent(routingSlip, "routingSlip");
+    }
+
+    protected void configureRoutingSlip() {
+        routingSlip.setStore(new MemoryStore(new IdGenerator()) {
+            public void store(String id, Object exchange) throws IOException {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                new ObjectOutputStream(baos).writeObject(exchange);
+                super.store(id, exchange);
+            }
+        });
+    }
+    
+    public void testInOnly() throws Exception {
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        assertNotNull(me.getError());
+        assertEquals("Use an InOut MEP", me.getError().getMessage());
+    }
+
+    public void testRobustInOnly() throws Exception {
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        assertNotNull(me.getError());
+        assertEquals("Use an InOut MEP", me.getError().getMessage());
+    }
+
+    public void testInOptionalOut() throws Exception {
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        assertNotNull(me.getError());
+        assertEquals("Use an InOut MEP", me.getError().getMessage());
+    }
+
+    public void testDone() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target1");
+        activateComponent(new ReturnOutComponent(), "target2");
+        activateComponent(new ReturnOutComponent(), "target3");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getOutMessage());
+        client.done(me);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testFaultOnFirst() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "target1");
+        activateComponent(new ReturnOutComponent(), "target2");
+        activateComponent(new ReturnOutComponent(), "target3");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testErrorOnFirst() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "target1");
+        activateComponent(new ReturnOutComponent(), "target2");
+        activateComponent(new ReturnOutComponent(), "target3");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testFaultOnSecond() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target1");
+        activateComponent(new ReturnFaultComponent(), "target2");
+        activateComponent(new ReturnOutComponent(), "target3");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testErrorOnSecond() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target1");
+        activateComponent(new ReturnErrorComponent(), "target2");
+        activateComponent(new ReturnOutComponent(), "target3");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testFaultOnThird() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target1");
+        activateComponent(new ReturnOutComponent(), "target2");
+        activateComponent(new ReturnFaultComponent(), "target3");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testErrorOnThird() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target1");
+        activateComponent(new ReturnOutComponent(), "target2");
+        activateComponent(new ReturnErrorComponent(), "target3");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("routingSlip"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        listener.assertExchangeCompleted();
+    }
+    
+
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/VMEIPTests.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/VMEIPTests.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/VMEIPTests.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/VMEIPTests.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,21 @@
+package org.apache.servicemix.eip;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class VMEIPTests {
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Test for org.apache.servicemix.eip");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(XPathSplitterTest.class);
+        suite.addTestSuite(PipelineTest.class);
+        suite.addTestSuite(StaticRoutingSlipTest.class);
+        suite.addTestSuite(ContentBasedRouterTest.class);
+        suite.addTestSuite(WireTapTest.class);
+        suite.addTestSuite(StaticRecipientListTest.class);
+        //$JUnit-END$
+        return suite;
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapJmsFlowTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapJmsFlowTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapJmsFlowTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapJmsFlowTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.util.IdGenerator;
+import org.apache.servicemix.store.memory.MemoryStore;
+
+
+public class WireTapJmsFlowTest extends WireTapTest {
+
+    protected BrokerService broker;
+    
+    protected void setUp() throws Exception {
+        broker = new BrokerService();
+        broker.setPersistent(false);
+        broker.addConnector("tcp://localhost:61616");
+        broker.start();
+        
+        super.setUp();
+    }
+    
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        broker.stop();
+    }
+    
+    protected void configureWireTap() throws Exception {
+        wireTap.setStore(new MemoryStore(new IdGenerator()) {
+            public void store(String id, Object exchange) throws IOException {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                new ObjectOutputStream(baos).writeObject(exchange);
+                super.store(id, exchange);
+            }
+        });
+    }
+    
+    protected void configureContainer() throws Exception {
+        jbi.setFlowName("jms?jmsURL=tcp://localhost:61616");
+    }
+    
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/WireTapTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,406 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.Fault;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.RobustInOnly;
+import javax.xml.namespace.QName;
+
+import org.apache.activemq.util.IdGenerator;
+import org.apache.servicemix.eip.patterns.WireTap;
+import org.apache.servicemix.store.memory.MemoryStore;
+import org.apache.servicemix.tck.ReceiverComponent;
+
+public class WireTapTest extends AbstractEIPTest {
+
+    protected ReceiverComponent inReceiver;
+    protected ReceiverComponent outReceiver;
+    protected ReceiverComponent faultReceiver;
+    protected WireTap wireTap;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        inReceiver = activateReceiver("in");
+        outReceiver = activateReceiver("out");
+        faultReceiver = activateReceiver("fault");
+        wireTap = new WireTap();
+        wireTap.setInListener(createServiceExchangeTarget(new QName("in")));
+        wireTap.setOutListener(createServiceExchangeTarget(new QName("out")));
+        wireTap.setFaultListener(createServiceExchangeTarget(new QName("fault")));
+        wireTap.setTarget(createServiceExchangeTarget(new QName("target")));
+        configureWireTap();
+        activateComponent(wireTap, "wireTap");
+    }
+    
+    protected void configureWireTap() throws Exception {
+        wireTap.setStore(new MemoryStore(new IdGenerator()) {
+            public void store(String id, Object exchange) throws IOException {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                new ObjectOutputStream(baos).writeObject(exchange);
+                super.store(id, exchange);
+            }
+        });
+    }
+    
+    public void testInOnly() throws Exception {
+        ReceiverComponent target = activateReceiver("target");
+
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        target.getMessageList().assertMessagesReceived(1);
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOnlyWithError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "target");
+
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnly() throws Exception {
+        ReceiverComponent target = activateReceiver("target");
+
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        target.getMessageList().assertMessagesReceived(1);
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "target");
+        
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithFault() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "target");
+        
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testRobustInOnlyWithFaultAndError() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "target");
+        
+        RobustInOnly me = client.createRobustInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.fail(me, new Exception("I do not like faults"));
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOut() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getOutMessage());
+        client.done(me);
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(1);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOutWithError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "target");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOutWithFault() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "target");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOutAnswerAndError() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getOutMessage());
+        client.fail(me, new Exception("I do not like your answer"));
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(1);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOutFaultAndError() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "target");
+
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.fail(me, new Exception("I do not like your fault"));
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutNoAnswer() throws Exception {
+        activateComponent(new ReceiverComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutWithAnswer() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getOutMessage());
+        client.done(me);
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(1);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutWithFault() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.done(me);
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutWithError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutWithFaultAndError() throws Exception {
+        activateComponent(new ReturnFaultComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getFault());
+        client.fail(me, new Exception("I do not like faults"));
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(0);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutWithAnswerAndFault() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getOutMessage());
+        Fault fault = me.createFault();
+        fault.setContent(createSource("<fault/>"));
+        me.setFault(fault);
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(1);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutWithAnswerAndError() throws Exception {
+        activateComponent(new ReturnOutComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getOutMessage());
+        client.fail(me, new Exception("Dummy error"));
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(1);
+        faultReceiver.getMessageList().assertMessagesReceived(0);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOptionalOutWithAnswerAndFaultAndError() throws Exception {
+        activateComponent(new ReturnOutAndErrorComponent(), "target");
+
+        InOptionalOut me = client.createInOptionalOutExchange();
+        me.setService(new QName("wireTap"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
+        assertNotNull(me.getOutMessage());
+        Fault fault = me.createFault();
+        fault.setContent(createSource("<fault/>"));
+        me.setFault(fault);
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        inReceiver.getMessageList().assertMessagesReceived(1);
+        outReceiver.getMessageList().assertMessagesReceived(1);
+        faultReceiver.getMessageList().assertMessagesReceived(1);
+        
+        listener.assertExchangeCompleted();
+    }
+    
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/XPathSplitterTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/XPathSplitterTest.java?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/XPathSplitterTest.java (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/XPathSplitterTest.java Fri Apr 14 16:38:22 2006
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.eip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOut;
+import javax.xml.namespace.QName;
+
+import org.apache.activemq.util.IdGenerator;
+import org.apache.servicemix.eip.patterns.XPathSplitter;
+import org.apache.servicemix.store.memory.MemoryStore;
+import org.apache.servicemix.tck.ReceiverComponent;
+
+public class XPathSplitterTest extends AbstractEIPTest {
+
+    private XPathSplitter splitter;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        splitter = new XPathSplitter();
+        splitter.setTarget(createServiceExchangeTarget(new QName("target")));
+        splitter.setXPath("/hello/*");
+        configureSplitter();
+        activateComponent(splitter, "splitter");
+    }
+    
+    protected void configureSplitter() throws Exception {
+        splitter.setStore(new MemoryStore(new IdGenerator()) {
+            public void store(String id, Object exchange) throws IOException {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                new ObjectOutputStream(baos).writeObject(exchange);
+                super.store(id, exchange);
+            }
+        });
+    }
+    
+    public void testInOnly() throws Exception {
+        ReceiverComponent rec = activateReceiver("target");
+        
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("splitter"));
+        me.getInMessage().setContent(createSource("<hello><one/><two/><three/></hello>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        
+        rec.getMessageList().assertMessagesReceived(3); 
+    }
+
+    public void testInOut() throws Exception {
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("splitter"));
+        me.getInMessage().setContent(createSource("<hello><one/><two/><three/></hello>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j-tests.properties
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j-tests.properties?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j-tests.properties (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j-tests.properties Fri Apr 14 16:38:22 2006
@@ -0,0 +1,21 @@
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=DEBUG, out
+
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.apache.activemq.store.journal=INFO
+log4j.logger.org.activeio.journal=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true

Added: incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j.properties?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j.properties (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/resources/log4j.properties Fri Apr 14 16:38:22 2006
@@ -0,0 +1,21 @@
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=DEBUG, stdout
+
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.apache.activemq.store.journal=INFO
+log4j.logger.org.activeio.journal=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true

Added: incubator/servicemix/trunk/servicemix-eip/src/test/resources/org/apache/servicemix/eip/spring.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-eip/src/test/resources/org/apache/servicemix/eip/spring.xml?rev=394227&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/resources/org/apache/servicemix/eip/spring.xml (added)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/resources/org/apache/servicemix/eip/spring.xml Fri Apr 14 16:38:22 2006
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
+  xmlns:eip="http://servicemix.apache.org/eip/1.0" xmlns:test="http://test">
+
+  <!-- the JBI container -->
+  <sm:container id="jbi" embedded="true">
+    <sm:activationSpecs>
+
+      <!-- output using a POJO -->
+      <sm:activationSpec>
+        <sm:component>
+          <eip:component>
+            <eip:endpoints>
+
+              <eip:wire-tap service="test:wireTap" endpoint="myConsumer">
+                <eip:target>
+                  <eip:exchange-target service="test:xpathSplitter" />
+                </eip:target>
+                <eip:inListener>
+                  <eip:exchange-target service="test:trace1" />
+                </eip:inListener>
+              </eip:wire-tap>
+
+              <eip:xpath-splitter service="test:xpathSplitter" endpoint="myConsumer" xpath="/*/*">
+                <eip:target>
+                  <eip:exchange-target service="test:router" />
+                </eip:target>
+              </eip:xpath-splitter>
+
+              <eip:content-based-router service="test:router" endpoint="myConsumer">
+                <eip:rules>
+                  <eip:routing-rule>
+                    <eip:predicate>
+                      <eip:xpath-predicate xpath="count(/echo) = 1" />
+                    </eip:predicate>
+                    <eip:target>
+                      <eip:exchange-target service="test:trace2" />
+                    </eip:target>
+                  </eip:routing-rule>
+                  <eip:routing-rule>
+                    <eip:target>
+                      <eip:exchange-target service="test:trace3" />
+                    </eip:target>
+                  </eip:routing-rule>
+                </eip:rules>
+              </eip:content-based-router>
+
+            </eip:endpoints>
+          </eip:component>
+        </sm:component>
+      </sm:activationSpec>
+
+      <sm:activationSpec id="trace1" service="test:trace1">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+      <sm:activationSpec id="trace2" service="test:trace2">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+      <sm:activationSpec id="trace3" service="test:trace3">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+
+    </sm:activationSpecs>
+  </sm:container>
+
+</beans>



Mime
View raw message