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 2008/05/07 06:17:33 UTC
svn commit: r653987 - in /activemq/camel/trunk/components/camel-scala: ./
src/main/scala/org/apache/camel/scala/
src/main/scala/org/apache/camel/scala/builder/
src/main/scala/org/apache/camel/scala/dsl/ src/test/resources/
src/test/resources/org/ src/t...
Author: davsclaus
Date: Tue May 6 21:17:30 2008
New Revision: 653987
URL: http://svn.apache.org/viewvc?rev=653987&view=rev
Log:
CAMEL-463: Applied patch 3 with thanks to Gert
Added:
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SMulticastType.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaProcessor.scala
activemq/camel/trunk/components/camel-scala/src/test/resources/
activemq/camel/trunk/components/camel-scala/src/test/resources/org/
activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/
activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/
activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/scala/
activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/scala/dsl/
activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/scala/dsl/enricher.vm
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentEnricherTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExplicitMulticastTest.scala
Modified:
activemq/camel/trunk/components/camel-scala/pom.xml
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/builder/RouteBuilder.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaDsl.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/ScalaTestSupport.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BasicRouteBuilderTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentBasedRouterTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/FilterRouteBuilderTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineAndMulticastTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineRouteBuilderTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RecipientListRouteTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SplitterRouteBuilderTest.scala
Modified: activemq/camel/trunk/components/camel-scala/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/pom.xml?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/pom.xml (original)
+++ activemq/camel/trunk/components/camel-scala/pom.xml Tue May 6 21:17:30 2008
@@ -13,6 +13,7 @@
<properties>
<camel.osgi.export.pkg>org.apache.camel.scala.*</camel.osgi.export.pkg>
+ <scala-version>2.7.1</scala-version>
</properties>
<repositories>
@@ -46,7 +47,7 @@
</execution>
</executions>
<configuration>
- <scalaVersion>2.7.0</scalaVersion>
+ <scalaVersion>${scala-version}</scalaVersion>
</configuration>
</plugin>
<plugin>
@@ -77,7 +78,7 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
- <version>2.7.0</version>
+ <version>${scala-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
@@ -93,6 +94,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-velocity</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala Tue May 6 21:17:30 2008
@@ -24,6 +24,8 @@
class RichExchange(val exchange : Exchange) {
def in : Any = exchange.getIn().getBody()
+
+ def in_=(message: Any) = exchange.getIn().setBody(message)
def in(header:String) : Any = exchange.getIn().getHeader(header)
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/builder/RouteBuilder.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/builder/RouteBuilder.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/builder/RouteBuilder.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/builder/RouteBuilder.scala Tue May 6 21:17:30 2008
@@ -58,5 +58,7 @@
def recipients(expression: Exchange => Any) = stack.top.recipients(expression)
def splitter(expression: Exchange => Any) = stack.top.splitter(expression)
def otherwise = stack.top.otherwise
+ def multicast = stack.top.multicast
+ def process(function: Exchange => Unit) = stack.top.process(function)
-}
\ No newline at end of file
+}
Added: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SMulticastType.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SMulticastType.scala?rev=653987&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SMulticastType.scala (added)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SMulticastType.scala Tue May 6 21:17:30 2008
@@ -0,0 +1,26 @@
+/**
+ * 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.dsl;
+
+import org.apache.camel.model.MulticastType
+import org.apache.camel.scala.builder.RouteBuilder
+
+class SMulticastType(val target: MulticastType)(implicit val builder: RouteBuilder) extends ScalaDsl with Wrapper[MulticastType] {
+
+ val unwrap = target
+
+}
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaDsl.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaDsl.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaDsl.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaDsl.scala Tue May 6 21:17:30 2008
@@ -63,5 +63,11 @@
def otherwise : SChoiceType =
throw new Exception("otherwise is only supported in a choice block or after a when statement")
+ def multicast = new SMulticastType(target.multicast)
+
+ def process(function: Exchange => Unit) = {
+ target.process(new ScalaProcessor(function))
+ this
+ }
}
Added: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaProcessor.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaProcessor.scala?rev=653987&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaProcessor.scala (added)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/ScalaProcessor.scala Tue May 6 21:17:30 2008
@@ -0,0 +1,26 @@
+/**
+ * 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.dsl;
+
+/**
+ * Scala implementation for an Apache Camel Processor
+ */
+class ScalaProcessor(val function: Exchange => Any) extends Processor {
+
+ def process(exchange: Exchange) = function(exchange)
+
+}
Added: activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/scala/dsl/enricher.vm
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/scala/dsl/enricher.vm?rev=653987&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/scala/dsl/enricher.vm (added)
+++ activemq/camel/trunk/components/camel-scala/src/test/resources/org/apache/camel/scala/dsl/enricher.vm Tue May 6 21:17:30 2008
@@ -0,0 +1,17 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+<hello>${in.body}</hello>
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/ScalaTestSupport.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/ScalaTestSupport.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/ScalaTestSupport.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/ScalaTestSupport.scala Tue May 6 21:17:30 2008
@@ -18,11 +18,12 @@
import org.apache.camel.ContextTestSupport
import org.apache.camel.component.mock.MockEndpoint
-import builder.RouteBuilderSupport
+import builder.{RouteBuilder,RouteBuilderSupport}
import org.apache.camel.scala.dsl._
+import _root_.scala.List
abstract class ScalaTestSupport extends ContextTestSupport with RouteBuilderSupport with Preamble {
-
+
implicit def stringToUri(uri:String) = new RichTestUri(uri, this)
implicit def mockWrapper(endpoint: MockEndpoint) = new RichMockEndpoint(endpoint)
@@ -37,5 +38,9 @@
println(exchange)
exchange
}
+
+ val builder : RouteBuilder
+
+ override protected def createRouteBuilder = builder.print
}
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BasicRouteBuilderTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BasicRouteBuilderTest.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BasicRouteBuilderTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BasicRouteBuilderTest.scala Tue May 6 21:17:30 2008
@@ -32,7 +32,7 @@
to assert
}
- override protected def createRouteBuilder() = new MyRouteBuilder
+ val builder = new MyRouteBuilder
//START SNIPPET: basic
class MyRouteBuilder extends RouteBuilder {
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentBasedRouterTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentBasedRouterTest.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentBasedRouterTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentBasedRouterTest.scala Tue May 6 21:17:30 2008
@@ -34,21 +34,20 @@
"mock:french" assert()
}
- override protected def createRouteBuilder() =
- new RouteBuilder {
- //START SNIPPET: cbr
- "direct:a" ==> {
- to ("mock:polyglot")
- choice {
- when (_.in == "<hello/>") to ("mock:english")
- when (_.in == "<hallo/>") {
- to ("mock:dutch")
- to ("mock:german")
- }
- otherwise to ("mock:french")
+ val builder = new RouteBuilder {
+ //START SNIPPET: cbr
+ "direct:a" ==> {
+ to ("mock:polyglot")
+ choice {
+ when (_.in == "<hello/>") to ("mock:english")
+ when (_.in == "<hallo/>") {
+ to ("mock:dutch")
+ to ("mock:german")
}
+ otherwise to ("mock:french")
}
- //END SNIPPET: cbr
- }.print
+ }
+ //END SNIPPET: cbr
+ }
}
Added: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentEnricherTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentEnricherTest.scala?rev=653987&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentEnricherTest.scala (added)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentEnricherTest.scala Tue May 6 21:17:30 2008
@@ -0,0 +1,70 @@
+/**
+ * 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.dsl;
+
+import scala.builder.RouteBuilder
+
+class ContentEnricherTest extends ScalaTestSupport {
+
+ def testContentEnricherBySimpleProcessor = {
+ "mock:a" expect { _.received ("James says hello",
+ "Hadrian says hello",
+ "Willem says hello")}
+ "direct:a" ! ("James", "Hadrian", "Willem")
+ "mock:a" assert()
+ }
+
+ def testContentEnricherByProcessorDef = {
+ "mock:b" expect { _.received ("hello from the UK",
+ "hallo vanuit Belgiƫ",
+ "bonjour de la douce France")}
+ "direct:b" ! ("hello", "hallo", "bonjour")
+ "mock:b" assert()
+ }
+
+ def testContentEnricherWithVelocity = {
+ "mock:c" expect { _.received ("<hello>James</hello>",
+ "<hello>Hadrian</hello>",
+ "<hello>Willem</hello>")}
+ "direct:c" ! ("James", "Hadrian", "Willem")
+ "mock:c" assert()
+ }
+
+ val builder = new RouteBuilder {
+ // START SNIPPET: simple
+ "direct:a" process(_.in += " says hello") to ("mock:a")
+ // END SNIPPET: simple
+
+ // START SNIPPET: def
+ "direct:b" process(myProcessor) to ("mock:b")
+
+ def myProcessor(exchange: Exchange) = {
+ exchange.in match {
+ case "hello" => exchange.in = "hello from the UK"
+ case "hallo" => exchange.in = "hallo vanuit Belgiƫ"
+ case "bonjour" => exchange.in = "bonjour de la douce France"
+ }
+ }
+ // END SNIPPET: def
+
+ // START SNIPPET: velocity
+ "direct:c" to ("velocity:org/apache/camel/scala/dsl/enricher.vm") to ("mock:c")
+ // END SNIPPET: velocity
+
+ }
+
+}
Added: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExplicitMulticastTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExplicitMulticastTest.scala?rev=653987&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExplicitMulticastTest.scala (added)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExplicitMulticastTest.scala Tue May 6 21:17:30 2008
@@ -0,0 +1,45 @@
+/**
+ * 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.dsl;
+
+import scala.builder.RouteBuilder
+
+class ExplicitMulticastTest extends ScalaTestSupport {
+
+ def testExplicitMulticast = {
+ "mock:a" expect { _.count = 3 }
+ "mock:b" expect { _.count = 3 }
+ "mock:c" expect { _.count = 3 }
+ "direct:a" ! ("<hello/>", "<hallo/>", "<bonjour/>")
+ "mock:a" assert()
+ "mock:b" assert()
+ "mock:c" assert()
+ }
+
+ val builder = new RouteBuilder {
+ // START SNIPPET: multicast
+ "direct:a" ==> {
+ multicast {
+ to ("mock:a")
+ to ("mock:b")
+ to ("mock:c")
+ }
+ }
+ // END SNIPPET: multicast
+ }
+
+}
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/FilterRouteBuilderTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/FilterRouteBuilderTest.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/FilterRouteBuilderTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/FilterRouteBuilderTest.scala Tue May 6 21:17:30 2008
@@ -38,23 +38,22 @@
"mock:e" assert()
}
- override protected def createRouteBuilder() =
- new RouteBuilder {
- //START SNIPPET: simple
- "direct:a" when(_.in == "<hello/>") to("mock:a")
- //END SNIPPET: simple
+ val builder = new RouteBuilder {
+ //START SNIPPET: simple
+ "direct:a" when(_.in == "<hello/>") to("mock:a")
+ //END SNIPPET: simple
- //START SNIPPET: alternatives
- "direct:b" ==> {
- when(_.in == "<hallo/>") {
- --> ("mock:b")
- to ("mock:c")
- } otherwise {
- to ("mock:e")
- }
- to ("mock:d")
+ //START SNIPPET: alternatives
+ "direct:b" ==> {
+ when(_.in == "<hallo/>") {
+ --> ("mock:b")
+ to ("mock:c")
+ } otherwise {
+ to ("mock:e")
}
- //END SNIPPET: alternatives
- }.print
+ to ("mock:d")
+ }
+ //END SNIPPET: alternatives
+ }
}
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineAndMulticastTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineAndMulticastTest.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineAndMulticastTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineAndMulticastTest.scala Tue May 6 21:17:30 2008
@@ -38,23 +38,22 @@
}
- override protected def createRouteBuilder() =
- new RouteBuilder {
- // START SNIPPET: simple
- "direct:a" --> ("mock:a", "mock:b") --> "mock:c"
- "direct:d" to ("mock:d", "mock:e") to "mock:f"
- // END SNIPPET: simple
+ val builder = new RouteBuilder {
+ // START SNIPPET: simple
+ "direct:a" --> ("mock:a", "mock:b") --> "mock:c"
+ "direct:d" to ("mock:d", "mock:e") to "mock:f"
+ // END SNIPPET: simple
- // START SNIPPET: block
- "direct:g" ==> {
- --> ("mock:g", "mock:h")
- --> ("mock:i")
- }
- "direct:j" ==> {
- to ("mock:j", "mock:k")
- to ("mock:l")
- }
- // END SNIPPET: block
- }.print
+ // START SNIPPET: block
+ "direct:g" ==> {
+ --> ("mock:g", "mock:h")
+ --> ("mock:i")
+ }
+ "direct:j" ==> {
+ to ("mock:j", "mock:k")
+ to ("mock:l")
+ }
+ // END SNIPPET: block
+ }
}
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineRouteBuilderTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineRouteBuilderTest.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineRouteBuilderTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineRouteBuilderTest.scala Tue May 6 21:17:30 2008
@@ -35,24 +35,23 @@
}
}
- override protected def createRouteBuilder() =
- new RouteBuilder {
- //START SNIPPET: simple
- "direct:a" --> "mock:a" --> "mock:b"
- "direct:c" to "mock:c" to "mock:d"
- //END SNIPPET: simple
+ val builder = new RouteBuilder {
+ //START SNIPPET: simple
+ "direct:a" --> "mock:a" --> "mock:b"
+ "direct:c" to "mock:c" to "mock:d"
+ //END SNIPPET: simple
- //START SNIPPET: block
- "direct:e" ==> {
- --> ("mock:e")
- --> ("mock:f")
- }
+ //START SNIPPET: block
+ "direct:e" ==> {
+ --> ("mock:e")
+ --> ("mock:f")
+ }
- "direct:g" ==> {
- to ("mock:g")
- to ("mock:h")
- }
- //END SNIPPET: block
- }.print
+ "direct:g" ==> {
+ to ("mock:g")
+ to ("mock:h")
+ }
+ //END SNIPPET: block
+ }
}
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RecipientListRouteTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RecipientListRouteTest.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RecipientListRouteTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RecipientListRouteTest.scala Tue May 6 21:17:30 2008
@@ -40,27 +40,25 @@
"mock:c" assert()
"mock:d" assert()
}
-
- override protected def createRouteBuilder() =
- new RouteBuilder with languages.JXPath {
- //START SNIPPET: simple
- "direct:a" recipients(_.in(classOf[String]).substring(21))
- //END SNIPPET: simple
+
+ val builder = new RouteBuilder with languages.JXPath {
+ //START SNIPPET: simple
+ "direct:a" recipients(_.in(classOf[String]).substring(21))
+ //END SNIPPET: simple
- //START SNIPPET: pattern
- "direct:b" recipients(_.in match {
- case Toddler(_) => "mock:playgarden"
- case _ => "mock:work"
- })
- //END SNIPPET: pattern
+ //START SNIPPET: pattern
+ "direct:b" recipients(_.in match {
+ case Toddler(_) => "mock:playgarden"
+ case _ => "mock:work"
+ })
+ //END SNIPPET: pattern
- //START SNIPPET: block
- "direct:c" ==> {
- to("mock:c")
- recipients(_.jxpath("./in/body/destination"))
- }
- //END SNIPPET: block
- }.print
-
+ //START SNIPPET: block
+ "direct:c" ==> {
+ to("mock:c")
+ recipients(_.jxpath("./in/body/destination"))
+ }
+ //END SNIPPET: block
+ }
}
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SplitterRouteBuilderTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SplitterRouteBuilderTest.scala?rev=653987&r1=653986&r2=653987&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SplitterRouteBuilderTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SplitterRouteBuilderTest.scala Tue May 6 21:17:30 2008
@@ -39,7 +39,7 @@
"mock:c" assert()
}
- override protected def createRouteBuilder() =
+ val builder =
//START SNIPPET: xpath
new RouteBuilder with XPath {
//END SNIPPET: xpath