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 2011/04/25 10:56:36 UTC
svn commit: r1096434 - in /camel/trunk/components/camel-scala: ./
src/main/scala/org/apache/camel/scala/dsl/
src/main/scala/org/apache/camel/scala/dsl/builder/
src/test/scala/org/apache/camel/scala/dsl/
src/test/scala/org/apache/camel/scala/dsl/builder/
Author: davsclaus
Date: Mon Apr 25 08:56:36 2011
New Revision: 1096434
URL: http://svn.apache.org/viewvc?rev=1096434&view=rev
Log:
CAMEL-463: Polished. Added id and routeId to scala DSL.
Added:
camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/IdTest.scala
camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RouteIdTest.scala
- copied, changed from r1096424, camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala
Modified:
camel/trunk/components/camel-scala/pom.xml
camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala
camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineTest.scala
camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SValidateTest.scala
camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala
Modified: camel/trunk/components/camel-scala/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/pom.xml?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/pom.xml (original)
+++ camel/trunk/components/camel-scala/pom.xml Mon Apr 25 08:56:36 2011
@@ -33,43 +33,6 @@
<camel.osgi.export.pkg>org.apache.camel.scala.*</camel.osgi.export.pkg>
</properties>
- <build>
- <sourceDirectory>src/main/scala</sourceDirectory>
- <testSourceDirectory>src/test/scala</testSourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.scala-tools</groupId>
- <artifactId>maven-scala-plugin</artifactId>
- <version>${scala-plugin-version}</version>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <projectnatures>
- <projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
- <projectnature>org.eclipse.jdt.core.javanature</projectnature>
- </projectnatures>
- <buildcommands>
- <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
- </buildcommands>
- <classpathContainers>
- <classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>
- <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
- </classpathContainers>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -129,4 +92,44 @@
</dependency>
</dependencies>
+ <build>
+ <sourceDirectory>src/main/scala</sourceDirectory>
+ <testSourceDirectory>src/test/scala</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>${scala-plugin-version}</version>
+ <configuration>
+ <args><arg>-deprecation</arg></args>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <projectnatures>
+ <projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
+ <projectnature>org.eclipse.jdt.core.javanature</projectnature>
+ </projectnatures>
+ <buildcommands>
+ <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
+ </buildcommands>
+ <classpathContainers>
+ <classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>
+ <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+ </classpathContainers>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Modified: camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala (original)
+++ camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala Mon Apr 25 08:56:36 2011
@@ -47,6 +47,7 @@ trait DSL {
def handle[E](block: => Unit)(implicit manifest: Manifest[E]) : SOnExceptionDefinition
+ def id(id : String): DSL
def idempotentconsumer(expression: Exchange => Any): SIdempotentConsumerDefinition
def inOnly(): DSL with Block
def inOut(): DSL with Block
Modified: camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala (original)
+++ camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala Mon Apr 25 08:56:36 2011
@@ -18,96 +18,78 @@ package org.apache.camel
package scala
package dsl
-import org.apache.camel.model.DataFormatDefinition
-import org.apache.camel.builder.PredicateBuilder.toPredicate
-import org.apache.camel.{Predicate, Exchange}
-
+import org.apache.camel.Exchange
import org.apache.camel.model._
import org.apache.camel.spi.Policy
-
-
import org.apache.camel.processor.aggregate.AggregationStrategy
-
import org.apache.camel.scala.dsl.builder.RouteBuilder
+
import reflect.Manifest
import java.lang.String
import java.util.Comparator
abstract class SAbstractDefinition[P <: ProcessorDefinition[_]] extends DSL with Wrapper[P] with Block {
- val target : P
+ val target: P
val unwrap = target
implicit val builder: RouteBuilder
+
implicit def expressionBuilder(expression: Exchange => Any) = new ScalaExpression(expression)
+
implicit def predicateBuilder(predicate: Exchange => Any) = new ScalaPredicate(predicate)
-
- def -->(uris: String*) = to(uris:_*)
- def to(uris: String*) = {
- uris.length match {
- case 1 => target.to(uris(0))
- case _ => {
- val multi = multicast
- uris.foreach(multi.to(_))
- }
- }
- this
- }
-
- def when(filter: Exchange => Any) : DSL with Block = SChoiceDefinition(target.choice).when(filter)
-
- def as[Target](toType: Class[Target]) = wrap(target.convertBodyTo(toType))
- def attempt : STryDefinition = STryDefinition(target.doTry)
-
- def split(expression: Exchange => Any) = SSplitDefinition(target.split(expression))
-
def apply(block: => Unit) = {
builder.build(this, block)
this
}
+ /**
+ * Helper method to return this Scala type instead of creating another wrapper type for the processor
+ */
+ def wrap(block: => Unit): SAbstractDefinition[_] = {
+ block
+ this
+ }
+
+ // EIPs
+ //-----------------------------------------------------------------
+
+ def aggregate(expression: Exchange => Any, strategy: AggregationStrategy) = SAggregateDefinition(target.aggregate(expression, strategy))
+ def as[Target](toType: Class[Target]) = wrap(target.convertBodyTo(toType))
+ def attempt: STryDefinition = STryDefinition(target.doTry)
+
def bean(bean: Any) = bean match {
case cls: Class[_] => wrap(target.bean(cls))
case ref: String => wrap(target.beanRef(ref))
case obj: Any => wrap(target.bean(obj))
}
-
+
def choice = SChoiceDefinition(target.choice)
-
+
+ def delay(period: Period) = SDelayDefinition(target.delay(period.milliseconds))
+ def dynamicRouter(expression: Exchange => Any) = wrap(target.dynamicRouter(expression))
+
def enrich(uri: String, strategy: AggregationStrategy) = wrap(target.enrich(uri, strategy))
def filter(predicate: Exchange => Any) = SFilterDefinition(target.filter(predicateBuilder(predicate)))
-
- def otherwise : SChoiceDefinition =
- throw new Exception("otherwise is only supported in a choice block or after a when statement")
def handle[E](block: => Unit)(implicit manifest: Manifest[E]) = SOnExceptionDefinition(target.onException(manifest.erasure)).apply(block)
-
+
+ def id(id : String) = wrap(target.id(id))
def idempotentconsumer(expression: Exchange => Any) = SIdempotentConsumerDefinition(target.idempotentConsumer(expression, null))
-
def inOnly = wrap(target.inOnly)
def inOut = wrap(target.inOut)
+ def loadbalance = SLoadBalanceDefinition(target.loadBalance)
def log(message: String) = wrap(target.log(message))
def log(level: LoggingLevel, message: String) = wrap(target.log(level, message))
def log(level: LoggingLevel, logName: String, message: String) = wrap(target.log(level, logName, message))
-
def loop(expression: Exchange => Any) = SLoopDefinition(target.loop(expression))
-
+
def marshal(format: DataFormatDefinition) = wrap(target.marshal(format))
-
def multicast = SMulticastDefinition(target.multicast)
-
- def process(function: Exchange => Unit) = wrap(target.process(new ScalaProcessor(function)))
- def process(processor: Processor) = wrap(target.process(processor))
-
- def throttle(frequency: Frequency) = SThrottleDefinition(target.throttle(frequency.count).timePeriodMillis(frequency.period.milliseconds))
-
- def loadbalance = SLoadBalanceDefinition(target.loadBalance)
-
- def delay(period: Period) = SDelayDefinition(target.delay(period.milliseconds))
-
- def onCompletion : SOnCompletionDefinition = {
+
+ def onCompletion: SOnCompletionDefinition = {
var completion = SOnCompletionDefinition(target.onCompletion)
// let's end the block in the Java DSL, we have a better way of handling blocks here
completion.target.end
@@ -119,59 +101,55 @@ abstract class SAbstractDefinition[P <:
config.configure(completion)
completion
}
+ def otherwise: SChoiceDefinition = throw new Exception("otherwise is only supported in a choice block or after a when statement")
def pipeline = SPipelineDefinition(target.pipeline)
-
def policy(policy: Policy) = wrap(target.policy(policy))
-
- def pollEnrich(uri: String, strategy: AggregationStrategy = null, timeout: Long = 0) =
+ def pollEnrich(uri: String, strategy: AggregationStrategy = null, timeout: Long = 0) =
wrap(target.pollEnrich(uri, timeout, strategy))
+ def process(function: Exchange => Unit) = wrap(target.process(new ScalaProcessor(function)))
+ def process(processor: Processor) = wrap(target.process(processor))
def recipients(expression: Exchange => Any) = wrap(target.recipientList(expression))
-
def resequence(expression: Exchange => Any) = SResequenceDefinition(target.resequence(expression))
-
def rollback = wrap(target.rollback)
-
+ def routeId(routeId: String) = wrap(target.routeId(routeId))
def routingSlip(header: String) = wrap(target.routingSlip(header))
def routingSlip(header: String, separator: String) = wrap(target.routingSlip(header, separator))
def routingSlip(expression: Exchange => Any) = wrap(target.routingSlip(expression))
- def sort[T](expression: (Exchange) => Any, comparator: Comparator[T] = null) = wrap(target.sort(expression, comparator))
-
- def dynamicRouter(expression: Exchange => Any) = wrap(target.dynamicRouter(expression))
-
def setbody(expression: Exchange => Any) = wrap(target.setBody(expression))
-
def setfaultbody(expression: Exchange => Any) = wrap(target.setFaultBody(expression))
-
def setheader(name: String, expression: Exchange => Any) = wrap(target.setHeader(name, expression))
-
+ def sort[T](expression: (Exchange) => Any, comparator: Comparator[T] = null) = wrap(target.sort(expression, comparator))
+ def split(expression: Exchange => Any) = SSplitDefinition(target.split(expression))
def stop = wrap(target.stop)
def threads = SThreadsDefinition(target.threads)
-
+ def throttle(frequency: Frequency) = SThrottleDefinition(target.throttle(frequency.count).timePeriodMillis(frequency.period.milliseconds))
def throwException(exception: Exception) = wrap(target.throwException(exception))
-
def transacted = wrap(target.transacted)
def transacted(ref: String) = wrap(target.transacted(ref))
-
def transform(expression: Exchange => Any) = wrap(target.transform(expression))
-
+
def unmarshal(format: DataFormatDefinition) = wrap(target.unmarshal(format))
def validate(expression: Exchange => Any) = wrap(target.validate(predicateBuilder(expression)))
+ def when(filter: Exchange => Any): DSL with Block = SChoiceDefinition(target.choice).when(filter)
def wiretap(uri: String) = wrap(target.wireTap(uri))
def wiretap(uri: String, expression: Exchange => Any) = wrap(target.wireTap(uri, expression))
-
- def aggregate(expression: Exchange => Any, strategy: AggregationStrategy) = SAggregateDefinition(target.aggregate(expression, strategy))
- /**
- * Helper method to return this Scala type instead of creating another wrapper type for the processor
- */
- def wrap(block : => Unit) : SAbstractDefinition[_] = {
- block
- this
+ def -->(uris: String*) = to(uris:_*)
+ def to(uris: String*) = {
+ uris.length match {
+ case 1 => target.to(uris(0))
+ case _ => {
+ val multi = multicast
+ uris.foreach(multi.to(_))
+ }
+ }
+ this
}
+
}
Modified: camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala (original)
+++ camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala Mon Apr 25 08:56:36 2011
@@ -18,6 +18,7 @@ package org.apache.camel
package scala.dsl
import org.apache.camel.model.OnExceptionDefinition
+import org.apache.camel.scala.ScalaProcessor
import org.apache.camel.scala.dsl.builder.RouteBuilder
import org.apache.camel.Exchange
Modified: camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala (original)
+++ camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala Mon Apr 25 08:56:36 2011
@@ -118,6 +118,7 @@ class RouteBuilder extends Preamble with
def filter(predicate: Exchange => Any) = stack.top.filter(predicate)
+ def id(id : String) = stack.top.id(id)
def idempotentconsumer(expression: Exchange => Any) = stack.top.idempotentconsumer(expression)
def inOnly = stack.top.inOnly
def inOut = stack.top.inOut
@@ -176,7 +177,6 @@ class RouteBuilder extends Preamble with
def threads = stack.top.threads
def throttle(frequency: Frequency) = stack.top.throttle(frequency)
def throwException(exception: Exception) = stack.top.throwException(exception)
- def to(uris: String*) = stack.top.to(uris: _*)
def transacted = stack.top.transacted
def transacted(uri: String) = stack.top.transacted
def transform(expression: Exchange => Any) = stack.top.transform(expression)
@@ -189,6 +189,7 @@ class RouteBuilder extends Preamble with
def wiretap(uri: String) = stack.top.wiretap(uri)
def wiretap(uri: String, expression: Exchange => Any) = stack.top.wiretap(uri, expression)
+ def to(uris: String*) = stack.top.to(uris: _*)
def -->(uris: String*) = stack.top.to(uris: _*)
}
Added: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/IdTest.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/IdTest.scala?rev=1096434&view=auto
==============================================================================
--- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/IdTest.scala (added)
+++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/IdTest.scala Mon Apr 25 08:56:36 2011
@@ -0,0 +1,61 @@
+/**
+ * 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
+package scala.dsl
+
+import builder.RouteBuilder
+import junit.framework.Assert.assertEquals
+
+class IdTest extends ScalaTestSupport {
+
+ def testRouteA = {
+ "mock:a" expect { _.expectedMessageCount(1)}
+ "mock:result" expect { _.expectedMessageCount(1)}
+
+ test {
+ "direct:a" ! "Hello World"
+ }
+
+ assertMockEndpointsSatisfied
+
+ assertEquals("foo", context.getRouteDefinition("route-a").getOutputs.get(0).getId())
+ }
+
+ def testRouteB = {
+ "mock:b" expect { _.expectedMessageCount(1)}
+ "mock:result" expect { _.expectedMessageCount(1)}
+
+ test {
+ "direct:b" ! "Hello World"
+ }
+
+ assertMockEndpointsSatisfied
+
+ assertEquals("bar", context.getRouteDefinition("route-b").getOutputs.get(0).getId())
+ }
+
+ val builder = new RouteBuilder {
+
+ // java DSL
+ from("direct:a").routeId("route-a").to("mock:a").id("foo").to("mock:result")
+
+ // scala DSL
+ "direct:b" routeId "route-b" to "mock:b" id "bar" to "mock:result"
+
+ }
+
+}
\ No newline at end of file
Modified: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineTest.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineTest.scala?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineTest.scala (original)
+++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineTest.scala Mon Apr 25 08:56:36 2011
@@ -50,14 +50,14 @@ class SPipelineTest extends ScalaTestSup
}
def testIncrementSimple = {
- "mock:result" expect { _.received(new Integer(4))}
+ "mock:result" expect { _.received(new java.lang.Integer(4))}
test {
"direct:a" ! 1
}
}
def testIncrementBlock = {
- "mock:result" expect { _.received(new Integer(4))}
+ "mock:result" expect { _.received(new java.lang.Integer(4))}
test {
"direct:b" ! 1
}
Copied: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RouteIdTest.scala (from r1096424, camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RouteIdTest.scala?p2=camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RouteIdTest.scala&p1=camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala&r1=1096424&r2=1096434&rev=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala (original)
+++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/RouteIdTest.scala Mon Apr 25 08:56:36 2011
@@ -14,39 +14,46 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.scala.dsl.builder;
-
-import org.apache.camel.scala.dsl.Wrapper
-import org.apache.camel.scala.test.{Person,Adult}
-import junit.framework.TestCase
-import junit.framework.Assert._
-
-class RouteBuilderUnwrapTest extends TestCase {
-
- def builder = new RouteBuilder {
-
- val person = new PersonWrapper
-
- def testUnwrap = {
- //access the wrapper
- assertEquals("Apache Camel", person.vote)
-
- //unwrap when necessary
- assertTrue(person.canVote)
+package org.apache.camel
+package scala.dsl
+
+import builder.RouteBuilder
+import junit.framework.Assert.assertEquals
+
+class RouteIdTest extends ScalaTestSupport {
+
+ def testRouteA = {
+ "mock:a" expect { _.expectedMessageCount(1)}
+
+ test {
+ "direct:a" ! "Hello World"
+ }
+
+ assertMockEndpointsSatisfied
+
+ assertEquals("route-a", context.getRouteDefinitions.get(0).getId());
+ }
+
+ def testRouteB = {
+ "mock:b" expect { _.expectedMessageCount(1)}
+
+ test {
+ "direct:b" ! "Hello World"
}
-
+
+ assertMockEndpointsSatisfied
+
+ assertEquals("route-b", context.getRouteDefinitions.get(1).getId());
}
-
- def testUnwrapWhenNecessary() = builder.testUnwrap
-
- class PersonWrapper extends Wrapper[Person] {
-
- val person = new Adult("Gert")
- val unwrap = person
-
- def vote = "Apache Camel"
-
+ val builder = new RouteBuilder {
+
+ // java DSL
+ from("direct:a").routeId("route-a").to("mock:a")
+
+ // scala DSL
+ "direct:b" routeId "route-b" to "mock:b"
+
}
-
-}
+
+}
\ No newline at end of file
Modified: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SValidateTest.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SValidateTest.scala?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SValidateTest.scala (original)
+++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SValidateTest.scala Mon Apr 25 08:56:36 2011
@@ -42,7 +42,7 @@ class SValidateSimpleTest extends Valida
assertIsInstanceOf(classOf[PredicateValidationException], e.getCause())
// as the Expression could be different between the DSL and simple language, here we just check part of the message
assertTrue("Get a wrong exception message",
- e.getCause().getMessage().startsWith("Validation failed for Predicate[org.apache.camel.scala.dsl.ScalaPredicate"));
+ e.getCause().getMessage().startsWith("Validation failed for Predicate[org.apache.camel.scala.ScalaPredicate"));
assertTrue("Get a wrong exception message",
e.getCause().getMessage().endsWith("Exchange[Message: 1.1.2010]"));
}
@@ -74,7 +74,7 @@ class SValidateRegExpTest extends Valida
assertIsInstanceOf(classOf[PredicateValidationException], e.getCause())
// as the Expression could be different between the DSL and simple language, here we just check part of the message
assertTrue("Get a wrong exception message",
- e.getCause().getMessage().startsWith("Validation failed for Predicate[org.apache.camel.scala.dsl.ScalaPredicate"));
+ e.getCause().getMessage().startsWith("Validation failed for Predicate[org.apache.camel.scala.ScalaPredicate"));
assertTrue("Get a wrong exception message",
e.getCause().getMessage().endsWith("Exchange[Message: 1.1.2010]"));
}
Modified: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala?rev=1096434&r1=1096433&r2=1096434&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala (original)
+++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/builder/RouteBuilderUnwrapTest.scala Mon Apr 25 08:56:36 2011
@@ -16,7 +16,7 @@
*/
package org.apache.camel.scala.dsl.builder;
-import org.apache.camel.scala.dsl.Wrapper
+import org.apache.camel.scala.Wrapper
import org.apache.camel.scala.test.{Person,Adult}
import junit.framework.TestCase
import junit.framework.Assert._