activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: svn commit: r521586 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/test/java/org/apache/camel/builder/ camel
Date Fri, 23 Mar 2007 09:09:49 GMT
Can you add the Route class please, trunk isn't compiling  :)

On 3/23/07, chirino@apache.org <chirino@apache.org> wrote:
> Author: chirino
> Date: Thu Mar 22 21:59:00 2007
> New Revision: 521586
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=521586
> Log:
> Added a Route class to hold a configured Endpoint -> Processor information.
>
> Modified:
>     activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
>     activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
>     activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
>     activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
>     activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
>     activemq/camel/trunk/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
>     activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
>
> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java?view=diff&rev=521586&r1=521585&r2=521586
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
(original)
> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
Thu Mar 22 21:59:00 2007
> @@ -19,6 +19,7 @@
>
>  import org.apache.camel.builder.RouteBuilder;
>
> +import java.util.List;
>  import java.util.Map;
>  import java.util.concurrent.Callable;
>
> @@ -77,13 +78,13 @@
>
>      // Route Management Methods
>      //-----------------------------------------------------------------------
> -       public Map<Endpoint, Processor> getRoutes() ;
> +       public List<Route> getRoutes() ;
>
> -       public void setRoutes(Map<Endpoint, Processor> routes);
> +       public void setRoutes(List<Route> routes);
>      public void setRoutes(RouteBuilder builder);
>      public void setRoutes(RouteFactory factory);
>
> -       public void addRoutes(Map<Endpoint, Processor> routes);
> +       public void addRoutes(List<Route> routes);
>      public void addRoutes(RouteBuilder builder);
>      public void addRoutes(RouteFactory factory);
>
>
> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?view=diff&rev=521586&r1=521585&r2=521586
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
(original)
> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
Thu Mar 22 21:59:00 2007
> @@ -16,18 +16,17 @@
>   */
>  package org.apache.camel.builder;
>
> +import java.util.ArrayList;
> +import java.util.List;
> +import java.util.concurrent.atomic.AtomicBoolean;
> +
>  import org.apache.camel.CamelContext;
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.Exchange;
>  import org.apache.camel.Processor;
> +import org.apache.camel.Route;
>  import org.apache.camel.impl.DefaultCamelContext;
>
> -import java.util.ArrayList;
> -import java.util.HashMap;
> -import java.util.List;
> -import java.util.Map;
> -import java.util.concurrent.atomic.AtomicBoolean;
> -
>  /**
>   * A builder of destinationBuilders using a typesafe Java DLS.
>   *
> @@ -36,7 +35,7 @@
>  public abstract class RouteBuilder<E extends Exchange> extends BuilderSupport<E>
{
>      private List<FromBuilder<E>> fromBuilders = new ArrayList<FromBuilder<E>>();
>      private AtomicBoolean initalized = new AtomicBoolean(false);
> -    private Map<Endpoint<E>, Processor<E>> routeMap = new HashMap<Endpoint<E>,
Processor<E>>();
> +    private List<Route<E>> routes = new ArrayList<Route<E>>();
>
>      protected RouteBuilder() {
>          this(null);
> @@ -99,9 +98,9 @@
>      /**
>       * Returns the routing map from inbound endpoints to processors
>       */
> -    public Map<Endpoint<E>, Processor<E>> getRouteMap() {
> +    public List<Route<E>> getRouteList() {
>          checkInitialized();
> -        return routeMap;
> +        return routes;
>      }
>
>      /**
> @@ -117,18 +116,18 @@
>      protected void checkInitialized() {
>          if (initalized.compareAndSet(false, true)) {
>              configure();
> -            populateRouteMap(routeMap);
> +            populateRoutes(routes);
>          }
>      }
>
> -    protected void populateRouteMap(Map<Endpoint<E>, Processor<E>>
routeMap) {
> +    protected void populateRoutes(List<Route<E>> routes) {
>          for (FromBuilder<E> builder : fromBuilders) {
>              Endpoint<E> from = builder.getFrom();
>              Processor<E> processor = makeProcessor(from, builder);
>              if (processor == null) {
>                  throw new IllegalArgumentException("No processor created for DestinationBuilder:
" + builder);
>              }
> -            routeMap.put(from, processor);
> +            routes.add(new Route<E>(from, processor));
>          }
>      }
>
>
> Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?view=diff&rev=521586&r1=521585&r2=521586
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
(original)
> +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Thu Mar 22 21:59:00 2007
> @@ -17,8 +17,10 @@
>   */
>  package org.apache.camel.impl;
>
> +import java.util.ArrayList;
>  import java.util.HashMap;
>  import java.util.LinkedHashMap;
> +import java.util.List;
>  import java.util.Map;
>  import java.util.concurrent.Callable;
>
> @@ -26,9 +28,11 @@
>  import org.apache.camel.Component;
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.EndpointResolver;
> +import org.apache.camel.Exchange;
>  import org.apache.camel.ExchangeConverter;
>  import org.apache.camel.Processor;
>  import org.apache.camel.ResolveEndpointFailedException;
> +import org.apache.camel.Route;
>  import org.apache.camel.RouteFactory;
>  import org.apache.camel.TypeConverter;
>  import org.apache.camel.builder.RouteBuilder;
> @@ -43,7 +47,7 @@
>      private EndpointResolver endpointResolver;
>      private ExchangeConverter exchangeConverter;
>      private Map<String, Component> components = new HashMap<String, Component>();
> -    private Map<Endpoint, Processor> routes;
> +    private List<Route> routes;
>      private TypeConverter typeConverter;
>
>      /**
> @@ -125,36 +129,34 @@
>       * Activates all the starting endpoints in that were added as routes.
>       */
>      public void activateEndpoints() throws Exception {
> -        for (Map.Entry<Endpoint, Processor> entry : routes.entrySet()) {
> -            Endpoint endpoint = entry.getKey();
> -            Processor processor = entry.getValue();
> -            endpoint.activate(processor);
> -        }
> +       for (Route<Exchange> route : routes) {
> +            route.getEndpoint().activate(route.getProcessor());
> +               }
>      }
>
>      /**
>       * Deactivates all the starting endpoints in that were added as routes.
>       */
>      public void deactivateEndpoints() {
> -        for (Endpoint endpoint : routes.keySet()) {
> -            endpoint.deactivate();
> +       for (Route<Exchange> route : routes) {
> +            route.getEndpoint().deactivate();
>          }
>      }
>
>      // Route Management Methods
>      //-----------------------------------------------------------------------
> -    public Map<Endpoint, Processor> getRoutes() {
> +    public List<Route> getRoutes() {
>          return routes;
>      }
>
> -    public void setRoutes(Map<Endpoint, Processor> routes) {
> +    public void setRoutes(List<Route> routes) {
>          this.routes = routes;
>      }
>
>      public void setRoutes(RouteBuilder builder) {
>          // lets now add the routes from the builder
>          builder.setContext(this);
> -        setRoutes(builder.getRouteMap());
> +        setRoutes(builder.getRouteList());
>      }
>
>      public void setRoutes(final RouteFactory factory) {
> @@ -166,18 +168,18 @@
>          setRoutes(builder);
>      }
>
> -    public void addRoutes(Map<Endpoint, Processor> routes) {
> +    public void addRoutes(List<Route> routes) {
>         if( this.routes == null ) {
> -               this.routes = new LinkedHashMap<Endpoint, Processor>(routes);
> +               this.routes = new ArrayList<Route>(routes);
>         } else {
> -               this.routes.putAll(routes);
> +               this.routes.addAll(routes);
>         }
>      }
>
>      public void addRoutes(RouteBuilder builder) {
>          // lets now add the routes from the builder
>          builder.setContext(this);
> -        addRoutes(builder.getRouteMap());
> +        addRoutes(builder.getRouteList());
>      }
>
>      public void addRoutes(final RouteFactory factory) {
>
> Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java?view=diff&rev=521586&r1=521585&r2=521586
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
(original)
> +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
Thu Mar 22 21:59:00 2007
> @@ -17,17 +17,17 @@
>   */
>  package org.apache.camel.builder;
>
> +import java.util.List;
> +
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.Exchange;
>  import org.apache.camel.Processor;
> +import org.apache.camel.Route;
>  import org.apache.camel.TestSupport;
>  import org.apache.camel.processor.FilterProcessor;
>  import org.apache.camel.processor.LoggingErrorHandler;
>  import org.apache.camel.processor.SendProcessor;
>
> -import java.util.Map;
> -import java.util.Set;
> -
>  /**
>   * @version $Revision$
>   */
> @@ -163,13 +163,12 @@
>          };
>          // END SNIPPET: e5
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
> +        List<Route<Exchange>> routes = builder.getRouteList();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
> -            Processor processor = route.getValue();
> +            Processor processor = route.getProcessor();
>
>              LoggingErrorHandler loggingProcessor = assertIsInstanceOf(LoggingErrorHandler.class,
processor);
>              FilterProcessor filterProcessor = assertIsInstanceOf(FilterProcessor.class,
loggingProcessor.getOutput());
>
> Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?view=diff&rev=521586&r1=521585&r2=521586
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
(original)
> +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
Thu Mar 22 21:59:00 2007
> @@ -24,6 +24,7 @@
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.Exchange;
>  import org.apache.camel.Processor;
> +import org.apache.camel.Route;
>  import org.apache.camel.TestSupport;
>  import org.apache.camel.processor.ChoiceProcessor;
>  import org.apache.camel.processor.DeadLetterChannel;
> @@ -57,11 +58,10 @@
>         public void testSimpleRoute() throws Exception {
>          RouteBuilder<Exchange> builder = buildSimpleRoute();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
> +        List<Route<Exchange>> routes = builder.getRouteList();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -84,13 +84,12 @@
>         public void testSimpleRouteWithHeaderPredicate() throws Exception {
>          RouteBuilder<Exchange> builder = buildSimpleRouteWithHeaderPredicate();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -118,13 +117,12 @@
>      public void testSimpleRouteWithChoice() throws Exception {
>          RouteBuilder<Exchange> builder = buildSimpleRouteWithChoice();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -162,12 +160,11 @@
>         public void testCustomProcessor() throws Exception {
>          RouteBuilder<Exchange> builder = buildCustomProcessor();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> +        List<Route<Exchange>> routes = builder.getRouteList();
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -190,13 +187,12 @@
>         public void testCustomProcessorWithFilter() throws Exception {
>          RouteBuilder<Exchange> builder = buildCustomProcessorWithFilter();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -220,13 +216,12 @@
>      public void testWireTap() throws Exception {
>          RouteBuilder<Exchange> builder = buildWireTap();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -263,13 +258,12 @@
>
>          RouteBuilder<Exchange> builder = buildRouteWithInterceptor();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -292,13 +286,12 @@
>          };
>          // END SNIPPET: e7
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
> -        assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        assertEquals("Number routes created", 2, routes.size());
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -338,13 +331,12 @@
>
>          RouteBuilder<Exchange> builder = buildDynamicRecipientList();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -366,13 +358,12 @@
>
>          RouteBuilder<Exchange> builder = buildSplitter();
>
> -        Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
> -        System.out.println("Created map: " + routeMap);
> +        List<Route<Exchange>> routes = builder.getRouteList();
> +        System.out.println("Created routes: " + routes);
>
> -        Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>>
routes = routeMap.entrySet();
>          assertEquals("Number routes created", 1, routes.size());
> -        for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route
: routes) {
> -            Endpoint<Exchange> key = route.getKey();
> +        for (Route<Exchange> route : routes) {
> +            Endpoint<Exchange> key = route.getEndpoint();
>              assertEquals("From endpoint", "queue:a", key.getEndpointUri());
>              Processor processor = getProcessorWithoutErrorHandler(route);
>
> @@ -390,8 +381,8 @@
>      /**
>       * By default routes should be wrapped in the {@link DeadLetterChannel} so lets
unwrap that and return the actual processor
>       */
> -    protected Processor<Exchange> getProcessorWithoutErrorHandler(Map.Entry<Endpoint<Exchange>,
Processor<Exchange>> route) {
> -        Processor<Exchange> processor = route.getValue();
> +    protected Processor<Exchange> getProcessorWithoutErrorHandler(Route route)
{
> +        Processor<Exchange> processor = route.getProcessor();
>          return unwrapErrorHandler(processor);
>      }
>
>
> Modified: activemq/camel/trunk/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java?view=diff&rev=521586&r1=521585&r2=521586
> ==============================================================================
> --- activemq/camel/trunk/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
(original)
> +++ activemq/camel/trunk/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
Thu Mar 22 21:59:00 2007
> @@ -46,6 +46,9 @@
>          HttpExchange exchange = endpoint.createExchange(request, response);
>          endpoint.onExchange(exchange);
>
> +        // HC: The getBinding() interesting because it illustrates the impedance miss-match
between
> +        // HTTP's stream oriented protocol, and Camels more message oriented protocol
exchanges.
> +
>          // now lets output to the response
>          endpoint.getBinding().writeResponse(exchange);
>      }
>
> Modified: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java?view=diff&rev=521586&r1=521585&r2=521586
> ==============================================================================
> --- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
(original)
> +++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
Thu Mar 22 21:59:00 2007
> @@ -17,12 +17,14 @@
>   */
>  package org.apache.camel.spring;
>
> +import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
>
>  import org.apache.camel.CamelContext;
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.Processor;
> +import org.apache.camel.Route;
>  import org.apache.camel.TestSupport;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> @@ -41,15 +43,14 @@
>          CamelContext context = (CamelContext) applicationContext.getBean("camel");
>          assertNotNull("No context found!", context);
>
> -        Map<Endpoint,Processor> map = context.getRoutes();
> -        log.debug("Found routes: " + map);
> +        List<Route> routes = context.getRoutes();
> +        log.debug("Found routes: " + routes);
>
> -        Set<Map.Entry<Endpoint,Processor>> entries = map.entrySet();
> -        assertEquals("One Route should be found", 1, entries.size());
> +        assertEquals("One Route should be found", 1, routes.size());
>
> -        for (Map.Entry<Endpoint, Processor> entry : entries) {
> -            Endpoint key = entry.getKey();
> -            Processor processor = entry.getValue();
> +        for (Route route : routes) {
> +            Endpoint key = route.getEndpoint();
> +            Processor processor = route.getProcessor();
>
>              assertEndpointUri(key, "queue:test.a");
>          }
> @@ -61,15 +62,14 @@
>          CamelContext context = (CamelContext) applicationContext.getBean("camel2");
>          assertNotNull("No context found!", context);
>
> -        Map<Endpoint,Processor> map = context.getRoutes();
> -        log.debug("Found routes: " + map);
> +        List<Route> routes = context.getRoutes();
> +        log.debug("Found routes: " + routes);
>
> -        Set<Map.Entry<Endpoint,Processor>> entries = map.entrySet();
> -        assertEquals("One Route should be found", 1, entries.size());
> +        assertEquals("One Route should be found", 1, routes.size());
>
> -        for (Map.Entry<Endpoint, Processor> entry : entries) {
> -            Endpoint key = entry.getKey();
> -            Processor processor = entry.getValue();
> +        for (Route route : routes) {
> +            Endpoint key = route.getEndpoint();
> +            Processor processor = route.getProcessor();
>              assertEndpointUri(key, "queue:test.c");
>          }
>      }
>
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message