You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ge...@apache.org on 2010/10/11 13:14:00 UTC
svn commit: r1021302 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/model/
components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/
components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/
components/camel-scala/...
Author: gertv
Date: Mon Oct 11 11:13:59 2010
New Revision: 1021302
URL: http://svn.apache.org/viewvc?rev=1021302&view=rev
Log:
CAMEL-463: Adding support for pollEnrich() DSL method
Added:
camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SPollEnricherTest.scala
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
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/builder/RouteBuilder.scala
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=1021302&r1=1021301&r2=1021302&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Mon Oct 11 11:13:59 2010
@@ -2515,7 +2515,7 @@ public abstract class ProcessorDefinitio
* using a {@link org.apache.camel.PollingConsumer} to poll the endpoint.
* <p/>
* The difference between this and {@link #enrich(String)} is that this uses a consumer
- * to obatin the additional data, where as enrich uses a producer.
+ * to obtain the additional data, where as enrich uses a producer.
* <p/>
* This method will block until data is avialable, use the method with timeout if you do not
* want to risk waiting a long time before data is available from the resourceUri.
@@ -2536,7 +2536,7 @@ public abstract class ProcessorDefinitio
* using a {@link org.apache.camel.PollingConsumer} to poll the endpoint.
* <p/>
* The difference between this and {@link #enrich(String)} is that this uses a consumer
- * to obatin the additional data, where as enrich uses a producer.
+ * to obtain the additional data, where as enrich uses a producer.
* <p/>
* This method will block until data is avialable, use the method with timeout if you do not
* want to risk waiting a long time before data is available from the resourceUri.
@@ -2558,7 +2558,7 @@ public abstract class ProcessorDefinitio
* using a {@link org.apache.camel.PollingConsumer} to poll the endpoint.
* <p/>
* The difference between this and {@link #enrich(String)} is that this uses a consumer
- * to obatin the additional data, where as enrich uses a producer.
+ * to obtain the additional data, where as enrich uses a producer.
* <p/>
* The timeout controls which operation to use on {@link org.apache.camel.PollingConsumer}.
* If timeout is negative, we use <tt>receive</tt>. If timeout is 0 then we use <tt>receiveNoWait</tt>
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=1021302&r1=1021301&r2=1021302&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 Oct 11 11:13:59 2010
@@ -56,6 +56,9 @@ trait DSL {
def onCompletion(config: Config[SOnCompletionDefinition]) : SOnCompletionDefinition
def pipeline : SPipelineDefinition
def policy(policy: Policy) : DSL
+
+ def pollEnrich(uri: String, strategy: AggregationStrategy = null, timeout: Long = 0) : DSL
+
def process(function: Exchange => Unit) : DSL
def process(processor: Processor) : DSL
def recipients(expression: Exchange => Any) : DSL
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=1021302&r1=1021301&r2=1021302&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 Oct 11 11:13:59 2010
@@ -123,6 +123,9 @@ abstract class SAbstractDefinition[P <:
def policy(policy: Policy) = wrap(target.policy(policy))
+ def pollEnrich(uri: String, strategy: AggregationStrategy = null, timeout: Long = 0) =
+ wrap(target.pollEnrich(uri, timeout, strategy))
+
def recipients(expression: Exchange => Any) = wrap(target.recipientList(expression))
def resequence(expression: Exchange => Any) = SResequenceDefinition(target.resequence(expression))
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=1021302&r1=1021301&r2=1021302&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 Oct 11 11:13:59 2010
@@ -117,7 +117,7 @@ class RouteBuilder extends Preamble with
def onCompletion(predicate: Exchange => Boolean) = stack.top.onCompletion(predicate)
def onCompletion(config: Config[SOnCompletionDefinition]) = stack.top.onCompletion(config)
def pipeline = stack.top.pipeline
-
+ def pollEnrich(uri: String, strategy: AggregationStrategy = null, timeout: Long = 0) = stack.top.pollEnrich(uri, strategy, timeout)
def policy(policy: Policy) = stack.top.policy(policy)
def process(function: Exchange => Unit) = stack.top.process(function)
def process(processor: Processor) = stack.top.process(processor)
Added: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SPollEnricherTest.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SPollEnricherTest.scala?rev=1021302&view=auto
==============================================================================
--- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SPollEnricherTest.scala (added)
+++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/SPollEnricherTest.scala Mon Oct 11 11:13:59 2010
@@ -0,0 +1,46 @@
+/**
+ * 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 builder.{RouteBuilder, RouteBuilderSupport}
+import org.apache.camel.processor.LogProcessorTest
+import org.apache.camel.LoggingLevel
+import org.apache.camel.processor.enricher.{SampleAggregator, PollEnricherTest}
+
+/**
+ * Scala DSL equivalent for the org.apache.camel.processor.enricher.PollEnricherTest
+ */
+class SPollEnricherTest extends PollEnricherTest with RouteBuilderSupport {
+
+ val strategy = new SampleAggregator
+
+ override def createRouteBuilder = new RouteBuilder {
+ "direct:enricher-test-1" pollEnrich("direct:foo1", strategy) to("mock:mock")
+
+ "direct:enricher-test-2" ==> {
+ pollEnrich("direct:foo2", strategy, 1000)
+ to("mock:mock")
+ }
+
+ "direct:enricher-test-3" ==> {
+ pollEnrich("direct:foo3", strategy, -1)
+ to("mock:mock")
+ }
+
+ "direct:enricher-test-4" pollEnrich("direct:foo4", strategy)
+ }
+}