Author: ningjiang Date: Fri Jul 15 02:59:40 2011 New Revision: 1146943 URL: http://svn.apache.org/viewvc?rev=1146943&view=rev Log: CAMEL-4229 Added the wrap methods for template, consumer and context in org.apache.camel.test.junit4.CamelContextSupport
Added: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/CamelTestSupportTest.scala Modified: camel/trunk/components/camel-scala/pom.xml camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java Modified: camel/trunk/components/camel-scala/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/pom.xml?rev=1146943&r1=1146942&r2=1146943&view=diff ============================================================================== --- camel/trunk/components/camel-scala/pom.xml (original) +++ camel/trunk/components/camel-scala/pom.xml Fri Jul 15 02:59:40 2011 @@ -79,6 +79,11 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> Added: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/CamelTestSupportTest.scala URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/CamelTestSupportTest.scala?rev=1146943&view=auto ============================================================================== --- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/CamelTestSupportTest.scala (added) +++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/CamelTestSupportTest.scala Fri Jul 15 02:59:40 2011 @@ -0,0 +1,42 @@ +/** + * 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.scala + +import org.apache.camel.test.junit4.CamelTestSupport +import org.apache.camel.component.mock.MockEndpoint +import org.apache.camel.scala.dsl.builder.{RouteBuilder,RouteBuilderSupport} +import org.junit.Test + +class CamelTestSupportTest extends CamelTestSupport with RouteBuilderSupport { + + override protected def createRouteBuilder = builder + + @Test + def testValidRequest{ + val mock = getMockEndpoint("mock:output") + + val message = "HelloWorld" + mock.expectedBodiesReceived(message) + template.sendBody("direct:start", message) + assertMockEndpointsSatisfied + } + + val builder = new RouteBuilder { + "direct:start" to "mock:output" + } + +} \ No newline at end of file Modified: camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java?rev=1146943&r1=1146942&r2=1146943&view=diff ============================================================================== --- camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java (original) +++ camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java Fri Jul 15 02:59:40 2011 @@ -117,6 +117,22 @@ public abstract class CamelTestSupport e public Service getCamelContextService() { return camelContextService; } + + public Service camelContextService() { + return camelContextService; + } + + public CamelContext context() { + return context; + } + + public ProducerTemplate template() { + return template; + } + + public ConsumerTemplate consumer() { + return consumer; + } /** * Allows a service to be registered a separate lifecycle service to start