Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6.0, 2.0-M1
-
None
Description
DefaultCamelContext.isStarting returns true while it actually not started.
So the following groovy test case fails:
test.groovy
import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.language.groovy.GroovyRouteBuilder; class Foo { def name def data void run(data) { println "[${name}] got ${data}" this.data = data } } public class MyRoute extends GroovyRouteBuilder { def bean = new Foo(name: "bean") protected void configure() { from("direct:start").bean(bean, "run") } } camelCtx = new DefaultCamelContext() route = new MyRoute() camelCtx.addRoutes(route); Thread.start { camelCtx.start(); } while (camelCtx.isStarting()) { Thread.sleep(1000) } camelCtx.createProducerTemplate().sendBody("direct:start", "data") if (!route.bean.data) { println "FAILED: no data has been received!" } else { println "PASSED" } camelCtx.stop();
Note, after moving of
camelCtx.addRoutes(route)
after
Thread.start {
camelCtx.start();
}
the test passes.
Also the program does not finish after camelCtx.stop();