servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r489137 - in /incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip: MessageFilterTxTest.java PipelineTxTest.java SpringConfigurationTest.java StaticRoutingSlipTxTest.java
Date Wed, 20 Dec 2006 16:44:08 GMT
Author: gnodet
Date: Wed Dec 20 08:44:07 2006
New Revision: 489137

URL: http://svn.apache.org/viewvc?view=rev&rev=489137
Log:
Unit tests

Modified:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/MessageFilterTxTest.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTxTest.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTxTest.java

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/MessageFilterTxTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/MessageFilterTxTest.java?view=diff&rev=489137&r1=489136&r2=489137
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/MessageFilterTxTest.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/MessageFilterTxTest.java
Wed Dec 20 08:44:07 2006
@@ -18,7 +18,6 @@
 
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOnly;
-import javax.jbi.messaging.InOut;
 import javax.xml.namespace.QName;
 
 import org.apache.servicemix.eip.patterns.MessageFilter;

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTxTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTxTest.java?view=diff&rev=489137&r1=489136&r2=489137
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTxTest.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/PipelineTxTest.java
Wed Dec 20 08:44:07 2006
@@ -77,4 +77,40 @@
         listener.assertExchangeCompleted();
     }
     
+    public void testInOnlySyncWithError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        tm.begin();
+        
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        tm.commit();
+        
+        listener.assertExchangeCompleted();
+    }
+    
+    public void testInOnlyAsyncWithError() throws Exception {
+        activateComponent(new ReturnErrorComponent(), "transformer");
+        ReceiverComponent target = activateReceiver("target");
+
+        tm.begin();
+        
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("pipeline"));
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.send(me);
+        
+        tm.commit();
+        
+        me = (InOnly) client.receive();
+        assertEquals(ExchangeStatus.ERROR, me.getStatus());
+        
+        listener.assertExchangeCompleted();
+    }
+    
 }

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java?view=diff&rev=489137&r1=489136&r2=489137
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/SpringConfigurationTest.java
Wed Dec 20 08:44:07 2006
@@ -34,16 +34,44 @@
         ActivationSpec as = new ActivationSpec();
         as.setComponentName("client");
         ServiceMixClient client = new DefaultServiceMixClient(jbi, as);
-        InOnly me = client.createInOnlyExchange();
-        me.setService(new QName("http://test", "entryPoint"));
-        me.getInMessage().setContent(new StringSource("<test xmlns=\"http://test\"><echo/><world/><earth/></test>"));
-        client.sendSync(me);
         
-        ((Receiver) getBean("trace1")).getMessageList().assertMessagesReceived(1);
-        ((Receiver) getBean("trace2")).getMessageList().assertMessagesReceived(1);
-        ((Receiver) getBean("trace3")).getMessageList().assertMessagesReceived(1);
-        ((Receiver) getBean("trace4")).getMessageList().assertMessagesReceived(2);
-        ((Receiver) getBean("trace5")).getMessageList().assertMessagesReceived(1);
+        int nbMsgs = 10;
+        for (int i = 0; i < nbMsgs; i++) {
+            InOnly me = client.createInOnlyExchange();
+            me.setService(new QName("http://test", "entryPoint"));
+            me.getInMessage().setContent(new StringSource("<test xmlns=\"http://test\"><echo/><world/><earth/></test>"));
+            client.sendSync(me);
+        }        
+        ((Receiver) getBean("trace1")).getMessageList().assertMessagesReceived(1 * nbMsgs);
+        ((Receiver) getBean("trace2")).getMessageList().assertMessagesReceived(1 * nbMsgs);
+        ((Receiver) getBean("trace3")).getMessageList().assertMessagesReceived(1 * nbMsgs);
+        ((Receiver) getBean("trace4")).getMessageList().assertMessagesReceived(2 * nbMsgs);
+        ((Receiver) getBean("trace5")).getMessageList().assertMessagesReceived(1 * nbMsgs);
+        
+        // Wait for all messages to be processed
+        Thread.sleep(50);
+    }
+
+    public void testConfigAsync() throws Exception {
+        ActivationSpec as = new ActivationSpec();
+        as.setComponentName("client");
+        ServiceMixClient client = new DefaultServiceMixClient(jbi, as);
+        
+        int nbMsgs = 100;
+        for (int i = 0; i < nbMsgs; i++) {
+            InOnly me = client.createInOnlyExchange();
+            me.setService(new QName("http://test", "entryPoint"));
+            me.getInMessage().setContent(new StringSource("<test xmlns=\"http://test\"><echo/><world/><earth/></test>"));
+            client.send(me);
+        }
+        for (int i = 0; i < nbMsgs; i++) {
+            client.receive();
+        }
+        ((Receiver) getBean("trace1")).getMessageList().assertMessagesReceived(1 * nbMsgs);
+        ((Receiver) getBean("trace2")).getMessageList().assertMessagesReceived(1 * nbMsgs);
+        ((Receiver) getBean("trace3")).getMessageList().assertMessagesReceived(1 * nbMsgs);
+        ((Receiver) getBean("trace4")).getMessageList().assertMessagesReceived(2 * nbMsgs);
+        ((Receiver) getBean("trace5")).getMessageList().assertMessagesReceived(1 * nbMsgs);
         
         // Wait for all messages to be processed
         Thread.sleep(50);

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTxTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTxTest.java?view=diff&rev=489137&r1=489136&r2=489137
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTxTest.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/test/java/org/apache/servicemix/eip/StaticRoutingSlipTxTest.java
Wed Dec 20 08:44:07 2006
@@ -17,16 +17,12 @@
 package org.apache.servicemix.eip;
 
 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.transaction.Status;
 import javax.xml.namespace.QName;
 
 import org.apache.servicemix.eip.patterns.StaticRoutingSlip;
 import org.apache.servicemix.eip.support.ExchangeTarget;
-
 
 public class StaticRoutingSlipTxTest extends AbstractEIPTransactionalTest {
 



Mime
View raw message