Hi

I have been trying to JUnit one of my Camel routes where the Camel context
contains a <routeContextRef>. When I comment this out my test works, but I
cannot seem to get my test to run with this in as I get an error,
IllegalArgumentException: Cannot find RouteContext with reference
commonRoute.

How do I either mock or skip this without having to import all the dependent
xml's as I am mocking the endpoint that is dependant on the reference.  I am
trying to test just the transform route indicated below.

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:camel="http://camel.apache.org/schema/spring";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

        <camelContext id="management-mymanagementDetails_v2" trace="{{trace}}"
xmlns="http://camel.apache.org/schema/spring";>
                
                
                <propertyPlaceholder id="properties"
location="/v2/properties/details-v2.properties"/>
                
                
        <routeContextRef ref="commonRoute"/>
                         
            
            <route id="transform">
                        <from uri="direct:transform"/>
                <marshal ref="jaxbMain"/>
                        <filter 
xmlns:ns2="http://www.mycompany/main/management/v2";>
                                <xpath>//ns2:getOrderDetailsRequest</xpath>
                                <to 
uri="xquery://v2/xquery/managementRequest.xq"/>
                </filter>
                <unmarshal ref="jaxbBus"/>
                <to uri="direct:toMainServiceCall"/>
                </route>    

......


Test Class extract, my test is extending CamelSpringTestSupport

@Override
        protected AbstractApplicationContext createApplicationContext() {

                System.setProperty("trace", "true");
                System.setProperty("messageCentralXslt", 
"messagecentral-transform.xsl");
                System.setProperty("msgQueueName", "messagecentral.orderpbb");
                
                
                ClassPathXmlApplicationContext a = new 
ClassPathXmlApplicationContext();
                *a.setConfigLocations(new String[]{V2_GET_DETAILS_V2_XML});*
                return a;

        }



--
View this message in context: 
http://camel.465427.n5.nabble.com/JUnit-route-with-routeContextRef-tp5754950.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to