"http://www.springframework.org/schema/osgi-compendium"; namespace handler is a part of Spring-DM. You need to deploy the spring application into OSGi platform.

If you just want to test spring DSL without OSGi. you may consider to put the
 <osgix:cm-properties id="someProperties" persistent-id="com.something" />
into META-INF/spring/osgi-context.xml and import actuate camel context from other directory such as META-INF/camel/camel-context.xml.

In this way you can test your Spring DSL with sample CamelSpringTestSupport with the application context "test-routes.xml", "META-INF/camel/camel-context.xml".

Willem

On 4/20/11 3:56 PM, janne postilista wrote:
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" />



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com

Reply via email to