camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r771248 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/main/java/org/apache/camel/util/ camel-core/s...
Date Mon, 04 May 2009 08:59:40 GMT
Author: davsclaus
Date: Mon May  4 08:59:40 2009
New Revision: 771248

URL: http://svn.apache.org/viewvc?rev=771248&view=rev
Log:
CAMEL-1585: Added support for endpoint uri matching for interceptFrom

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriRegexTest.java
  (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriWildcardTest.java
      - copied, changed from r771227, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriSimpleLogTest.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.java
  (with props)
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.java
      - copied, changed from r771227, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.xml
  (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.xml
      - copied, changed from r771227, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.xml
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java Mon May
 4 08:59:40 2009
@@ -145,8 +145,7 @@
     }
 
     /**
-     * Adds a route for an interceptor; use the {@link org.apache.camel.model.ProcessorDefinition#proceed()}
method
-     * to continue processing the underlying route being intercepted.
+     * Adds a route for an interceptor that intercepts every processing step.
      *
      * @return the builder
      */
@@ -156,8 +155,7 @@
     }
 
     /**
-     * Adds a route for an interceptor; use the {@link org.apache.camel.model.ProcessorDefinition#proceed()}
method
-     * to continue processing the underlying route being intercepted.
+     * Adds a route for an interceptor that intercepts incoming messages on any inputs in
this route
      *
      * @return the builder
      */
