camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r725569 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/test/java/org/apache/camel/processor/ components/camel-cometd/src/main/java/org/apache/camel/component/cometd/ components/camel-spring/src/t...
Date Thu, 11 Dec 2008 04:10:09 GMT
Author: ningjiang
Date: Wed Dec 10 20:10:08 2008
New Revision: 725569

URL: http://svn.apache.org/viewvc?rev=725569&view=rev
Log:
CAMEL-1181 added the DSL support and tests

Added:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
  (contents, props changed)
      - copied, changed from r725493, activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ExchangePatternTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
  (contents, props changed)
      - copied, changed from r725536, activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringExchangePatternTest.java
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
  (contents, props changed)
      - copied, changed from r725536, activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/exchangePattern.xml
Removed:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ExchangePatternTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringExchangePatternTest.java
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/exchangePattern.xml
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
    activemq/camel/trunk/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?rev=725569&r1=725568&r2=725569&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
Wed Dec 10 20:10:08 2008
@@ -122,7 +122,8 @@
     public Type to(String uri) {
         addOutput(new ToType(uri));
         return (Type) this;
-    }
+    }   
+    
 
     /**
      * Sends the exchange to the given endpoint
@@ -134,6 +135,31 @@
         addOutput(new ToType(endpoint));
         return (Type) this;
     }
+    
+    /**
+     * Sends the exchange with certain exchange pattern to the given endpoint
+     *
+     * @param uri  the endpoint to send to
+     * @return the builder
+     */
+    public Type to(String uri, ExchangePattern ep) {
+        addOutput(new SetExchangePatternType(ep));
+        addOutput(new ToType(uri));        
+        return (Type) this;
+    }   
+    
+
+    /**
+     * Sends the exchange with certain exchange pattern to the given endpoint
+     *
+     * @param endpoint  the endpoint to send to
+     * @return the builder
+     */
+    public Type to(Endpoint endpoint, ExchangePattern ep) {
+        addOutput(new SetExchangePatternType(ep));
+        addOutput(new ToType(endpoint));
+        return (Type) this;
+    }
 
     /**
      * Sends the exchange to a list of endpoints
@@ -173,6 +199,8 @@
         }
         return (Type) this;
     }
+    
+    
 
     /**
      * <a href="http://activemq.apache.org/camel/multicast.html">Multicast EIP:</a>
@@ -1688,6 +1716,50 @@
     public Type inOut() {
         return setExchangePattern(ExchangePattern.InOut);
     }
+    
+    /**
+     * <a href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
+     * set the exchange's ExchangePattern {@link ExchangePattern} to be InOnly
+     *
+     * @param uri The endpoint uri which is used for sending the exchange
+     * @return the builder
+     */
+    public Type inOnly(String uri) {
+        return to(uri, ExchangePattern.InOnly);
+    }
+    
+    /**
+     * <a href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
+     * set the exchange's ExchangePattern {@link ExchangePattern} to be InOut
+     *
+     * @param uri The endpoint uri which is used for sending the exchange
+     * @return the builder
+     */
+    public Type inOut(String uri) {
+        return to(uri, ExchangePattern.InOut);
+    }
+    
+    /**
+     * <a href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
+     * set the exchange's ExchangePattern {@link ExchangePattern} to be InOnly
+     *
+     * @param uri The endpoint which is used for sending the exchange
+     * @return the builder
+     */
+    public Type inOnly(Endpoint endpoint) {
+        return to(endpoint, ExchangePattern.InOnly);
+    }
+    
+    /**
+     * <a href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
+     * set the exchange's ExchangePattern {@link ExchangePattern} to be InOut
+     *
+     * @param uri The endpoint which is used for sending the exchange
+     * @return the builder
+     */
+    public Type inOut(Endpoint endpoint) {
+        return to(endpoint, ExchangePattern.InOut);
+    }
 
     // Properties
     // -------------------------------------------------------------------------

