Author: jstrachan
Date: Thu Dec 11 03:07:48 2008
New Revision: 725660

URL: http://svn.apache.org/viewvc?rev=725660&view=rev
Log:
added a few more tests and examples to CAMEL-1171 and reformatted the test a 
little to act as slightly more clear snippets on the different permutations 
available

Modified:
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
    
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java?rev=725660&r1=725659&r2=725660&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
 Thu Dec 11 03:07:48 2008
@@ -23,32 +23,36 @@
 
 public class SetExchangePatternTest extends ContextTestSupport {
 
-    public void testInvokeWithInOut() throws Exception {
-        assertMessageReceivedWithPattern("direct:invokeWithInOut", 
ExchangePattern.InOut);
+    public void testInOut() throws Exception {
+        assertMessageReceivedWithPattern("direct:testInOut", 
ExchangePattern.InOut);
     }
 
-    public void testInvokeWithInOnly() throws Exception {
-        assertMessageReceivedWithPattern("direct:invokeWithInOnly", 
ExchangePattern.InOnly);
+    public void testInOnly() throws Exception {
+        assertMessageReceivedWithPattern("direct:testInOnly", 
ExchangePattern.InOnly);
     }
 
-    public void testSetInOut() throws Exception {
-        assertMessageReceivedWithPattern("direct:inOnly", 
ExchangePattern.InOut);
+    public void testSetToInOnlyThenTo() throws Exception {
+        assertMessageReceivedWithPattern("direct:testSetToInOnlyThenTo", 
ExchangePattern.InOnly);
     }
 
-    public void testSetInOutAsToParam() throws Exception {
-        assertMessageReceivedWithPattern("direct:inOnlyAsToParam", 
ExchangePattern.InOnly);
+    public void testSetToInOutThenTo() throws Exception {
+        assertMessageReceivedWithPattern("direct:testSetToInOutThenTo", 
ExchangePattern.InOut);
     }
 
-    public void testSetInOnly() throws Exception {
-        assertMessageReceivedWithPattern("direct:inOut", 
ExchangePattern.InOnly);
+    public void testToWithInOnlyParam() throws Exception {
+        assertMessageReceivedWithPattern("direct:testToWithInOnlyParam", 
ExchangePattern.InOnly);
     }
-    
-    public void testSetRobustInOnly() throws Exception {
-        assertMessageReceivedWithPattern("direct:inOut1", 
ExchangePattern.RobustInOnly);
+
+    public void testToWithInOutParam() throws Exception {
+        assertMessageReceivedWithPattern("direct:testToWithInOutParam", 
ExchangePattern.InOut);
+    }
+
+    public void testToWithRobustInOnlyParam() throws Exception {
+        assertMessageReceivedWithPattern("direct:testToWithRobustInOnlyParam", 
ExchangePattern.RobustInOnly);
     }
-    
-    public void testSetInOnly2() throws Exception {
-        assertMessageReceivedWithPattern("direct:inOut2", 
ExchangePattern.InOnly);
+
+    public void testSetExchangePatternInOnly() throws Exception {
+        
assertMessageReceivedWithPattern("direct:testSetExchangePatternInOnly", 
ExchangePattern.InOnly);
     }
 
 
@@ -81,20 +85,23 @@
             public void configure() {
              // START SNIPPET: example
                 // Send to an endpoint using InOut
-                from("direct:invokeWithInOut").inOut("mock:result");
+                from("direct:testInOut").inOut("mock:result");
+
                 // Send to an endpoint using InOut
-                from("direct:invokeWithInOnly").inOnly("mock:result");
+                from("direct:testInOnly").inOnly("mock:result");
+
                 // Set the exchange pattern to InOut, then send it from 
direct:inOnly to mock:result endpoint
-                from("direct:inOnly").inOut().to("mock:result");
-                // Or we can pass the pattern as a parameter
-                from("direct:inOnlyAsToParam").to(ExchangePattern.InOnly, 
"mock:result");
-                // Set the exchange pattern to InOut, then send it from 
direct:inOut to mock:result endpoint
-                
from("direct:inOut").setExchangePattern(ExchangePattern.InOnly).to("mock:result");
-                // Send the exchange from direct:inOut1 to mock:result with 
setting the exchange pattern to be RobustInOnly
-                from("direct:inOut1").to(ExchangePattern.RobustInOnly, 
"mock:result");
-                // Send the exchange from direct:inOut2 to mock:result with 
setting the exchange pattern to be InOnly
-                from("direct:inOut2").inOnly("mock:result");
-             // END SNIPPET: example   
+                
from("direct:testSetToInOnlyThenTo").inOnly().to("mock:result");
+                from("direct:testSetToInOutThenTo").inOut().to("mock:result");
+
+                // Or we can pass the pattern as a parameter to the to() method
+                
from("direct:testToWithInOnlyParam").to(ExchangePattern.InOnly, "mock:result");
+                from("direct:testToWithInOutParam").to(ExchangePattern.InOut, 
"mock:result");
+                
from("direct:testToWithRobustInOnlyParam").to(ExchangePattern.RobustInOnly, 
"mock:result");
+
+                // Set the exchange pattern to InOut, then send it on
+                
from("direct:testSetExchangePatternInOnly").setExchangePattern(ExchangePattern.InOnly).to("mock:result");
+             // END SNIPPET: example
             }
         };
     }

Modified: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml?rev=725660&r1=725659&r2=725660&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
 Thu Dec 11 03:07:48 2008
@@ -23,31 +23,50 @@
     ">
 
   <!-- START SNIPPET: example -->
-  <camelContext id="camel" 
xmlns="http://activemq.apache.org/camel/schema/spring";>
-    <!-- Set the exchange pattern to InOut, then send it from direct:inOnly to 
mock:result endpoint -->
+  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>
+    <!-- Send the exchange as InOnly -->
     <route>
-      <from uri="direct:inOnly"/>
-      <setExchangePattern pattern="InOut"/>            
-      <to uri="mock:result"/>      
+      <from uri="direct:testInOut"/>
+      <inOut uri="mock:result"/>
+    </route>
+
+    <!-- Send the exchange as InOnly -->
+    <route>
+      <from uri="direct:testInOnly"/>
+      <inOnly uri="mock:result"/>
     </route>
 
-    <!-- Set the exchange pattern to InOnly, then send it from direct:inOut to 
mock:result endpoint -->
+
+    <!-- lets set the exchange pattern then send it on -->
     <route>
-      <from uri="direct:inOut"/>
+      <from uri="direct:testSetToInOnlyThenTo"/>
       <setExchangePattern pattern="InOnly"/>
-      <to uri="mock:result"/> 
+      <to uri="mock:result"/>      
     </route>
-    
-    <!-- Send the exchange from direct:inOut1 to mock:result with setting the 
exchange pattern to be RobustInOnly-->
     <route>
-      <from uri="direct:inOut1"/>
-      <to uri="mock:result" pattern="RobustInOnly"/>
+      <from uri="direct:testSetToInOutThenTo"/>
+      <setExchangePattern pattern="InOut"/>
+      <to uri="mock:result"/>
     </route>
-    
-    <!-- Send the exchange from direct:inOut2 to mock:result with setting the 
exchange pattern to be InOnly -->
     <route>
-      <from uri="direct:inOut2"/>
-      <inOnly uri="mock:result"/>
+      <from uri="direct:testSetExchangePatternInOnly"/>
+      <setExchangePattern pattern="InOnly"/>
+      <to uri="mock:result"/>
+    </route>
+
+
+    <!-- Lets pass the pattern as an argument in the to element -->
+    <route>
+      <from uri="direct:testToWithInOnlyParam"/>
+      <to uri="mock:result" pattern="InOnly"/>
+    </route>
+    <route>
+      <from uri="direct:testToWithInOutParam"/>
+      <to uri="mock:result" pattern="InOut"/>
+    </route>
+    <route>
+      <from uri="direct:testToWithRobustInOnlyParam"/>
+      <to uri="mock:result" pattern="RobustInOnly"/>
     </route>
    </camelContext>
    <!-- END SNIPPET: example -->


Reply via email to