You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/04/05 09:35:50 UTC
svn commit: r645039 - in /activemq/camel/trunk/components:
camel-http/src/main/java/org/apache/camel/component/http/
camel-scala/src/main/scala/org/apache/camel/scala/dsl/
camel-scala/src/test/scala/org/apache/camel/scala/
camel-scala/src/test/scala/or...
Author: ningjiang
Date: Sat Apr 5 00:35:47 2008
New Revision: 645039
URL: http://svn.apache.org/viewvc?rev=645039&view=rev
Log:
Added the Apache license header to the files in the camel-scala component
Modified:
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichChoice.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichExchange.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichProcessor.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichUriString.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilder.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilderSupport.scala
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/WhenPredicate.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichMockEndpoint.scala
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichTestUri.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
Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java Sat Apr 5 00:35:47 2008
@@ -37,7 +37,7 @@
public static final Set<String> DEFAULT_HEADERS_TO_IGNORE = new HashSet<String>(Arrays.asList(
"content-length", "content-type", HttpProducer.HTTP_RESPONSE_CODE.toLowerCase()));
private Set<String> ignoredHeaders = DEFAULT_HEADERS_TO_IGNORE;
- private boolean useReaderForPayload = false;
+ private boolean useReaderForPayload;
/**
* Writes the exchange to the servlet response
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichChoice.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichChoice.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichChoice.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichChoice.scala Sat Apr 5 00:35:47 2008
@@ -1,23 +1,39 @@
+/**
+ * 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.ChoiceType
class RichChoiceType(val choice: ChoiceType, val builder:RouteBuilder) {
-
+
def then(block: => Unit) : ChoiceType = {
builder.build(choice, block)
choice
}
-
+
def when(test: Exchange => Boolean)(block: => Unit) : ChoiceType = {
choice
}
-
+
def apply(block: => Unit) : RichChoiceType = {
builder.build(choice, block)
this
}
-
+
def to(uri: String) = {
choice.to(uri)
}
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichExchange.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichExchange.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichExchange.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichExchange.scala Sat Apr 5 00:35:47 2008
@@ -1,19 +1,35 @@
+/**
+ * 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.Exchange
class RichExchange(val exchange : Exchange) {
-
+
def in : Any = exchange.getIn().getBody()
def in(header:String) : Any = exchange.getIn().getHeader(header)
-
- def in(target:Class[Any]) : Any = exchange.getIn().getBody(target)
-
+
+ def in(target:Class[Any]) : Any = exchange.getIn().getBody(target)
+
def out : Any = exchange.getOut().getBody()
-
- def out(header:String) : Any = exchange.getOut().getHeader(header)
-
+
+ def out(header:String) : Any = exchange.getOut().getHeader(header)
+
def out_=(message:Any) = exchange.getOut().setBody(message)
-
+
}
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichProcessor.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichProcessor.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichProcessor.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichProcessor.scala Sat Apr 5 00:35:47 2008
@@ -1,9 +1,25 @@
+/**
+ * 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.ProcessorType
class RichProcessor(processor : ProcessorType[T] forSome {type T}) {
-
+
def -->(uri: String) = processor.to(uri)
-
+
}
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichUriString.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichUriString.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichUriString.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RichUriString.scala Sat Apr 5 00:35:47 2008
@@ -1,10 +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.FilterType
import org.apache.camel.model.ProcessorType
class RichUriString(uri:String, builder:RouteBuilder) {
-
+
def to(targets: String*) : ProcessorType[T] forSome {type T} = {
targets.length match {
case 1 => builder.from(uri).to(targets(0))
@@ -17,14 +33,14 @@
}
}
def -->(targets: String*) : ProcessorType[T] forSome {type T} = to(targets:_*)
-
+
def ==>(block: => Unit) = {
builder.build(builder.from(uri), block)
}
-
- def when(filter: Exchange => Boolean) : FilterType =
+
+ def when(filter: Exchange => Boolean) : FilterType =
builder.from(uri).filter(new WhenPredicate(filter))
-
-
+
+
}
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilder.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilder.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilder.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilder.scala Sat Apr 5 00:35:47 2008
@@ -1,3 +1,19 @@
+/**
+ * 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.ProcessorType
@@ -9,32 +25,32 @@
Scala RouteBuilder implementation
*/
class RouteBuilder {
-
+
val builder = new org.apache.camel.builder.RouteBuilder {
override def configure() = {}
}
-
- val stack = new Stack[ProcessorType[T] forSome {type T}];
-
+
+ val stack = new Stack[ProcessorType[T] forSome {type T}];
+
implicit def stringToUri(uri:String) : RichUriString = new RichUriString(uri, this)
- implicit def choiceWrapper(choice: ChoiceType) = new RichChoiceType(choice, this);
+ implicit def choiceWrapper(choice: ChoiceType) = new RichChoiceType(choice, this);
implicit def processorWrapper(processor: ProcessorType[T] forSome {type T}) = new RichProcessor(processor)
implicit def exchangeWrapper(exchange: Exchange) = new RichExchange(exchange)
-
+
def print() = {
println(builder)
this
}
-
+
def build(context: ProcessorType[T] forSome {type T}, block: => Unit) {
stack.push(context)
block
stack.pop()
}
-
+
def from(uri: String) = builder.from(uri)
-
- def -->(uris: String*) = to(uris:_*)
+
+ def -->(uris: String*) = to(uris:_*)
def to(uris: String*) = {
uris.length match {
case 1 => stack.top.to(uris(0))
@@ -42,22 +58,22 @@
val multicast = stack.top.multicast
for (uri <- uris) multicast.to(uri)
stack.top
- }
+ }
}
}
- var when = (filter: Exchange => Boolean) => {
+ var when = (filter: Exchange => Boolean) => {
val choice = stack.top match {
case c: ChoiceType => c
case _ => stack.top.choice()
}
new RichChoiceType(choice.when(new WhenPredicate(filter)), this) : RichChoiceType
}
-
+
def choice(block: => Unit) = {
build(stack.top.choice(), block)
}
-
+
def otherwise : ChoiceType = {
stack.top match {
case choice: ChoiceType => choice.otherwise
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilderSupport.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilderSupport.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilderSupport.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/RouteBuilderSupport.scala Sat Apr 5 00:35:47 2008
@@ -1,7 +1,23 @@
+/**
+ * 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;
trait RouteBuilderSupport {
implicit def scalaToJavaBuilder(scalaBuilder: org.apache.camel.scala.dsl.RouteBuilder) = scalaBuilder.builder
-
+
}
Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/WhenPredicate.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/WhenPredicate.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/WhenPredicate.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/WhenPredicate.scala Sat Apr 5 00:35:47 2008
@@ -1,13 +1,29 @@
+/**
+ * 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.Predicate
class WhenPredicate(function: Exchange => Boolean) extends Predicate[Exchange]{
-
+
override def matches(exchange: Exchange) = {
function(exchange)
}
-
+
override def assertMatches(text: String, exchange: Exchange) = {
if (!matches(exchange)) throw new AssertionError(text + " : " + exchange + " doesn't match Scala function")
}
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichMockEndpoint.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichMockEndpoint.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichMockEndpoint.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichMockEndpoint.scala Sat Apr 5 00:35:47 2008
@@ -1,9 +1,25 @@
+/**
+ * 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.component.mock.MockEndpoint
class RichMockEndpoint(endpoint: MockEndpoint) {
-
+
def received(messages: AnyRef*) {
val list = new java.util.ArrayList[AnyRef](messages.length)
messages.foreach(list.add(_))
@@ -11,4 +27,4 @@
}
}
-
+
Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichTestUri.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichTestUri.scala?rev=645039&r1=645038&r2=645039&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichTestUri.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/RichTestUri.scala Sat Apr 5 00:35:47 2008
@@ -1,20 +1,36 @@
+/**
+ * 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.component.mock.MockEndpoint
class RichTestUri(uri: String, support: ScalaTestSupport) {
-
+
def !(messages: Any*) = {
for (message <- messages) {
support.getTemplate().sendBody(uri, message)
}
}
-
+
def expect(block: MockEndpoint => Unit) = {
val mock = support.mock(uri)
- block(mock)
+ block(mock)
}
-
+
def assert() = support.mock(uri).assertIsSatisfied()
}
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=645039&r1=645038&r2=645039&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 Sat Apr 5 00:35:47 2008
@@ -1,3 +1,19 @@
+/**
+ * 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.ContextTestSupport
@@ -9,17 +25,17 @@
implicit def stringToUri(uri:String) = new RichTestUri(uri, this)
implicit def mockWrapper(endpoint: MockEndpoint) = new RichMockEndpoint(endpoint)
implicit def exchangeWrapper(exchange: Exchange[T] forSome {type T}) = new RichExchange(exchange)
-
+
def assert(uri: String) = getMockEndpoint(uri).assertIsSatisfied
-
+
protected[scala] def getTemplate() = template
-
+
protected[scala] def mock(uri: String) = getMockEndpoint(uri)
-
+
def in(message: Any) : Exchange = {
val exchange = createExchangeWithBody(message)
println(exchange)
exchange
}
-
+
}
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=645039&r1=645038&r2=645039&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 Sat Apr 5 00:35:47 2008
@@ -1,21 +1,37 @@
+/**
+ * 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.scala.ScalaTestSupport
class BasicRouteBuilderTest extends ScalaTestSupport {
-
+
def testBasicRouteArrowSyntax() = assertBasicRoute("direct:a", "mock:a")
def testBasicRouteTextSyntax() = assertBasicRoute("direct:b", "mock:b")
-
+
def assertBasicRoute(from: String, to: String) = {
to expect {
_.expectedMessageCount(1)
}
- from ! "<hello/>"
+ from ! "<hello/>"
to assert
}
-
- override protected def createRouteBuilder() =
+
+ override protected def createRouteBuilder() =
new RouteBuilder {
"direct:a" --> "mock:a"
"direct:b" to "mock:b"
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=645039&r1=645038&r2=645039&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 Sat Apr 5 00:35:47 2008
@@ -1,7 +1,23 @@
+/**
+ * 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;
class ContentBasedRouterTest extends ScalaTestSupport {
-
+
def testSimpleContentBasedRouter = {
"mock:a" expect {_.expectedMessageCount(3)}
"mock:b" expect {_.received("<hello/>")}
@@ -13,8 +29,8 @@
"mock:c" assert()
"mock:d" assert()
}
-
- override protected def createRouteBuilder() =
+
+ override protected def createRouteBuilder() =
new RouteBuilder {
"direct:a" ==> {
to ("mock:a")
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=645039&r1=645038&r2=645039&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 Sat Apr 5 00:35:47 2008
@@ -1,3 +1,19 @@
+/**
+ * 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;
class FilterRouteBuilderTest extends ScalaTestSupport {
@@ -7,7 +23,7 @@
"direct:a" ! ("<hello/>", "<hellos/>")
"mock:a" assert
}
-
+
def testFilterWithAlternatives() = {
"mock:b" expect {_.expectedMessageCount(1)}
"mock:b" expect {_.expectedMessageCount(1)}
@@ -21,11 +37,11 @@
"mock:e" assert()
"mock:f" assert()
}
-
- override protected def createRouteBuilder() =
+
+ override protected def createRouteBuilder() =
new RouteBuilder {
"direct:a" when(_.in == "<hello/>") to "mock:a"
-
+
"direct:b" ==> {
when(_.in == "<hello/>") then {
to ("mock:b")
@@ -36,7 +52,7 @@
} otherwise {
to ("mock:f")
}
- to ("mock:d")
+ to ("mock:d")
}
}.print
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=645039&r1=645038&r2=645039&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 Sat Apr 5 00:35:47 2008
@@ -1,26 +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.dsl;
class PipelineAndMulticastTest extends ScalaTestSupport {
-
+
def testArrowRoute = testRoute("direct:a", "mock:c", "mock:a", "mock:b")
def testToRoute = testRoute("direct:d", "mock:f", "mock:d", "mock:e")
def testArrowBlockRoute = testRoute("direct:g", "mock:i", "mock:g", "mock:h")
def testToBlockRoute = testRoute("direct:j", "mock:l", "mock:j", "mock:k")
-
+
def testRoute(from: String, end: String, multis: String*) = {
multis.foreach ( _.expect { _.received("<hello/>")})
end expect { _.received("<olleh/>")}
-
+
val exchange = in("<hello/>")
exchange.out = "<olleh/>"
getTemplate().send(from, exchange)
-
+
multis.foreach( _.assert())
end assert()
}
-
-
- override protected def createRouteBuilder() =
+
+
+ override protected def createRouteBuilder() =
new RouteBuilder {
"direct:a" --> ("mock:a", "mock:b") --> "mock:c"
"direct:d" to ("mock:d", "mock:e") to "mock:f"
@@ -31,7 +47,7 @@
"direct:j" ==> {
to ("mock:j", "mock:k")
to ("mock:l")
- }
+ }
}.print
}
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=645039&r1=645038&r2=645039&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 Sat Apr 5 00:35:47 2008
@@ -1,12 +1,28 @@
+/**
+ * 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;
class PipelineRouteBuilderTest extends ScalaTestSupport {
-
+
def testPipelineWithArrows() = testPipeline("direct:a", "mock:a", "mock:b")
def testPipelineWithTos() = testPipeline("direct:c", "mock:c", "mock:d")
def testPipelineBlockWithArrows() = testPipeline("direct:e", "mock:e", "mock:f")
def testPipelineBlockWithTos() = testPipeline("direct:g", "mock:g", "mock:h")
-
+
def testPipeline(from: String, to: String*) = {
to.foreach {
_.expect { _.expectedMessageCount(1) }
@@ -16,17 +32,17 @@
_.assert()
}
}
-
- override protected def createRouteBuilder() =
+
+ override protected def createRouteBuilder() =
new RouteBuilder {
"direct:a" --> "mock:a" --> "mock:b"
"direct:c" to "mock:c" to "mock:d"
-
+
"direct:e" ==> {
--> ("mock:e")
--> ("mock:f")
}
-
+
"direct:g" ==> {
to ("mock:g")
to ("mock:h")