camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel newbie, endpoint configuration?
Date Thu, 29 Apr 2010 16:01:14 GMT
Hi

You need to add the mock component with the scheme fileformat

// for example as follows
context.addComponent"fileformat", context.getComponent("mock"));



On Thu, Apr 29, 2010 at 5:54 PM, Mattias Severson <matsev@gmail.com> wrote:
>
> Hi,
>
> I have a system that has a handle(long id) interface that I must implement.
> My plan is to use this method as a Producer in the camel context:
>
> public class SystemApiImpl {
>
>    public static final String RECIEVER_URL = "some:receiver";
>
>    private final ProducerTemplate producerTemplate;
>
>    public SystemApiImpl(CamelContext camelContext) {
>        producerTemplate = camelContext.createProducerTemplate();
>    }
>
>    public void handle(long someId) {
>        producerTemplate.sendBody(RECIEVER_URL, someId);
>    }
> }
>
>
> Now, I would like to create a unit test that verifies that the RECEIVER_URL
> gets the id:
>
> public class SystemApiImplTest {
>
>    private static final long SOME_ID = 42;
>    private OutputHandler outputHandler;
>    private DefaultCamelContext camelContext;
>    private MockEndpoint mockEndpoint;
>
>    @Before
>    public void setUp() throws Exception {
>        camelContext = new DefaultCamelContext();
>        outputHandler = new OutputHandlerImpl(camelContext);
>        mockEndpoint = new MockEndpoint(RECIEVER_URL);
>        camelContext.addEndpoint(RECIEVER_URL, mockEndpoint);
>    }
>
>    @Test
>    public void testHandle() {
>        outputHandler.handle(SOME_ID);
>        Exchange exchange = mockEndpoint.getExchanges().get(0);
>        Message in = exchange.getIn();
>        Long value = in.getBody(Long.class);
>        assertEquals(SOME_ID, value.longValue());
>    }
> }
>
>
> However, it seems that I have missed something fundamental, because the
> sendBody() method throws an exception:
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint:
> fileformat://router due to: No component found with scheme: fileformat
>
>
> Please advise,
>
> Mattias
> --
> View this message in context: http://old.nabble.com/Camel-newbie%2C-endpoint-configuration--tp28402433p28402433.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message