Trying to get the following example working with blueprint but with no
success:

http://camel.apache.org/how-do-i-import-routes-from-other-xml-files.html

Test class:

public class BlueprintTest extends CamelBlueprintTestSupport {
    
    @Override
    protected String getBlueprintDescriptor() {
        return "/OSGI-INF/blueprint/test-context_2.xml";
    }

    @Test
    public void testRoute() throws Exception {
        
        getMockEndpoint("mock:result").expectedMessageCount(1);
        
        template.sendBody("direct:start", "test");
        
        assertMockEndpointsSatisfied();
    }
}

Blueprint configurations:

first:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:schemaLocation="
             http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>

    <import resource="OSGI-INF/blueprint/test-context_1.xml"/>
 
    <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
 
        <routeContextRef ref="myCoolRoutes"/>
 
        <route id="inside">
            <from uri="direct:inside"/>
            <to uri="mock:inside"/>
        </route>
    </camelContext>

</blueprint>

second:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:schemaLocation="
             http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>

    <routeContext id="myCoolRoutes"
xmlns="http://camel.apache.org/schema/blueprint";>
        <route id="cool">
            <from uri="direct:start"/>
            <to uri="mock:result"/>
        </route>
        <route id="bar">
            <from uri="direct:bar"/>
            <to uri="mock:bar"/>
        </route>
    </routeContext>

</blueprint>

stacktrace:

testRoute(fi.eura2014.integration.BlueprintTest)  Time elapsed: 30.806 sec 
<<< ERROR!
java.lang.RuntimeException: Gave up waiting for service
(objectClass=org.apache.camel.CamelContext)
        at
org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:203)
        at
org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:165)
        at
org.apache.camel.test.blueprint.CamelBlueprintTestSupport.createCamelContext(CamelBlueprintTestSupport.java:116)
        at
org.apache.camel.test.junit4.CamelTestSupport.doSetUp(CamelTestSupport.java:247)
        at
org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:217)
        at
org.apache.camel.test.blueprint.CamelBlueprintTestSupport.setUp(CamelBlueprintTestSupport.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
        at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
        at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
        at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
        at org.junit.rules.RunRules.evaluate(RunRules.java:18)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
        at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
        at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
        at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
        at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
        at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
        at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
        at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)







--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-blueprint-unit-tests-tp5738911.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to