Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B7EB3E6F4 for ; Sun, 3 Feb 2013 12:11:27 +0000 (UTC) Received: (qmail 75904 invoked by uid 500); 3 Feb 2013 12:11:27 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 75823 invoked by uid 500); 3 Feb 2013 12:11:27 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 75777 invoked by uid 99); 3 Feb 2013 12:11:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Feb 2013 12:11:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Feb 2013 12:11:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D2474238896F; Sun, 3 Feb 2013 12:10:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1441905 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/RuntimeConfiguration.java test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java Date: Sun, 03 Feb 2013 12:10:55 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130203121055.D2474238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Sun Feb 3 12:10:55 2013 New Revision: 1441905 URL: http://svn.apache.org/viewvc?rev=1441905&view=rev Log: CAMEL-5876: Added test and improved javadoc about autoStartup=false on CamelContext. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeConfiguration.java camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeConfiguration.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeConfiguration.java?rev=1441905&r1=1441904&r2=1441905&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeConfiguration.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeConfiguration.java Sun Feb 3 12:10:55 2013 @@ -88,6 +88,10 @@ public interface RuntimeConfiguration { *

* Important: Currently only routes can be disabled, as {@link CamelContext}s are always started. *
+ * Note: When setting auto startup false on {@link CamelContext} then that takes precedence + * and no routes is started. You would need to start {@link CamelContext} explicit using + * the {@link org.apache.camel.CamelContext#start()} method, to start the context and the routes. + *

* Default is true to always start up. * * @param autoStartup whether to start up automatically. Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java?rev=1441905&r1=1441904&r2=1441905&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java Sun Feb 3 12:10:55 2013 @@ -119,4 +119,40 @@ public class DefaultCamelContextAutoStar camel.stop(); } + + public void testAutoStartupFalseRouteOverride() throws Exception { + DefaultCamelContext camel = new DefaultCamelContext(new SimpleRegistry()); + camel.disableJMX(); + camel.setAutoStartup(false); + + camel.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start").routeId("foo").autoStartup(true).to("mock:result"); + } + }); + camel.start(); + + // this is special, when you have auto startup=false on CamelContext, then NO routes is started + + assertEquals(true, camel.isStarted()); + assertEquals(1, camel.getRoutes().size()); + assertEquals(true, camel.getRouteStatus("foo").isStopped()); + assertEquals(false, camel.getRouteStatus("foo").isStarted()); + + // now start camel again, to get it to start the routes + camel.start(); + + assertEquals(true, camel.getRouteStatus("foo").isStarted()); + + MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class); + mock.expectedMessageCount(1); + + camel.createProducerTemplate().sendBody("direct:start", "Hello World"); + + mock.assertIsSatisfied(); + + camel.stop(); + } + }