Updated Branches: refs/heads/camel-2.11.x 41af3ef24 -> 4daaa2a7d refs/heads/master 663282939 -> e9b6cfbdb
CAMEL-6390: Added unit test Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1afb4fc1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1afb4fc1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1afb4fc1 Branch: refs/heads/master Commit: 1afb4fc1581d89a29a80d5722600375415446f67 Parents: 6632829 Author: Claus Ibsen <davscl...@apache.org> Authored: Sat May 25 09:29:25 2013 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat May 25 09:29:25 2013 +0200 ---------------------------------------------------------------------- .../seda/SedaSuspendConsumerStopRouteTest.java | 52 +++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/1afb4fc1/camel-core/src/test/java/org/apache/camel/component/seda/SedaSuspendConsumerStopRouteTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/component/seda/SedaSuspendConsumerStopRouteTest.java b/camel-core/src/test/java/org/apache/camel/component/seda/SedaSuspendConsumerStopRouteTest.java new file mode 100644 index 0000000..1225ff7 --- /dev/null +++ b/camel-core/src/test/java/org/apache/camel/component/seda/SedaSuspendConsumerStopRouteTest.java @@ -0,0 +1,52 @@ +/** + * 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.component.seda; + +import java.util.concurrent.TimeUnit; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.builder.RouteBuilder; + +public class SedaSuspendConsumerStopRouteTest extends ContextTestSupport { + + public void testSedaSuspendConsumerStopRoute() throws Exception { + getMockEndpoint("mock:result").expectedMessageCount(1); + + template.sendBody("seda:start", "Hello World"); + + assertMockEndpointsSatisfied(); + + SedaEndpoint seda = context.getEndpoint("seda:start", SedaEndpoint.class); + seda.getConsumers().iterator().next().suspend(); + + boolean stopped = context.stopRoute("foo", 2, TimeUnit.SECONDS, true); + assertTrue("Route should be stopped", stopped); + + assertTrue("Route should be stopped", context.getRouteStatus("foo").isStopped()); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("seda:start").routeId("foo") + .to("mock:result"); + } + }; + } +}