camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Coombes Paul (RTH) OUH" <>
Subject Mocking Endpoints Query
Date Fri, 03 Jul 2015 08:26:50 GMT
Dear Camel Guru's
I have a query regarding testing of a Java DSL route and how to effectively mock endpoints.

I have a SpringRouteBuilder (see following) that polls a database table via the hibernate
component, with the results being split into individual result items which are transformed
into an HAPI HL7 Message via a custom processor before being sent to a HL7 receiver via a
Mina2 endpoint.

Having looked over the testing documentation and not seeing an immediately obvious answer,
my question is, how best to test a routes logic whilst mocking the producer and consumer endpoints
(Hibernate and Mina2 respectively) without duplicating the route logic in a Junit test?

from("hibernate:HibernateModel?consumeDelete=false&consumer.query=FROM HibernateModel
WHERE processed = 'N'")
.log(LoggingLevel.DEBUG, "my.logger", "Transforming HibernateModel ${}")

.onException(new Class[] { java.lang.Exception.class })
.log(LoggingLevel.ERROR, " my.logger", "Failed to generate ORU^R01 ${} - ${exception.stacktrace}")
.log(LoggingLevel.DEBUG, "my.logger", "Transforming HibernateModel ${} into HLv2 ORU^R01")

Camel Spring Configuration
<camel:endpoint id="mirthV2StoreOut" uri="mina2:tcp://${}:${listen.port}?codec=#hl7codec"/>
<camel:camelContext id="integrationEngineInCamelCtx">
            <camel:routeBuilder ref="HL7RouteBuilder" />
<bean id="HL7RouteBuilder" class="HL7RouteBuilder" scope="prototype"/>

Kind Regards,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message