Author: gertv
Date: Tue Jul 29 00:15:41 2008
New Revision: 680636
URL: http://svn.apache.org/viewvc?rev=680636&view=rev
Log:
CAMEL-463: Tests for embedding beans in Scala DSL blocks
Added:
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BlockBeanTest.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/test/CartoonService.scala
Modified:
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SimpleBeanTest.scala
Added:
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BlockBeanTest.scala
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BlockBeanTest.scala?rev=680636&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BlockBeanTest.scala
(added)
+++
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BlockBeanTest.scala
Tue Jul 29 00:15:41 2008
@@ -0,0 +1,49 @@
+/**
+ * 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.dsl.builder.RouteBuilder
+import org.apache.camel.scala.test.CartoonService
+
+/**
+ * Test for bean support in Scala DSL routes with explicit blocks
+ */
+class BlockBeanTest extends SimpleBeanTest {
+
+ override val builder = new RouteBuilder {
+ //START SNIPPET: object
+ "direct:a" ==> {
+ bean(new CartoonService())
+ to("mock:a")
+ }
+ //END SNIPPET: object
+
+ //START SNIPPET: class
+ "direct:b" ==> {
+ bean(classOf[CartoonService])
+ to("mock:b")
+ }
+ //END SNIPPET: class}
+
+ //START SNIPPET: ref
+ "direct:c" ==> {
+ bean("CartoonService")
+ to("mock:c")
+ }
+ //END SNIPPET: ref}
+ }
+}
Modified:
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SimpleBeanTest.scala
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SimpleBeanTest.scala?rev=680636&r1=680635&r2=680636&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SimpleBeanTest.scala
(original)
+++
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SimpleBeanTest.scala
Tue Jul 29 00:15:41 2008
@@ -17,6 +17,7 @@
package org.apache.camel.scala.dsl;
import scala.dsl.builder.RouteBuilder
+import org.apache.camel.scala.test.CartoonService
/**
* Test for bean support in simple Scala DSL expressions
@@ -65,16 +66,4 @@
}
}
-/**
- * A simple CartoonService
- */
-class CartoonService {
-
- def determineAppropriateTransport(person: String) = person match {
- case "Lucky Luke" => person + " rides Jolly Jumper"
- case "Batman" => person + " drives the batmobile"
- case "Aladin" => person + " flies a carpet"
- }
-}
-
Added:
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/test/CartoonService.scala
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/test/CartoonService.scala?rev=680636&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/test/CartoonService.scala
(added)
+++
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/test/CartoonService.scala
Tue Jul 29 00:15:41 2008
@@ -0,0 +1,32 @@
+/**
+ * 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.test
+
+/**
+ * A simple business service for working with cartoons and cartoon characters
+ */
+class CartoonService {
+
+ /**
+ * This method will determine the most appropriate transport for a given
person
+ */
+ def determineAppropriateTransport(person: String) = person match {
+ case "Lucky Luke" => person + " rides Jolly Jumper"
+ case "Batman" => person + " drives the batmobile"
+ case "Aladin" => person + " flies a carpet"
+ }
+}