camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: I think I should be able to refer to an endpoint by name w/o knowing the URL parameters
Date Wed, 12 Mar 2008 18:52:50 GMT
The URI with query arguments creates a different endpoint to one
without. i.e the entire URI including query arguments is currently
included as the unique ID of the endpoint.

If you want to refer to an endpoint by name to avoid replicating the
configuration in different routes, then use the ref attribute in XML,
the ref endpoint type or use a variable in Java.

On 11/03/2008, Kevin Brown <Kevin.Brown@air2web.com> wrote:
>
>
>  Upgrading to camel 1.3 RC2 for the CAMEL-230, I was caught by this gotcha (see FAILS
below):
>
>
>
>  import org.apache.camel.CamelContext;
>  import org.apache.camel.CamelTemplate;
>  import org.apache.camel.builder.RouteBuilder;
>  import org.apache.camel.component.mock.MockEndpoint;
>  import org.apache.camel.impl.DefaultCamelContext;
>  import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Test;
>
>  public class GetEndpointTest {
>
>
>         private CamelContext context;
>         CamelTemplate template;
>
>         @Before
>         public void setUp() throws Exception {
>
>                 context = new DefaultCamelContext();
>                 context.addRoutes(new RouteBuilder() {
>                         public void configure() {
>                                 from("seda:start?size=20000").thread(1).to("mock:foo");
>                         }
>                 });
>
>                 template = new CamelTemplate(context);
>                 context.start();
>         }
>
>
>
>         @After
>         public void tearDown() throws Exception {
>                 context.stop();
>         }
>
>
>         @Test
>         public void testResolveByName() throws InterruptedException {
>
>                 template.sendBody("seda:start", "0");
>                 MockEndpoint resultEndpoint = context.getEndpoint("mock:foo", MockEndpoint.class);
>                 resultEndpoint.expectedMessageCount(1);
>                 resultEndpoint.assertIsSatisfied();  //FAILS:  Why can't I return the
endpoint just by name?
>         }
>
>         @Test
>         public void testResolveByNameAndParameters() throws InterruptedException {
>
>                 template.sendBody("seda:start?size=20000", "0");
>                 MockEndpoint resultEndpoint = context.getEndpoint("mock:foo", MockEndpoint.class);
>                 resultEndpoint.expectedMessageCount(1);
>                 resultEndpoint.assertIsSatisfied(); //OK
>         }
>  }
>
>
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message