Dear Camel Specialists,

I have an EventNotifier where I send a message to another camel endpoint
(JMS Queue) from a POJO.
This works fine.

But I cannot test this Notifier because of this @Producer Endpoint.

*My EventNotifier:*

public class TrackingEventNotifier extends EventNotifierSupport {
   private static final Logger LOG =
LoggerFactory.getLogger(TrackingEventNotifier.class);

   @Produce("jms:queue:" + TRACKING_QUEUE)
   private JmsProducer trackingProducer;
.....

*My Unit Test Route is quite simple:*

@SpringBootTest
@RunWith(CamelSpringBootRunner.class)
@ActiveProfiles("test")
@ContextConfiguration(classes = {
        TrackingTestSpring.ContextConfig.class,
        TrackingEventNotifier.class, JmsConfiguration.class,
JmsProducer.class, JmsEndpoint.class,
        EventMessageBuilderFactory.class, TrackingFileMessageBuilder.class,
TrackingDefaultMessageBuilder.class})
@MockEndpointsAndSkip("jms")
public class TrackingTestSpring

...........

    @Configuration
    public static class ContextConfig extends SingleRouteCamelConfiguration
{

        @Bean
        public RouteBuilder route() {
            return new RouteBuilder() {
                public void configure() {

                    interceptSendToEndpoint("jms:queue")
                            .log("INTERCEPTED");

                    from("direct:start")
                            .routeId("TestRoute")
                            .log("Content: ${body}")


*Within the UnitTest* I tried to intercept this endpoint. But this does not
work because Camel tries to send to this endpoint which is not configured
during the Unit Tests Run.
Any suggestions how i can avoid this?

20:57:03.221 [main] WARN org.apache.camel.support.EventHelper - Error
notifying event ID-atcw-033195-1593802621850-0-1 exchange
Exchange[ID-atcw-033195-1593802621850-0-1] sent to: file://data took: 12
ms.. This exception will be ignored.
java.lang.IllegalArgumentException: *connectionFactory must be specified*
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:152)
at
org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1629)

Thank you so much for any help

Reply via email to