@@ -167,8 +165,7 @@
     }
 
     /**
-     * Adds a route for an interceptor; use the {@link org.apache.camel.model.ProcessorDefinition#proceed()}
method
-     * to continue processing the underlying route being intercepted.
+     * Adds a route for an interceptor that intercepts incoming messages on the given endpoint.
      *
      * @param uri  endpoint uri
      * @return the builder

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
Mon May  4 08:59:40 2009
@@ -34,7 +34,6 @@
 public class InterceptFromDefinition extends InterceptDefinition {
 
     // TODO: Support lookup endpoint by ref (requires a bit more work)
-    // TODO: Support wildcards for endpoints so you can match by scheme, eg jms:*
 
     @XmlAttribute(required = false)
     protected String uri;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
Mon May  4 08:59:40 2009
@@ -96,6 +96,9 @@
     }
 
     public void proxyEndpoint(CamelContext context) {
+        // TODO: Add dyanmic proxy support in that sence it should be some callback hooks
in CamelContext to
+        // you can register to do custom endpoint lookup or add to registry
+
         // proxy the endpoint by using the InterceptSendToEndpoint that will proxy
         // the producer so it processes the detour first
         Endpoint endpoint = lookupEndpoint(context);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java Mon
May  4 08:59:40 2009
@@ -18,7 +18,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElementRef;
@@ -28,6 +27,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.builder.ErrorHandlerBuilder;
+import org.apache.camel.util.EndpointHelper;
 
 /**
  * Represents a collection of routes
@@ -204,7 +204,7 @@
             if (intercept.getUri() != null) {
                 match = false;
                 for (FromDefinition input : route.getInputs()) {
-                    if (input.getUri().equals(intercept.getUri())) {
+                    if (EndpointHelper.matchEndpoint(input.getUri(), intercept.getUri()))
{
                         match = true;
                         break;
                     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java Mon
May  4 08:59:40 2009
@@ -22,7 +22,6 @@
 import org.apache.camel.Channel;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.spi.InterceptStrategy;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java Mon May
 4 08:59:40 2009
@@ -25,11 +25,9 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
-import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.impl.converter.AsyncProcessorTypeConverter;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
-import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java Mon May
 4 08:59:40 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.util;
 
+import java.util.regex.PatternSyntaxException;
+
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.PollingConsumer;
@@ -29,6 +31,7 @@
  * @version $Revision$
  */
 public final class EndpointHelper {
+
     private static final transient Log LOG = LogFactory.getLog(EndpointHelper.class);
 
     private EndpointHelper() {
@@ -70,4 +73,44 @@
     public static void pollEndpoint(Endpoint endpoint, Processor processor) throws Exception
{
         pollEndpoint(endpoint, processor, 1000L);
     }
+
+    /**
+     * Matches the endpoint with the given pattern.
+     * <p/>
+     * The match rules are applied in this order:
+     * <ul>
+     *   <li>excact match, returns true</li>
+     *   <li>wildcard match (pattern ends with a * and the uri starts with the pattern),
returns true</li>
+     *   <li>regular expression match, returns true</li>
+     *   <li>otherwise returns false</li>
+     * </ul>
+     *
+     * @param uri  the endpoint uri
+     * @param pattern a pattern to match
+     * @return <tt>true</tt> if match, <tt>false</tt> otherwise.
+     */
+    public static boolean matchEndpoint(String uri, String pattern) {
+        if (uri.equals(pattern)) {
+            // excact match
+            return true;
+        }
+
+        // we have wildcard support in that hence you can match with: file* to match any
file endpoints
+        if (pattern.endsWith("*") && uri.startsWith(pattern.substring(0, pattern.length()
- 1))) {
+            return true;
+        }
+
+        // match by regular expression
+        try {
+            if (uri.matches(pattern)) {
+                return true;
+            }
+        } catch (PatternSyntaxException e) {
+            // ignore
+        }
+        
+        // no match
+        return false;
+    }
+
 }

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriRegexTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriRegexTest.java?rev=771248&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriRegexTest.java
(added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriRegexTest.java
Mon May  4 08:59:40 2009
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.processor.intercept;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * Testing http://camel.apache.org/dsl.html
+ */
+public class InterceptFromUriRegexTest extends ContextTestSupport {
+
+    public void testNoIntercept() throws Exception {
+        getMockEndpoint("mock:intercept").expectedMessageCount(0);
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testInterceptFoo() throws Exception {
+        getMockEndpoint("mock:intercept").expectedMessageCount(1);
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("seda:foo", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testInterceptBar() throws Exception {
+        getMockEndpoint("mock:intercept").expectedMessageCount(1);
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("seda:bar", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testInterceptCheese() throws Exception {
+        getMockEndpoint("mock:intercept").expectedMessageCount(0);
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("seda:cheese", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // START SNIPPET: e1
+                // only trigger when incoming from either seda:bar or seda:foo as we use
regex
+                interceptFrom("seda:(bar|foo)").to("mock:intercept");
+
+                from("direct:start").to("mock:result");
+
+                from("seda:bar").to("mock:result");
+
+                from("seda:foo").to("mock:result");
+
+                from("seda:cheese").to("mock:result");
+                // END SNIPPET: e1
+            }
+        };
+    }
+
+}
\ No newline at end of file

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

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

Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriWildcardTest.java
(from r771227, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriSimpleLogTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriWildcardTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriWildcardTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriSimpleLogTest.java&r1=771227&r2=771248&rev=771248&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriSimpleLogTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromUriWildcardTest.java
Mon May  4 08:59:40 2009
@@ -22,16 +22,31 @@
 /**
  * Testing http://camel.apache.org/dsl.html
  */
-public class InterceptFromUriSimpleLogTest extends ContextTestSupport {
+public class InterceptFromUriWildcardTest extends ContextTestSupport {
 
-    public void testInterceptLog() throws Exception {
-        getMockEndpoint("mock:first").expectedMessageCount(1);
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-
-        getMockEndpoint("mock:result").expectedMessageCount(2);
+    public void testNoIntercept() throws Exception {
+        getMockEndpoint("mock:intercept").expectedMessageCount(0);
+        getMockEndpoint("mock:result").expectedMessageCount(1);
 
         template.sendBody("direct:start", "Hello World");
-        template.sendBody("seda:foo", "Bye World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testInterceptFoo() throws Exception {
+        getMockEndpoint("mock:intercept").expectedMessageCount(1);
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("seda:foo", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testInterceptBar() throws Exception {
+        getMockEndpoint("mock:intercept").expectedMessageCount(1);
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("seda:bar", "Hello World");
 
         assertMockEndpointsSatisfied();
     }
@@ -40,11 +55,10 @@
         return new RouteBuilder() {
             public void configure() throws Exception {
                 // START SNIPPET: e1
-                // only trigger when incoming from seda:bar endpoint
-                interceptFrom("seda:bar").to("mock:bar");
+                // only trigger when incoming from any seda endpoint as we use the * wildcard
+                interceptFrom("seda*").to("mock:intercept");
 
-                // and here we have a couple of routes
-                from("direct:start").to("mock:first").to("seda:bar");
+                from("direct:start").to("mock:result");
 
                 from("seda:bar").to("mock:result");
 

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=771248&r1=771247&r2=771248&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
(original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
Mon May  4 08:59:40 2009
@@ -57,6 +57,7 @@
 import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.Registry;
+import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -302,7 +303,7 @@
             if (intercept.getUri() != null) {
                 match = false;
                 for (FromDefinition input : route.getInputs()) {
-                    if (input.getUri().equals(intercept.getUri())) {
+                    if (EndpointHelper.matchEndpoint(input.getUri(), intercept.getUri()))
{
                         match = true;
                         break;
                     }
@@ -310,6 +311,7 @@
             }
 
             if (match) {
+                intercept.afterPropertiesSet();
                 // add as first output so intercept is handled before the acutal route and
that gives
                 // us the needed head start to init and be able to intercept all the remaining
processing steps
                 route.getOutputs().add(0, intercept);
@@ -319,13 +321,13 @@
         // configure intercept send to endpoint
         for (InterceptSendToEndpointDefinition intercept : getInterceptSendToEndpoints())
{
             // special intercept for intercepting sending to an endpoint
-            // init interceptor by letting it proxy the real endpoint
 
             // add the interceptor but we must do some pre configuration beforehand
             intercept.afterPropertiesSet();
 
             // replace proceed with the rest of the route
             try {
+                // init interceptor by letting it proxy the real endpoint
                 intercept.proxyEndpoint(getContext());
             } catch (Exception e) {
                 throw ObjectHelper.wrapRuntimeCamelException(e);

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.java?rev=771248&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.java
(added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.java
Mon May  4 08:59:40 2009
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.spring.processor;
+
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.intercept.InterceptFromUriRegexTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringInterceptFromUriRegexTest extends InterceptFromUriRegexTest {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.xml");
+    }
+
+}
\ No newline at end of file

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

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

Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.java
(from r771227, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.java&r1=771227&r2=771248&rev=771248&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.java
Mon May  4 08:59:40 2009
@@ -18,10 +18,10 @@
 
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.processor.intercept.InterceptFromUriSimpleLogTest;
+import org.apache.camel.processor.intercept.InterceptFromUriWildcardTest;
 import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
-public class SpringInterceptFromUriSimpleLogTest extends InterceptFromUriSimpleLogTest {
+public class SpringInterceptFromUriWildcardTest extends InterceptFromUriWildcardTest {
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -29,7 +29,7 @@
     }
 
     protected CamelContext createCamelContext() throws Exception {
-        return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.xml");
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.xml");
     }
 
 }
\ No newline at end of file

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.xml?rev=771248&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.xml
(added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriRegexTest.xml
Mon May  4 08:59:40 2009
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <!-- START SNIPPET: example -->
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <!-- intercept incoming message arriving on either seda:foo or seda:bar endpoints
as we use regex -->
+        <interceptFrom uri="seda:(foo|bar)">
+            <to uri="mock:intercept"/>
+        </interceptFrom>
+
+        <route>
+            <from uri="direct:start"/>
+            <to uri="mock:result"/>
+        </route>
+
+        <route>
+            <from uri="seda:bar"/>
+            <to uri="mock:result"/>
+        </route>
+
+        <route>
+            <from uri="seda:foo"/>
+            <to uri="mock:result"/>
+        </route>
+
+        <route>
+            <from uri="seda:cheese"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
+</beans>

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

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

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

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.xml
(from r771227, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.xml&r1=771227&r2=771248&rev=771248&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriSimpleLogTest.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptFromUriWildcardTest.xml
Mon May  4 08:59:40 2009
@@ -24,15 +24,14 @@
 
     <!-- START SNIPPET: example -->
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-        <!-- intercept incoming message arriving on the seda:bar endpoint -->
-        <interceptFrom uri="seda:bar">
-            <to uri="mock:bar"/>
+        <!-- intercept incoming message arriving on any of the seda endpoints as we use
* wildcard -->
+        <interceptFrom uri="seda:*">
+            <to uri="mock:intercept"/>
         </interceptFrom>
 
         <route>
             <from uri="direct:start"/>
-            <to uri="mock:first"/>
-            <to uri="seda:bar"/>
+            <to uri="mock:result"/>
         </route>
 
         <route>
@@ -44,7 +43,6 @@
             <from uri="seda:foo"/>
             <to uri="mock:result"/>
         </route>
-
     </camelContext>
     <!-- END SNIPPET: example -->
 </beans>



Mime
View raw message