camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Kleymenov (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAMEL-1509) DefaultCamelContext.isStarting returns incorrect status
Date Wed, 01 Apr 2009 17:13:34 GMT
DefaultCamelContext.isStarting returns incorrect status
-------------------------------------------------------

                 Key: CAMEL-1509
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1509
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.0-M1, 1.6.0
            Reporter: Alexander Kleymenov


DefaultCamelContext.isStarting returns true while it actually not started.
So the following groovy test case fails:

{code:title=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();
{code}

Note, after moving of  
{code}
camelCtx.addRoutes(route)
{code}
 after
{code}
Thread.start {
    camelCtx.start();
}
{code}
the test passes.

Also the program does not finish after camelCtx.stop();


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message