I'm trying to unit/integration test my Spring DSL refined route with
CamelSpringTestSupport. I have camel-context.xml which defines my
routes. I try to initialize tests with that, and mock some endpoints
using test-routes.xml which looks like:

    <interceptSendToEndpoint uri="activemq://something-that-ends-my-route">
      <to uri="mock:mock-endpoint"/>
    </interceptSendToEndpoint>

and my test class then looks like

public class SomeTest extends CamelSpringTestSupport {

        @Override
        protected AbstractApplicationContext createApplicationContext() {
                return new ClassPathXmlApplicationContext(new String[]{
                        "test-routes.xml",
                        "META-INF/spring/camel-context.xml"
                });
        }       
        
        @Test
        public void testSomething() throws Exception {
                MockEndpoint mock = getMockEndpoint("mock:mock-endpoint");
                mock.expectedMessageCount(1);
                template.sendBody("someendpointwhichstartsmyroute", SOMETHING);
                mock.assertIsSatisfied();
        }

Problem is that CamelSpringTestSupport refuses to use my route
definition, which uses osgi for configuring variables:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace
[http://www.springframework.org/schema/osgi-compendium]
Offending resource: class path resource [META-INF/spring/camel-context.xml]

        at 
org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)

Start of my camel-context.xml:

<beans xmlns="http://www.springframework.org/schema/beans";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:osgi="http://camel.apache.org/schema/osgi";
  xmlns:osgix="http://www.springframework.org/schema/osgi-compendium";
  xmlns:ctx="http://www.springframework.org/schema/context";
  xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
       http://camel.apache.org/schema/osgi
http://camel.apache.org/schema/osgi/camel-osgi.xsd
       http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
       http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
">

  <osgix:cm-properties id="someProperties" persistent-id="com.something" />

Reply via email to