Copied: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
(from r725493, activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ExchangePatternTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java?p2=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java&p1=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ExchangePatternTest.java&r1=725493&r2=725569&rev=725569&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ExchangePatternTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
Wed Dec 10 20:10:08 2008
@@ -23,7 +23,7 @@
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 
-public class ExchangePatternTest extends ContextTestSupport {
+public class SetExchangePatternTest extends ContextTestSupport {
     
     private void sendMessage(String uri, final ExchangePattern ep, final String message)
{
         template.send(uri, new Processor() {
@@ -35,7 +35,7 @@
         });
     }
    
-    public void testInOut() throws Exception {
+    public void testSetInOut() throws Exception {
         MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
         resultEndpoint.expectedBodiesReceived("InOnlyMessage");        
         sendMessage("direct:inOnly", ExchangePattern.InOnly, "InOnlyMessage");
@@ -43,7 +43,7 @@
         assertEquals("The exchange pattern should be InOut", resultEndpoint.getExchanges().get(0).getPattern(),
ExchangePattern.InOut);
     }
     
-    public void testInOnly() throws Exception {
+    public void testSetInOnly() throws Exception {
         MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
         resultEndpoint.expectedBodiesReceived("InOutMessage");        
         sendMessage("direct:inOut", ExchangePattern.InOut, "InOutMessage");
@@ -51,6 +51,22 @@
         assertEquals("The exchange pattern should be InOnly", resultEndpoint.getExchanges().get(0).getPattern(),
ExchangePattern.InOnly);
     }
     
+    public void testSetRobustInOnly() throws Exception {
+        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+        resultEndpoint.expectedBodiesReceived("InOutMessage");        
+        sendMessage("direct:inOut1", ExchangePattern.InOut, "InOutMessage");
+        resultEndpoint.assertIsSatisfied();
+        assertEquals("The exchange pattern should be InOnly", resultEndpoint.getExchanges().get(0).getPattern(),
ExchangePattern.RobustInOnly);
+    }
+    
+    public void testSetInOnly2() throws Exception {
+        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+        resultEndpoint.expectedBodiesReceived("InOutMessage");        
+        sendMessage("direct:inOut2", ExchangePattern.InOut, "InOutMessage");
+        resultEndpoint.assertIsSatisfied();
+        assertEquals("The exchange pattern should be InOnly", resultEndpoint.getExchanges().get(0).getPattern(),
ExchangePattern.InOnly);
+    }
+    
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
@@ -59,6 +75,10 @@
                
                 from("direct:inOut").setExchangePattern(ExchangePattern.InOnly).to("mock:result");
                 
+                from("direct:inOut1").to("mock:result", ExchangePattern.RobustInOnly);
+                
+                from("direct:inOut2").inOnly("mock:result");
+                
             }
         };
     }

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: activemq/camel/trunk/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java?rev=725569&r1=725568&r2=725569&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
(original)
+++ activemq/camel/trunk/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
Wed Dec 10 20:10:08 2008
@@ -105,8 +105,8 @@
                 connector.setPort(endpoint.getPort());
                 connector.setHost(endpoint.getUri().getHost());
                 if ("localhost".equalsIgnoreCase(endpoint.getUri().getHost())) {
-                    LOG.warn("You use localhost interface! It means that no external connections
will be available." + 
-                            " Don't you want to use 0.0.0.0 instead (all network interfaces)?");
+                    LOG.warn("You use localhost interface! It means that no external connections
will be available."
+                             + " Don't you want to use 0.0.0.0 instead (all network interfaces)?");
                 }
                 getServer().addConnector(connector);
 

Copied: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
(from r725536, activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringExchangePatternTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java?p2=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java&p1=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringExchangePatternTest.java&r1=725536&r2=725569&rev=725569&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringExchangePatternTest.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
Wed Dec 10 20:10:08 2008
@@ -19,14 +19,14 @@
 
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.processor.ExchangePatternTest;
+import org.apache.camel.processor.SetExchangePatternTest;
 import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
 
-public class SpringExchangePatternTest extends ExchangePatternTest {
+public class SpringSetExchangePatternTest extends SetExchangePatternTest {
     
     protected CamelContext createCamelContext() throws Exception {
-        return createSpringCamelContext(this, "org/apache/camel/spring/processor/exchangePattern.xml");
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/setExchangePattern.xml");
     }
 
 }

Propchange: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
(from r725536, activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/exchangePattern.xml)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml?p2=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml&p1=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/exchangePattern.xml&r1=725536&r2=725569&rev=725569&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/exchangePattern.xml
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
Wed Dec 10 20:10:08 2008
@@ -32,6 +32,17 @@
 
     <route>
       <from uri="direct:inOut"/>
+      <setExchangePattern pattern="InOnly"/>
+      <to uri="mock:result"/> 
+    </route>
+    
+    <route>
+      <from uri="direct:inOut1"/>
+      <to uri="mock:result" pattern="RobustInOnly"/>
+    </route>
+    
+    <route>
+      <from uri="direct:inOut2"/>
       <inOnly uri="mock:result"/>
     </route>
    </camelContext>

Propchange: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message