camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mattias Severson <mat...@gmail.com>
Subject Camel newbie, endpoint configuration?
Date Thu, 29 Apr 2010 15:54:54 GMT

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.


Mime
View raw message