You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/10/03 20:19:14 UTC
svn commit: r821383 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/impl/
camel-core/src/main/java/org/apache/camel/model/
camel-core/src/test/java/org/apache/camel/processor/
components/camel-spring/src/test/java/org/apache/camel/spring/p...
Author: davsclaus
Date: Sat Oct 3 18:19:14 2009
New Revision: 821383
URL: http://svn.apache.org/viewvc?rev=821383&view=rev
Log:
CAMEL-1556: Routes can now be configured with a startupOrder which dictates the order they should be started and stopped.
Added:
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderSimpleTest.java (contents, props changed)
- copied, changed from r821276, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteNoAutoStartupTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderWithDefaultTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderSimpleTest.java
- copied, changed from r821276, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteNoAutoStartupTest.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderWithDefaultTest.java (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderSimpleTest.xml
- copied, changed from r821276, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteNoAutoStartupTest.xml
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml (with props)
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=821383&r1=821382&r2=821383&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Sat Oct 3 18:19:14 2009
@@ -78,6 +78,7 @@
import org.apache.camel.spi.ServicePool;
import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.util.EventHelper;
+import org.apache.camel.util.KeyValueHolder;
import org.apache.camel.util.LRUCache;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ReflectionInjector;
@@ -136,6 +137,8 @@
private NodeIdFactory nodeIdFactory = new DefaultNodeIdFactory();
private Tracer defaultTracer;
private InflightRepository inflightRepository = new DefaultInflightRepository();
+ private final List<Consumer> routeStartupOrder = new ArrayList<Consumer>();
+ private int defaultRouteStartupOrder = 1000;
public DefaultCamelContext() {
super();
@@ -480,6 +483,16 @@
// Route Management Methods
// -----------------------------------------------------------------------
+
+ /**
+ * Returns the order in which the route inputs was started.
+ *
+ * @return a list ordered by the starting order of the route inputs
+ */
+ public List<Consumer> getRouteStartupOrder() {
+ return routeStartupOrder;
+ }
+
public synchronized List<Route> getRoutes() {
if (routes == null) {
routes = new ArrayList<Route>();
@@ -837,8 +850,9 @@
// the context is now considered started (i.e. isStarted() == true))
// starting routes is done after, not during context startup
synchronized (this) {
- // list of inputs to start when all the routes have been preparated for start
- Map<Route, Consumer> inputs = new HashMap<Route, Consumer>();
+ // list of inputs to start when all the routes have been prepared for starting
+ // we use a tree map so the routes will be ordered according to startup order defined on the route
+ Map<Integer, KeyValueHolder<Route, Consumer>> inputs = new TreeMap<Integer, KeyValueHolder<Route, Consumer>>();
for (RouteService routeService : routeServices.values()) {
Boolean autoStart = routeService.getRouteDefinition().isAutoStartup();
@@ -852,7 +866,25 @@
try {
routeService.start();
// add the inputs from this route service to the list to start afterwards
- inputs.putAll(routeService.getInputs());
+ // should be ordered according to the startup number
+ Integer startupOrder = routeService.getRouteDefinition().getStartupOrder();
+ if (startupOrder == null) {
+ // auto assign a default startup order
+ startupOrder = defaultRouteStartupOrder++;
+ }
+
+ for (Map.Entry<Route, Consumer> entry : routeService.getInputs().entrySet()) {
+ KeyValueHolder<Route, Consumer> holder = new KeyValueHolder<Route, Consumer>(entry.getKey(), entry.getValue());
+ // check for startup order clash
+ if (inputs.containsKey(startupOrder)) {
+ if (LOG.isWarnEnabled()) {
+ LOG.warn("Another route has already startupOrder " + startupOrder + " which this route also want to use " + entry.getKey().getId()
+ + ". Please correct startupOrder to be unique among your routes.");
+ }
+ startupOrder = defaultRouteStartupOrder++;
+ }
+ inputs.put(startupOrder, holder);
+ }
} finally {
routeService.startInputs(true);
}
@@ -863,17 +895,21 @@
}
// now start the inputs for all the route services as we have prepared Camel
- // yeah open the floods so messages can start flow into Came;
- for (Map.Entry<Route, Consumer> entry : inputs.entrySet()) {
- Route route = entry.getKey();
- Consumer consumer = entry.getValue();
+ // yeah open the floods so messages can start flow into Camel
+ for (Map.Entry<Integer, KeyValueHolder<Route, Consumer>> entry : inputs.entrySet()) {
+ Integer order = entry.getKey();
+ Route route = entry.getValue().getKey();
+ Consumer consumer = entry.getValue().getValue();
if (LOG.isTraceEnabled()) {
- LOG.trace("Starting consumer on route: " + route.getId());
+ LOG.trace("Starting consumer (order: " + order + ") on route: " + route.getId());
}
for (LifecycleStrategy strategy : lifecycleStrategies) {
strategy.onServiceAdd(this, consumer, route);
}
ServiceHelper.startService(consumer);
+
+ // add to the order which they was started, so we know how to stop them in reverse order
+ routeStartupOrder.add(consumer);
}
}
@@ -970,6 +1006,10 @@
LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") is stopping");
EventHelper.notifyCamelContextStopping(this);
+ // stop route inputs in the same order as they was started so we stop the very first inputs first
+ stopServices(getRouteStartupOrder(), false);
+ getRouteStartupOrder().clear();
+
// the stop order is important
stopServices(endpoints.values());
endpoints.clear();
@@ -1011,12 +1051,21 @@
}
}
- @SuppressWarnings("unchecked")
private void stopServices(Collection services) throws Exception {
- // close them in reverse order as they where added
- List reverse = new ArrayList(services);
- Collections.reverse(reverse);
- for (Object service : reverse) {
+ // reverse stopping by default
+ stopServices(services, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void stopServices(Collection services, boolean reverse) throws Exception {
+ Collection list = services;
+ if (reverse) {
+ ArrayList reverseList = new ArrayList(services);
+ Collections.reverse(reverseList);
+ list = reverseList;
+ }
+
+ for (Object service : list) {
stopServices(service);
}
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java?rev=821383&r1=821382&r2=821383&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java Sat Oct 3 18:19:14 2009
@@ -61,6 +61,7 @@
private Boolean handleFault;
private Long delayer;
private Boolean autoStartup = Boolean.TRUE;
+ private Integer startupOrder;
public RouteDefinition() {
}
@@ -294,6 +295,20 @@
return this;
}
+ /**
+ * Configures the startup order for this route
+ * <p/>
+ * Camel will reorder routes and star them ordered by 0..N where 0 is the lowest number and N the highest number.
+ * Camel will stop routes in reverse order when its stopping.
+ *
+ * @param order the order represented as a number
+ * @return this builder
+ */
+ public RouteDefinition starupOrder(int order) {
+ setStartupOrder(order);
+ return this;
+ }
+
// Properties
// -----------------------------------------------------------------------
@@ -390,6 +405,15 @@
this.autoStartup = autoStartup;
}
+ public Integer getStartupOrder() {
+ return startupOrder;
+ }
+
+ @XmlAttribute
+ public void setStartupOrder(Integer startupOrder) {
+ this.startupOrder = startupOrder;
+ }
+
/**
* Sets the bean ref name of the error handler builder to use on this route
*/
Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderSimpleTest.java (from r821276, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteNoAutoStartupTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderSimpleTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderSimpleTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteNoAutoStartupTest.java&r1=821276&r2=821383&rev=821383&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteNoAutoStartupTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderSimpleTest.java Sat Oct 3 18:19:14 2009
@@ -16,42 +16,34 @@
*/
package org.apache.camel.processor;
+import java.util.List;
+
+import org.apache.camel.Consumer;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.DefaultCamelContext;
/**
* @version $Revision$
*/
-public class RouteNoAutoStartupTest extends ContextTestSupport {
-
- public void testRouteNotAutoStarted() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMessageCount(0);
-
- template.sendBody("direct:start", "Hello World");
-
- Thread.sleep(1000);
+public class RouteStartupOrderSimpleTest extends ContextTestSupport {
- assertMockEndpointsSatisfied();
- }
-
- public void testRouteNotAutoStartedThenStarted() throws Exception {
+ public void testRouteStartupOrder() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(0);
template.sendBody("direct:start", "Hello World");
- Thread.sleep(1000);
-
assertMockEndpointsSatisfied();
- mock.reset();
- mock.expectedMessageCount(1);
-
- context.startRoute("myRoute");
-
- assertMockEndpointsSatisfied();
+ // assert correct order
+ DefaultCamelContext dcc = (DefaultCamelContext) context;
+ List<Consumer> order = dcc.getRouteStartupOrder();
+
+ assertEquals(2, order.size());
+ assertEquals("direct://start", order.get(0).getEndpoint().getEndpointUri());
+ assertEquals("seda://foo", order.get(1).getEndpoint().getEndpointUri());
}
@Override
@@ -59,10 +51,10 @@
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("direct:start").to("seda:foo");
+ from("seda:foo").starupOrder(2).to("mock:result");
- from("seda:foo").noAutoStartup().id("myRoute").to("mock:result");
+ from("direct:start").starupOrder(1).to("seda:foo");
}
};
}
-}
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderSimpleTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderSimpleTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderTest.java?rev=821383&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderTest.java Sat Oct 3 18:19:14 2009
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.util.List;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.DefaultCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class RouteStartupOrderTest extends ContextTestSupport {
+
+ public void testRouteStartupOrder() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(0);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+
+ // assert correct order
+ DefaultCamelContext dcc = (DefaultCamelContext) context;
+ List<Consumer> order = dcc.getRouteStartupOrder();
+
+ assertEquals(4, order.size());
+ assertEquals("seda://foo", order.get(0).getEndpoint().getEndpointUri());
+ assertEquals("direct://start", order.get(1).getEndpoint().getEndpointUri());
+ assertEquals("seda://bar", order.get(2).getEndpoint().getEndpointUri());
+ assertEquals("direct://bar", order.get(3).getEndpoint().getEndpointUri());
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").starupOrder(2).to("seda:foo");
+
+ from("seda:foo").starupOrder(1).to("mock:result");
+
+ from("direct:bar").starupOrder(9).to("seda:bar");
+
+ from("seda:bar").starupOrder(5).to("mock:other");
+ }
+ };
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderWithDefaultTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderWithDefaultTest.java?rev=821383&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderWithDefaultTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderWithDefaultTest.java Sat Oct 3 18:19:14 2009
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.util.List;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.DefaultCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class RouteStartupOrderWithDefaultTest extends ContextTestSupport {
+
+ public void testRouteStartupOrder() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(0);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+
+ // assert correct order
+ DefaultCamelContext dcc = (DefaultCamelContext) context;
+ List<Consumer> order = dcc.getRouteStartupOrder();
+
+ assertEquals(5, order.size());
+ assertEquals("seda://foo", order.get(0).getEndpoint().getEndpointUri());
+ assertEquals("direct://start", order.get(1).getEndpoint().getEndpointUri());
+ assertEquals("seda://bar", order.get(2).getEndpoint().getEndpointUri());
+ assertEquals("direct://bar", order.get(3).getEndpoint().getEndpointUri());
+ // the one with no startup order should be last
+ assertEquals("direct://default", order.get(4).getEndpoint().getEndpointUri());
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").starupOrder(2).to("seda:foo");
+
+ from("seda:foo").starupOrder(1).to("mock:result");
+
+ from("direct:bar").starupOrder(9).to("seda:bar");
+
+ from("seda:bar").starupOrder(5).to("mock:other");
+
+ // has no startup order then it should be last
+ from("direct:default").to("mock:default");
+ }
+ };
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderWithDefaultTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderWithDefaultTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderSimpleTest.java (from r821276, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteNoAutoStartupTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderSimpleTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderSimpleTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteNoAutoStartupTest.java&r1=821276&r2=821383&rev=821383&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteNoAutoStartupTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderSimpleTest.java Sat Oct 3 18:19:14 2009
@@ -17,15 +17,15 @@
package org.apache.camel.spring.processor;
import org.apache.camel.CamelContext;
-import org.apache.camel.processor.RouteNoAutoStartupTest;
+import org.apache.camel.processor.RouteStartupOrderSimpleTest;
import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
/**
* @version $Revision$
*/
-public class SpringRouteNoAutoStartupTest extends RouteNoAutoStartupTest {
+public class SpringRouteStartupOrderSimpleTest extends RouteStartupOrderSimpleTest {
protected CamelContext createCamelContext() throws Exception {
- return createSpringCamelContext(this, "org/apache/camel/spring/processor/RouteNoAutoStartupTest.xml");
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/RouteStartupOrderSimpleTest.xml");
}
}
\ No newline at end of file
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderTest.java?rev=821383&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderTest.java Sat Oct 3 18:19:14 2009
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.RouteStartupOrderTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringRouteStartupOrderTest extends RouteStartupOrderTest {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/RouteStartupOrderTest.xml");
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderWithDefaultTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderWithDefaultTest.java?rev=821383&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderWithDefaultTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderWithDefaultTest.java Sat Oct 3 18:19:14 2009
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.RouteStartupOrderWithDefaultTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringRouteStartupOrderWithDefaultTest extends RouteStartupOrderWithDefaultTest {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml");
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderWithDefaultTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteStartupOrderWithDefaultTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderSimpleTest.xml (from r821276, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteNoAutoStartupTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderSimpleTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderSimpleTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteNoAutoStartupTest.xml&r1=821276&r2=821383&rev=821383&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteNoAutoStartupTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderSimpleTest.xml Sat Oct 3 18:19:14 2009
@@ -23,17 +23,19 @@
">
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:start"/>
- <to uri="seda:foo"/>
- </route>
<!-- START SNIPPET: e1 -->
- <route autoStartup="false" id="myRoute">
+ <route startupOrder="2">
<from uri="seda:foo"/>
<to uri="mock:result"/>
</route>
+
+ <route startupOrder="1">
+ <from uri="direct:start"/>
+ <to uri="seda:foo"/>
+ </route>
<!-- END SNIPPET: e1 -->
+
</camelContext>
</beans>
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml?rev=821383&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml Sat Oct 3 18:19:14 2009
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+ <route startupOrder="2">
+ <from uri="direct:start"/>
+ <to uri="seda:foo"/>
+ </route>
+
+ <route startupOrder="1">
+ <from uri="seda:foo"/>
+ <to uri="mock:result"/>
+ </route>
+
+ <route startupOrder="9">
+ <from uri="direct:bar"/>
+ <to uri="seda:bar"/>
+ </route>
+
+ <route startupOrder="5">
+ <from uri="seda:bar"/>
+ <to uri="mock:other"/>
+ </route>
+
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml?rev=821383&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml Sat Oct 3 18:19:14 2009
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+ <route startupOrder="2">
+ <from uri="direct:start"/>
+ <to uri="seda:foo"/>
+ </route>
+
+ <route startupOrder="1">
+ <from uri="seda:foo"/>
+ <to uri="mock:result"/>
+ </route>
+
+ <route startupOrder="9">
+ <from uri="direct:bar"/>
+ <to uri="seda:bar"/>
+ </route>
+
+ <route startupOrder="5">
+ <from uri="seda:bar"/>
+ <to uri="mock:other"/>
+ </route>
+
+ <route>
+ <!-- has no startup order then it should be last -->
+ <from uri="direct:default"/>
+ <to uri="mock:deafult"/>
+ </route>
+
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/RouteStartupOrderWithDefaultTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml