camel git commit: Added example to AWS S3 docs.
Repository: camel Updated Branches: refs/heads/master b0c2d2bd8 -> d59379c72 Added example to AWS S3 docs. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d59379c7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d59379c7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d59379c7 Branch: refs/heads/master Commit: d59379c72b86b54680613cdd52c35edacb3c45e0 Parents: b0c2d2b Author: Henryk KonsekAuthored: Wed Oct 19 16:11:29 2016 +0200 Committer: Henryk Konsek Committed: Wed Oct 19 16:11:29 2016 +0200 -- components/camel-aws/src/main/docs/aws-s3-component.adoc | 9 + 1 file changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d59379c7/components/camel-aws/src/main/docs/aws-s3-component.adoc -- diff --git a/components/camel-aws/src/main/docs/aws-s3-component.adoc b/components/camel-aws/src/main/docs/aws-s3-component.adoc index 8c2a106..c5f5143 100644 --- a/components/camel-aws/src/main/docs/aws-s3-component.adoc +++ b/components/camel-aws/src/main/docs/aws-s3-component.adoc @@ -26,6 +26,15 @@ The bucket will be created if it don't already exists. + You can append query options to the URI in the following format, ?options=value=value&... +For example in order to read file `hello.txt` from bucket `helloBucket`, use the following snippet: + +[source,java] + +from("aws-s3:helloBucket?accessKey=yourAccessKey=yourSecretKey=hello.txt") + .to("file:/var/downloaded"); + + + [[AWS-S3-URIOptions]] URI Options ^^^
camel git commit: Added endpoint documentation.
Repository: camel Updated Branches: refs/heads/master 3356d1d84 -> b7ae8147b Added endpoint documentation. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b7ae8147 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b7ae8147 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b7ae8147 Branch: refs/heads/master Commit: b7ae8147bc4b477bb380b5e4c4fd7ab58855a194 Parents: 3356d1d Author: Henryk KonsekAuthored: Wed Dec 16 21:56:42 2015 +0100 Committer: Henryk Konsek Committed: Wed Dec 16 21:56:42 2015 +0100 -- .../org/apache/camel/component/spark/SparkEndpoint.java | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b7ae8147/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java index 40c86e1..1d758c4 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java @@ -21,14 +21,14 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; import org.apache.spark.api.java.AbstractJavaRDDLike; import org.apache.spark.sql.DataFrame; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.spi.LoggerFactoryBinder; import static org.slf4j.LoggerFactory.getLogger; +// @UriEndpoint(scheme = "spark", producerOnly = true, title = "Apache Spark", syntax = "spark:jobType", label = "bigdata,iot") public class SparkEndpoint extends DefaultEndpoint { // Logger @@ -37,18 +37,24 @@ public class SparkEndpoint extends DefaultEndpoint { // Endpoint collaborators +@UriParam(name = "rdd", description = "RDD to compute against.") private AbstractJavaRDDLike rdd; +@UriParam(name = "rddCallback", description = "Function performing action against an RDD.") private RddCallback rddCallback; +@UriParam(name = "dataFrame", description = "DataFrame to compute against.") private DataFrame dataFrame; +@UriParam(name = "dataFrameCallback", description = "Function performing action against an DataFrame.") private DataFrameCallback dataFrameCallback; // Endpoint configuration +@UriParam(name = "endpointType", description = "Type of the endpoint (rdd, dataframe, hive).") private final EndpointType endpointType; +@UriParam(name = "collect", description = "Indicates if results should be collected or counted.") private boolean collect = true; // Constructors
camel git commit: Improved logging.
Repository: camel Updated Branches: refs/heads/master b7ae8147b -> 26dbc438c Improved logging. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/26dbc438 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/26dbc438 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/26dbc438 Branch: refs/heads/master Commit: 26dbc438c4ecc0efa8a453c55aa0e51a4a6c4773 Parents: b7ae814 Author: Henryk KonsekAuthored: Wed Dec 16 22:00:37 2015 +0100 Committer: Henryk Konsek Committed: Wed Dec 16 22:00:37 2015 +0100 -- .../java/org/apache/camel/component/spark/SparkEndpoint.java | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/26dbc438/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java index 1d758c4..17ebc2a 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java @@ -28,6 +28,10 @@ import org.slf4j.Logger; import static org.slf4j.LoggerFactory.getLogger; + +/** + * Spark endpoint can be used to create various type of producers, including RDD-, DataFrame- and Hive-based. + */ // @UriEndpoint(scheme = "spark", producerOnly = true, title = "Apache Spark", syntax = "spark:jobType", label = "bigdata,iot") public class SparkEndpoint extends DefaultEndpoint { @@ -84,10 +88,13 @@ public class SparkEndpoint extends DefaultEndpoint { public Producer createProducer() throws Exception { LOG.debug("Creating {} Spark producer.", endpointType); if (endpointType == EndpointType.rdd) { +LOG.debug("About to create RDD producer."); return new RddSparkProducer(this); } else if (endpointType == EndpointType.dataframe) { +LOG.debug("About to create DataFrame producer."); return new DataFrameSparkProducer(this); } else { +LOG.debug("About to create Hive producer."); return new HiveSparkProducer(this); } } @@ -104,7 +111,6 @@ public class SparkEndpoint extends DefaultEndpoint { // Setters & getters - @Override public SparkComponent getComponent() { return (SparkComponent) super.getComponent();
camel git commit: Hive tests should be disabled on CI.
Repository: camel Updated Branches: refs/heads/master 0890e8f28 -> 66600aa81 Hive tests should be disabled on CI. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/66600aa8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/66600aa8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/66600aa8 Branch: refs/heads/master Commit: 66600aa8107bfe499d4f9b35f81d185dea00377e Parents: 0890e8f Author: Henryk KonsekAuthored: Mon Dec 14 20:55:53 2015 +0100 Committer: Henryk Konsek Committed: Mon Dec 14 20:55:53 2015 +0100 -- .../java/org/apache/camel/component/spark/SparkProducerTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/66600aa8/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java -- diff --git a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java index 44fc203..311d641 100644 --- a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java +++ b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java @@ -19,7 +19,7 @@ package org.apache.camel.component.spark; import java.io.File; import java.io.IOException; -import static java.lang.Runtime.getRuntime; +import static java.lang.Boolean.parseBoolean; import static java.util.Arrays.asList; import com.google.common.truth.Truth; @@ -46,7 +46,7 @@ public class SparkProducerTest extends CamelTestSupport { static JavaSparkContext sparkContext = createLocalSparkContext(); -static boolean shouldRunHive = getRuntime().maxMemory() > 2 * 1024 * 1024 * 1024; +static boolean shouldRunHive = parseBoolean(System.getenv("CAMEL_SPARK_HIVE_TESTS")); static HiveContext hiveContext;
camel git commit: Added Spark Hive collecting test.
Repository: camel Updated Branches: refs/heads/master 66600aa81 -> c45c0b3c2 Added Spark Hive collecting test. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c45c0b3c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c45c0b3c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c45c0b3c Branch: refs/heads/master Commit: c45c0b3c2463d9902cc12f1a38630e0a482bbaa2 Parents: 66600aa Author: Henryk KonsekAuthored: Mon Dec 14 21:34:53 2015 +0100 Committer: Henryk Konsek Committed: Mon Dec 14 21:34:53 2015 +0100 -- .../camel/component/spark/SparkProducerTest.java | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c45c0b3c/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java -- diff --git a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java index 311d641..11b6451 100644 --- a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java +++ b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.spark; import java.io.File; import java.io.IOException; +import java.util.List; import static java.lang.Boolean.parseBoolean; import static java.util.Arrays.asList; @@ -30,6 +31,7 @@ import org.apache.spark.api.java.AbstractJavaRDDLike; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.sql.DataFrame; +import org.apache.spark.sql.Row; import org.apache.spark.sql.hive.HiveContext; import org.junit.BeforeClass; import org.junit.Test; @@ -221,8 +223,15 @@ public class SparkProducerTest extends CamelTestSupport { @Test public void shouldExecuteHiveQuery() { assumeTrue(shouldRunHive); -long tablesCount = template.requestBody(sparkHiveUri + "?collect=false", "SELECT * FROM cars", Long.class); -Truth.assertThat(tablesCount).isEqualTo(2); +List cars = template.requestBody(sparkHiveUri, "SELECT * FROM cars", List.class); +Truth.assertThat(cars.get(0).getString(1)).isEqualTo("X-trail"); +} + +@Test +public void shouldExecuteHiveCountQuery() { +assumeTrue(shouldRunHive); +long carsCount = template.requestBody(sparkHiveUri + "?collect=false", "SELECT * FROM cars", Long.class); +Truth.assertThat(carsCount).isEqualTo(2); } // Data frames tests
camel git commit: Renamed TypedRddCallback to ConvertingRddCallback.
Repository: camel Updated Branches: refs/heads/master 930117ca6 -> be05f73e0 Renamed TypedRddCallback to ConvertingRddCallback. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/be05f73e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/be05f73e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/be05f73e Branch: refs/heads/master Commit: be05f73e0b14ca5767330c1dac4dbf73cdb8dc26 Parents: 930117c Author: Henryk KonsekAuthored: Fri Dec 11 12:55:19 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 11 12:55:32 2015 +0100 -- .../component/spark/ConvertingRddCallback.java | 49 .../component/spark/SparkTransformation.java| 23 - .../camel/component/spark/TypedRddCallback.java | 43 - .../component/spark/SparkProducerTest.java | 2 +- 4 files changed, 50 insertions(+), 67 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/be05f73e/components/camel-spark/src/main/java/org/apache/camel/component/spark/ConvertingRddCallback.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/ConvertingRddCallback.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/ConvertingRddCallback.java new file mode 100644 index 000..ac75f38 --- /dev/null +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/ConvertingRddCallback.java @@ -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.component.spark; + +import static java.lang.String.format; + +import org.apache.camel.CamelContext; +import org.apache.spark.api.java.AbstractJavaRDDLike; + +public abstract class ConvertingRddCallback implements RddCallback { + +private final CamelContext camelContext; + +private final Class[] payloadsTypes; + +public ConvertingRddCallback(CamelContext camelContext, Class... payloadsTypes) { +this.camelContext = camelContext; +this.payloadsTypes = payloadsTypes; +} + +@Override +public T onRdd(AbstractJavaRDDLike rdd, Object... payloads) { +if (payloads.length != payloadsTypes.length) { +String message = format("Received %d payloads, but expected %d.", payloads.length, payloadsTypes.length); +throw new IllegalArgumentException(message); +} +for (int i = 0; i < payloads.length; i++) { +payloads[i] = camelContext.getTypeConverter().convertTo(payloadsTypes[i], payloads[i]); +} +return doOnRdd(rdd, payloads); +} + +public abstract T doOnRdd(AbstractJavaRDDLike rdd, Object... payloads); + +} http://git-wip-us.apache.org/repos/asf/camel/blob/be05f73e/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkTransformation.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkTransformation.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkTransformation.java deleted file mode 100644 index 4a88e8e..000 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkTransformation.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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
camel git commit: RDD should be configurable on the component level.
Repository: camel Updated Branches: refs/heads/master be05f73e0 -> dbaeb9d7a RDD should be configurable on the component level. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dbaeb9d7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dbaeb9d7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dbaeb9d7 Branch: refs/heads/master Commit: dbaeb9d7a720a5d2bb30e00eaca6d5fc414801f7 Parents: be05f73 Author: Henryk KonsekAuthored: Fri Dec 11 13:03:28 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 11 13:03:28 2015 +0100 -- .../camel/component/spark/SparkComponent.java | 21 .../camel/component/spark/SparkEndpoint.java| 14 + 2 files changed, 35 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/dbaeb9d7/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java index 08c34d6..d82798b 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java @@ -20,9 +20,14 @@ import java.util.Map; import org.apache.camel.Endpoint; import org.apache.camel.impl.UriEndpointComponent; +import org.apache.spark.api.java.AbstractJavaRDDLike; public class SparkComponent extends UriEndpointComponent { +private AbstractJavaRDDLike rdd; + +private RddCallback rddCallback; + public SparkComponent() { super(SparkEndpoint.class); } @@ -32,4 +37,20 @@ public class SparkComponent extends UriEndpointComponent { return new SparkEndpoint(uri, this, EndpointType.valueOf(remaining)); } +public AbstractJavaRDDLike getRdd() { +return rdd; +} + +public void setRdd(AbstractJavaRDDLike rdd) { +this.rdd = rdd; +} + +public RddCallback getRddCallback() { +return rddCallback; +} + +public void setRddCallback(RddCallback rddCallback) { +this.rddCallback = rddCallback; +} + } http://git-wip-us.apache.org/repos/asf/camel/blob/dbaeb9d7/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java index 54e8f54..40c86e1 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java @@ -58,6 +58,20 @@ public class SparkEndpoint extends DefaultEndpoint { this.endpointType = endpointType; } +// Life-cycle + +@Override +protected void doStart() throws Exception { +super.doStart(); + +if (rdd == null) { +rdd = getComponent().getRdd(); +} +if (rddCallback == null) { +rddCallback = getComponent().getRddCallback(); +} +} + // Overridden @Override
camel git commit: Refactoring.
Repository: camel Updated Branches: refs/heads/master 4442b75b8 -> fe6d6b063 Refactoring. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fe6d6b06 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fe6d6b06 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fe6d6b06 Branch: refs/heads/master Commit: fe6d6b063e8c2c01f4c6d43bb50f119a84317660 Parents: 4442b75 Author: Henryk KonsekAuthored: Fri Dec 11 11:51:04 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 11 11:51:04 2015 +0100 -- .../org/apache/camel/component/spark/SparkEndpoint.java | 10 ++ .../apache/camel/component/spark/SparkProducerTest.java | 8 2 files changed, 14 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/fe6d6b06/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java index cb4e1a9..54e8f54 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java @@ -23,9 +23,18 @@ import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.spi.UriEndpoint; import org.apache.spark.api.java.AbstractJavaRDDLike; import org.apache.spark.sql.DataFrame; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.spi.LoggerFactoryBinder; + +import static org.slf4j.LoggerFactory.getLogger; public class SparkEndpoint extends DefaultEndpoint { +// Logger + +private static final Logger LOG = getLogger(SparkEndpoint.class); + // Endpoint collaborators private AbstractJavaRDDLike rdd; @@ -53,6 +62,7 @@ public class SparkEndpoint extends DefaultEndpoint { @Override public Producer createProducer() throws Exception { +LOG.debug("Creating {} Spark producer.", endpointType); if (endpointType == EndpointType.rdd) { return new RddSparkProducer(this); } else if (endpointType == EndpointType.dataframe) { http://git-wip-us.apache.org/repos/asf/camel/blob/fe6d6b06/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java -- diff --git a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java index 1533f8e..bf6f706 100644 --- a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java +++ b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java @@ -50,7 +50,7 @@ public class SparkProducerTest extends CamelTestSupport { static HiveContext hiveContext; -String sparkUri = "spark:rdd?rdd=#pomRdd"; +String sparkUri = "spark:rdd?rdd=#testFileRdd"; String sparkDataFrameUri = "spark:dataframe?dataFrame=#jsonCars"; @@ -69,7 +69,7 @@ public class SparkProducerTest extends CamelTestSupport { protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); -registry.bind("pomRdd", sparkContext.textFile("testrdd.txt")); +registry.bind("testFileRdd", sparkContext.textFile("testrdd.txt")); if (shouldRunHive) { registry.bind("hiveContext", hiveContext); @@ -91,13 +91,13 @@ public class SparkProducerTest extends CamelTestSupport { @Test public void shouldExecuteRddCallback() { -long pomLinesCount = template.requestBodyAndHeader(sparkUri, null, SPARK_RDD_CALLBACK_HEADER, new org.apache.camel.component.spark.RddCallback() { +long linesCount = template.requestBodyAndHeader(sparkUri, null, SPARK_RDD_CALLBACK_HEADER, new org.apache.camel.component.spark.RddCallback() { @Override public Long onRdd(AbstractJavaRDDLike rdd, Object... payloads) { return rdd.count(); } }, Long.class); -Truth.assertThat(pomLinesCount).isEqualTo(19); +Truth.assertThat(linesCount).isEqualTo(19); } @Test
camel git commit: Extracted annotated proxy class.
Repository: camel Updated Branches: refs/heads/master 61b562738 -> c4bdb4463 Extracted annotated proxy class. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c4bdb446 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c4bdb446 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c4bdb446 Branch: refs/heads/master Commit: c4bdb4463b9bff2a047b3badf13799d4d2732b09 Parents: 61b5627 Author: Henryk KonsekAuthored: Fri Dec 11 17:06:52 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 11 17:06:52 2015 +0100 -- .../spark/annotations/AnnotatedRddCallback.java | 37 +--- .../annotations/AnnotatedRddCallbackProxy.java | 63 .../component/spark/SparkProducerTest.java | 20 ++- 3 files changed, 83 insertions(+), 37 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c4bdb446/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java index 8a988f4..dfd8e62 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java @@ -16,46 +16,15 @@ */ package org.apache.camel.component.spark.annotations; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -import static java.util.Arrays.asList; - -import org.apache.spark.api.java.AbstractJavaRDDLike; - -import static org.apache.camel.util.ObjectHelper.findMethodsWithAnnotation; +import org.apache.camel.component.spark.RddCallback; public final class AnnotatedRddCallback { private AnnotatedRddCallback() { } -public static org.apache.camel.component.spark.RddCallback annotatedRddCallback(final Object callback) { -final List rddCallbacks = findMethodsWithAnnotation(callback.getClass(), RddCallback.class); -if (rddCallbacks.size() > 0) { -return new org.apache.camel.component.spark.RddCallback() { -@Override -public Object onRdd(AbstractJavaRDDLike rdd, Object... payloads) { -try { -List arguments = new ArrayList<>(payloads.length + 1); -arguments.add(rdd); -arguments.addAll(asList(payloads)); -if (arguments.get(1) == null) { -arguments.remove(1); -} - -Method callbackMethod = rddCallbacks.get(0); -callbackMethod.setAccessible(true); -return callbackMethod.invoke(callback, arguments.toArray(new Object[arguments.size()])); -} catch (IllegalAccessException | InvocationTargetException e) { -throw new RuntimeException(e); -} -} -}; -} -throw new UnsupportedOperationException("Can't find methods annotated with @Rdd."); +public static RddCallback annotatedRddCallback(Object objectWithCallback) { +return new AnnotatedRddCallbackProxy(objectWithCallback); } } http://git-wip-us.apache.org/repos/asf/camel/blob/c4bdb446/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java new file mode 100644 index 000..ff5337f --- /dev/null +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java @@ -0,0 +1,63 @@ +/** + * 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 + * + *
camel git commit: Added Google Truth to BOM.
Repository: camel Updated Branches: refs/heads/master 0ad9e3786 -> 61b562738 Added Google Truth to BOM. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/61b56273 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/61b56273 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/61b56273 Branch: refs/heads/master Commit: 61b5627380c0a011949b73aee68dd842fd2f1f6c Parents: 0ad9e37 Author: Henryk KonsekAuthored: Fri Dec 11 16:49:50 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 11 16:49:50 2015 +0100 -- components/camel-spark/pom.xml | 2 -- parent/pom.xml | 16 +++- 2 files changed, 11 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/61b56273/components/camel-spark/pom.xml -- diff --git a/components/camel-spark/pom.xml b/components/camel-spark/pom.xml index 2551f22..2d1d2d1 100644 --- a/components/camel-spark/pom.xml +++ b/components/camel-spark/pom.xml @@ -37,7 +37,6 @@ limitations under the License. 2.4.4 -0.27 2.2.0 1.4.2 1.5.1 @@ -98,7 +97,6 @@ limitations under the License. com.google.truth truth -${google-truth-version} test http://git-wip-us.apache.org/repos/asf/camel/blob/61b56273/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 95cc5e9..1464c01 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -196,6 +196,7 @@ v2-rev151-1.19.0 v3-rev99-1.19.0 v1-rev15-1.19.0 +0.27 2.3.23 2.4.5 2.5 @@ -2236,6 +2237,16 @@ ${testng-version} +com.google.truth +truth +${google-truth-version} + + +com.jayway.awaitility +awaitility +${awaitility.version} + + org.easymock easymock ${easymock-version} @@ -2255,11 +2266,6 @@ httpunit ${httpunit-version} - -com.jayway.awaitility -awaitility -${awaitility.version} -
camel git commit: Added support for input conversions for @RddCallback.
Repository: camel Updated Branches: refs/heads/master c4bdb4463 -> a68c79d68 Added support for input conversions for @RddCallback. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a68c79d6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a68c79d6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a68c79d6 Branch: refs/heads/master Commit: a68c79d68a5f256006da0287ed32403b808ed984 Parents: c4bdb44 Author: Henryk KonsekAuthored: Fri Dec 11 18:15:55 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 11 18:15:55 2015 +0100 -- .../spark/annotations/AnnotatedRddCallback.java | 9 +++ .../annotations/AnnotatedRddCallbackProxy.java | 17 +++- .../component/spark/SparkProducerTest.java | 28 ++-- 3 files changed, 45 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a68c79d6/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java index dfd8e62..ee41697 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallback.java @@ -16,8 +16,13 @@ */ package org.apache.camel.component.spark.annotations; +import org.apache.camel.CamelContext; import org.apache.camel.component.spark.RddCallback; +/** + * Provides facade for working with annotated RDD callbacks i.e. POJO classes with an appropriate annotations on + * selected methods. + */ public final class AnnotatedRddCallback { private AnnotatedRddCallback() { @@ -27,4 +32,8 @@ public final class AnnotatedRddCallback { return new AnnotatedRddCallbackProxy(objectWithCallback); } +public static RddCallback annotatedRddCallback(Object objectWithCallback, CamelContext camelContext) { +return new AnnotatedRddCallbackProxy(objectWithCallback, camelContext); +} + } http://git-wip-us.apache.org/repos/asf/camel/blob/a68c79d6/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java index ff5337f..5d2e9c9 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/annotations/AnnotatedRddCallbackProxy.java @@ -23,6 +23,7 @@ import java.util.List; import static java.util.Arrays.asList; +import org.apache.camel.CamelContext; import org.apache.camel.component.spark.RddCallback; import org.apache.spark.api.java.AbstractJavaRDDLike; @@ -34,14 +35,21 @@ class AnnotatedRddCallbackProxy implements RddCallback { private final List rddCallbacks; -public AnnotatedRddCallbackProxy(Object objectWithCallback) { +private final CamelContext camelContext; + +public AnnotatedRddCallbackProxy(Object objectWithCallback, CamelContext camelContext) { this.objectWithCallback = objectWithCallback; +this.camelContext = camelContext; this.rddCallbacks = findMethodsWithAnnotation(objectWithCallback.getClass(), org.apache.camel.component.spark.annotations.RddCallback.class); if (rddCallbacks.size() == 0) { throw new UnsupportedOperationException("Can't find methods annotated with @RddCallback."); } } +public AnnotatedRddCallbackProxy(Object objectWithCallback) { +this(objectWithCallback, null); +} + @Override public Object onRdd(AbstractJavaRDDLike rdd, Object... payloads) { try { @@ -54,6 +62,13 @@ class AnnotatedRddCallbackProxy implements RddCallback { Method callbackMethod = rddCallbacks.get(0); callbackMethod.setAccessible(true); + +if (camelContext != null) { +for (int i = 1; i < arguments.size(); i++) { +arguments.set(i, camelContext.getTypeConverter().convertTo(callbackMethod.getParameterTypes()[i], arguments.get(i))); +} +} + return
camel git commit: Spark+Hive tests should not be executed if JVM max memory is less than 1 GB.
Repository: camel Updated Branches: refs/heads/master 8230d49b5 -> 8ef757a78 Spark+Hive tests should not be executed if JVM max memory is less than 1 GB. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8ef757a7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8ef757a7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8ef757a7 Branch: refs/heads/master Commit: 8ef757a784ff7796ffca712a8f307439eccdca72 Parents: 8230d49 Author: Henryk KonsekAuthored: Thu Dec 10 22:42:11 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 10 22:42:11 2015 +0100 -- .../component/spark/SparkProducerTest.java | 27 1 file changed, 22 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/8ef757a7/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java -- diff --git a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java index 81a28e6..6c85148 100644 --- a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java +++ b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java @@ -19,6 +19,7 @@ package org.apache.camel.component.spark; import java.io.File; import java.io.IOException; +import static java.lang.Runtime.getRuntime; import static java.util.Arrays.asList; import com.google.common.truth.Truth; @@ -30,12 +31,14 @@ import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.sql.DataFrame; import org.apache.spark.sql.hive.HiveContext; +import org.junit.BeforeClass; import org.junit.Test; import static org.apache.camel.component.spark.SparkConstants.SPARK_DATAFRAME_CALLBACK_HEADER; import static org.apache.camel.component.spark.SparkConstants.SPARK_RDD_CALLBACK_HEADER; import static org.apache.camel.component.spark.Sparks.createLocalSparkContext; import static org.apache.camel.component.spark.annotations.AnnotatedRddCallback.annotatedRddCallback; +import static org.junit.Assume.assumeTrue; public class SparkProducerTest extends CamelTestSupport { @@ -43,7 +46,9 @@ public class SparkProducerTest extends CamelTestSupport { static JavaSparkContext sparkContext = createLocalSparkContext(); -static HiveContext hiveContext = new HiveContext(sparkContext.sc()); +static boolean shouldRunHive = getRuntime().maxMemory() > 1024 * 1024 * 1024; + +static HiveContext hiveContext; String sparkUri = "spark:rdd?rdd=#pomRdd"; @@ -51,6 +56,13 @@ public class SparkProducerTest extends CamelTestSupport { String sparkHiveUri = "spark:hive"; +@BeforeClass +public static void beforeClass() { +if (shouldRunHive) { +hiveContext = new HiveContext(sparkContext.sc()); +} +} + // Routes fixtures @Override @@ -59,10 +71,12 @@ public class SparkProducerTest extends CamelTestSupport { registry.bind("pomRdd", sparkContext.textFile("testrdd.txt")); -registry.bind("hiveContext", hiveContext); -DataFrame jsonCars = hiveContext.read().json("src/test/resources/cars.json"); -jsonCars.registerTempTable("cars"); -registry.bind("jsonCars", jsonCars); +if (shouldRunHive) { +registry.bind("hiveContext", hiveContext); +DataFrame jsonCars = hiveContext.read().json("src/test/resources/cars.json"); +jsonCars.registerTempTable("cars"); +registry.bind("jsonCars", jsonCars); +} registry.bind("countLinesTransformation", new org.apache.camel.component.spark.RddCallback() { @Override @@ -180,6 +194,7 @@ public class SparkProducerTest extends CamelTestSupport { @Test public void shouldExecuteHiveQuery() { +assumeTrue(shouldRunHive); long tablesCount = template.requestBody(sparkHiveUri + "?collect=false", "SELECT * FROM cars", Long.class); Truth.assertThat(tablesCount).isEqualTo(2); } @@ -188,6 +203,7 @@ public class SparkProducerTest extends CamelTestSupport { @Test public void shouldCountFrame() { +assumeTrue(shouldRunHive); DataFrameCallback callback = new DataFrameCallback() { @Override public Long onDataFrame(DataFrame dataFrame, Object... payloads) { @@ -200,6 +216,7 @@ public class SparkProducerTest extends CamelTestSupport { @Test public void shouldExecuteConditionalFrameCount() { +assumeTrue(shouldRunHive);
camel git commit: Fixed CS.
Repository: camel Updated Branches: refs/heads/master 1a7cce0f2 -> 8230d49b5 Fixed CS. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8230d49b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8230d49b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8230d49b Branch: refs/heads/master Commit: 8230d49b529d04c34ba6c3c3725e85bdd895bc5b Parents: 1a7cce0 Author: Henryk KonsekAuthored: Thu Dec 10 22:25:24 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 10 22:25:24 2015 +0100 -- .../java/org/apache/camel/component/spark/HiveSparkProducer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/8230d49b/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java index eb64637..3145595 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java @@ -46,7 +46,7 @@ public class HiveSparkProducer extends DefaultProducer { protected HiveContext resolveHiveContext() { Set hiveContexts = getEndpoint().getComponent().getCamelContext().getRegistry().findByType(HiveContext.class); -if(hiveContexts.size() == 1) { +if (hiveContexts.size() == 1) { return hiveContexts.iterator().next(); } return null;
camel git commit: Spark+Hive tests should not be executed if JVM max memory is less than 2 GB.
Repository: camel Updated Branches: refs/heads/master 8ef757a78 -> 19c9651bd Spark+Hive tests should not be executed if JVM max memory is less than 2 GB. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/19c9651b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/19c9651b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/19c9651b Branch: refs/heads/master Commit: 19c9651bd3565846ed343014ebe75d2bad447dda Parents: 8ef757a Author: Henryk KonsekAuthored: Fri Dec 11 07:51:41 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 11 07:51:41 2015 +0100 -- .../java/org/apache/camel/component/spark/SparkProducerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/19c9651b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java -- diff --git a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java index 6c85148..1533f8e 100644 --- a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java +++ b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java @@ -46,7 +46,7 @@ public class SparkProducerTest extends CamelTestSupport { static JavaSparkContext sparkContext = createLocalSparkContext(); -static boolean shouldRunHive = getRuntime().maxMemory() > 1024 * 1024 * 1024; +static boolean shouldRunHive = getRuntime().maxMemory() > 2 * 1024 * 1024 * 1024; static HiveContext hiveContext;
camel git commit: Added Hive producer.
Repository: camel Updated Branches: refs/heads/master 86e22d436 -> c24985175 Added Hive producer. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c2498517 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c2498517 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c2498517 Branch: refs/heads/master Commit: c24985175d8f0423ceead2df6ed83a8d60de84b2 Parents: 86e22d4 Author: Henryk KonsekAuthored: Mon Dec 7 09:25:09 2015 +0100 Committer: Henryk Konsek Committed: Mon Dec 7 09:25:09 2015 +0100 -- .../camel/component/spark/EndpointType.java | 2 +- .../component/spark/HiveSparkProducer.java | 55 .../camel/component/spark/SparkEndpoint.java| 8 ++- .../component/spark/SparkProducerTest.java | 21 4 files changed, 72 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c2498517/components/camel-spark/src/main/java/org/apache/camel/component/spark/EndpointType.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/EndpointType.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/EndpointType.java index b471e39..139c082 100644 --- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/EndpointType.java +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/EndpointType.java @@ -18,6 +18,6 @@ package org.apache.camel.component.spark; public enum EndpointType { -rdd, dataframe +rdd, dataframe, hive } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/c2498517/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java new file mode 100644 index 000..eb64637 --- /dev/null +++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/HiveSparkProducer.java @@ -0,0 +1,55 @@ +/** + * 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.component.spark; + +import java.util.Set; + +import org.apache.camel.Exchange; +import org.apache.camel.impl.DefaultProducer; +import org.apache.spark.sql.DataFrame; +import org.apache.spark.sql.hive.HiveContext; + +public class HiveSparkProducer extends DefaultProducer { + +public HiveSparkProducer(SparkEndpoint endpoint) { +super(endpoint); +} + +@Override +public void process(Exchange exchange) throws Exception { +HiveContext hiveContext = resolveHiveContext(); +String sql = exchange.getIn().getBody(String.class); +DataFrame resultFrame = hiveContext.sql(sql); +exchange.getIn().setBody(getEndpoint().isCollect() ? resultFrame.collectAsList() : resultFrame.count()); +} + +@Override +public SparkEndpoint getEndpoint() { +return (SparkEndpoint) super.getEndpoint(); +} + +// Helpers + +protected HiveContext resolveHiveContext() { +Set hiveContexts = getEndpoint().getComponent().getCamelContext().getRegistry().findByType(HiveContext.class); +if(hiveContexts.size() == 1) { +return hiveContexts.iterator().next(); +} +return null; +} + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/c2498517/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java -- diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java index 8a5247b..cb4e1a9 100644 ---
camel git commit: [CAMEL-9385] Initial commit of Apache Spark component.
Repository: camel Updated Branches: refs/heads/master 1ee0008e7 -> b46392c25 [CAMEL-9385] Initial commit of Apache Spark component. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b46392c2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b46392c2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b46392c2 Branch: refs/heads/master Commit: b46392c25bd517cbb7d04e6dd7611d1634378a13 Parents: 1ee0008 Author: Henryk KonsekAuthored: Fri Dec 4 12:00:33 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 4 12:00:33 2015 +0100 -- components/camel-spark/.gitignore | 1 + components/camel-spark/pom.xml | 116 ++ .../component/spark/DataFrameCallback.java | 30 +++ .../component/spark/DataFrameSparkProducer.java | 86 .../camel/component/spark/EndpointType.java | 23 ++ .../camel/component/spark/RddCallback.java | 30 +++ .../camel/component/spark/RddSparkProducer.java | 85 .../camel/component/spark/SparkComponent.java | 35 +++ .../camel/component/spark/SparkConstants.java | 32 +++ .../camel/component/spark/SparkEndpoint.java| 117 ++ .../camel/component/spark/SparkMongos.java | 37 .../component/spark/SparkTransformation.java| 23 ++ .../apache/camel/component/spark/Sparks.java| 30 +++ .../camel/component/spark/TypedRddCallback.java | 43 .../camel/component/spark/VoidRddCallback.java | 31 +++ .../spark/annotations/AnnotatedRddCallback.java | 61 ++ .../spark/annotations/RddCallback.java | 29 +++ .../services/org/apache/camel/component/spark | 18 ++ .../component/spark/SparkProducerTest.java | 217 +++ .../camel-spark/src/test/resources/cars.json| 2 + components/camel-spark/testrdd.txt | 17 ++ components/pom.xml | 1 + 22 files changed, 1064 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b46392c2/components/camel-spark/.gitignore -- diff --git a/components/camel-spark/.gitignore b/components/camel-spark/.gitignore new file mode 100644 index 000..3d55803 --- /dev/null +++ b/components/camel-spark/.gitignore @@ -0,0 +1 @@ +metastore_db \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/b46392c2/components/camel-spark/pom.xml -- diff --git a/components/camel-spark/pom.xml b/components/camel-spark/pom.xml new file mode 100644 index 000..2551f22 --- /dev/null +++ b/components/camel-spark/pom.xml @@ -0,0 +1,116 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> + +4.0.0 + + +components +org.apache.camel +2.17-SNAPSHOT + + +camel-spark +bundle +Camel :: Apache Spark +Camel Apache Spark Support + + + org.apache.camel.component.spark.* + org.apache.camel.spi.ComponentResolver;component=spark + + +2.4.4 + +0.27 +2.2.0 +1.4.2 +1.5.1 + + + + +org.apache.spark +spark-core_2.11 +${spark-version} + + +org.apache.spark +spark-hive_2.11 +${spark-version} + + +org.apache.camel +camel-core + + + +org.apache.hadoop +hadoop-client +${hadoop.version} + + +org.apache.hadoop +hadoop-common +${hadoop.version} + + +org.apache.hadoop +hadoop-mapreduce-client-core +${hadoop.version} + + +org.apache.hadoop +hadoop-mapreduce-client-jobclient +${hadoop.version} + + + + +org.mongodb.mongo-hadoop +mongo-hadoop-core +${mongo-hadoop-core.version} +true + + + + +ch.qos.logback +logback-classic +${logback-version} +test + + +com.google.truth +truth +${google-truth-version} +test + + +org.apache.camel +camel-test +test + + +junit +junit +test + + + +
camel git commit: Fixed licenses.
Repository: camel Updated Branches: refs/heads/master 0c9693980 -> 4a205fdfd Fixed licenses. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4a205fdf Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4a205fdf Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4a205fdf Branch: refs/heads/master Commit: 4a205fdfdca3d4b788fc798834395174ffe6fe85 Parents: 0c96939 Author: Henryk KonsekAuthored: Fri Dec 4 18:45:04 2015 +0100 Committer: Henryk Konsek Committed: Fri Dec 4 18:45:04 2015 +0100 -- .../org/apache/camel/component/LICENSE.txt | 203 +++ .../org/apache/camel/component/NOTICE.txt | 11 + components/camel-spark/testrdd.txt | 8 +- 3 files changed, 219 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4a205fdf/components/camel-spark/src/main/resources/META-INF/services/org/apache/camel/component/LICENSE.txt -- diff --git a/components/camel-spark/src/main/resources/META-INF/services/org/apache/camel/component/LICENSE.txt b/components/camel-spark/src/main/resources/META-INF/services/org/apache/camel/component/LICENSE.txt new file mode 100644 index 000..6b0b127 --- /dev/null +++ b/components/camel-spark/src/main/resources/META-INF/services/org/apache/camel/component/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 +http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution."
camel git commit: [camel-amqp] Added missing topic pre-configuration.
Repository: camel Updated Branches: refs/heads/master 3be8c9536 -> aa99c809d [camel-amqp] Added missing topic pre-configuration. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aa99c809 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aa99c809 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aa99c809 Branch: refs/heads/master Commit: aa99c809d2b52dd0c6ffdd29b305d6a6bb133fa0 Parents: 3be8c95 Author: Henryk KonsekAuthored: Thu Dec 3 13:27:46 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 3 13:27:46 2015 +0100 -- .../main/java/org/apache/camel/component/amqp/AMQPComponent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/aa99c809/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index dc4c2ed..6dd8226 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -55,7 +55,9 @@ public class AMQPComponent extends JmsComponent { Set connectionDetails = getCamelContext().getRegistry().findByType(AMQPConnectionDetails.class); if (connectionDetails.size() == 1) { AMQPConnectionDetails details = connectionDetails.iterator().next(); -setConnectionFactory(new JmsConnectionFactory(details.username(), details.password(), details.uri())); +JmsConnectionFactory connectionFactory = new JmsConnectionFactory(details.username(), details.password(), details.uri()); +connectionFactory.setTopicPrefix("topic://"); +setConnectionFactory(connectionFactory); } super.doStart(); }
camel git commit: [camel-amqp] Added extra factory methods.
Repository: camel Updated Branches: refs/heads/master ea41121d1 -> ec9a37b28 [camel-amqp] Added extra factory methods. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ec9a37b2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ec9a37b2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ec9a37b2 Branch: refs/heads/master Commit: ec9a37b2816325c916afb4661177b5ea28cd7c3a Parents: ea41121 Author: Henryk KonsekAuthored: Thu Dec 3 12:15:50 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 3 12:15:50 2015 +0100 -- .../org/apache/camel/component/amqp/AMQPComponent.java| 10 ++ 1 file changed, 10 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ec9a37b2/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index 3100e20..8dcf7e6 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -29,6 +29,8 @@ import org.apache.qpid.jms.JmsConnectionFactory; */ public class AMQPComponent extends JmsComponent { +// Constructors + public AMQPComponent() { super(AMQPEndpoint.class); } @@ -45,6 +47,8 @@ public class AMQPComponent extends JmsComponent { setConnectionFactory(connectionFactory); } +// Factory methods + /** * Use {@code amqpComponent(String uri)} instead. */ @@ -61,4 +65,10 @@ public class AMQPComponent extends JmsComponent { return new AMQPComponent(connectionFactory); } +public static AMQPComponent amqpComponent(String uri, String username, String password) { +JmsConnectionFactory connectionFactory = new JmsConnectionFactory(username, password, uri); +connectionFactory.setTopicPrefix("topic://"); +return new AMQPComponent(connectionFactory); +} + }
camel git commit: [camel-amqp] Added extra tests.
Repository: camel Updated Branches: refs/heads/master ab5db120e -> 38b12bfb0 [camel-amqp] Added extra tests. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/38b12bfb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/38b12bfb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/38b12bfb Branch: refs/heads/master Commit: 38b12bfb0da4b7e26c7f1a136ed3ddfd6cd131f6 Parents: ab5db12 Author: Henryk KonsekAuthored: Thu Dec 3 12:57:57 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 3 12:57:57 2015 +0100 -- .../camel/component/amqp/AMQPRouteTest.java | 22 1 file changed, 22 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/38b12bfb/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java index ce89bc6..3ed0935 100644 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java +++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java @@ -20,6 +20,7 @@ import org.apache.activemq.broker.BrokerService; import org.apache.camel.CamelContext; import org.apache.camel.EndpointInject; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.jms.JmsConstants; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.AvailablePortFinder; import org.apache.camel.test.junit4.CamelTestSupport; @@ -75,6 +76,23 @@ public class AMQPRouteTest extends CamelTestSupport { resultEndpoint.assertIsSatisfied(); } +@Test +public void testPrefixWildcard() throws Exception { +resultEndpoint.expectedMessageCount(1); +template.sendBody("amqp:wildcard.foo.bar", expectedBody); +resultEndpoint.assertIsSatisfied(); +} + +@Test +public void testIncludeDestination() throws Exception { +resultEndpoint.expectedMessageCount(1); +resultEndpoint.message(0).header("JMSDestination").isEqualTo("ping"); +template.sendBody("amqp:queue:ping", expectedBody); +resultEndpoint.assertIsSatisfied(); +} + +// Routes fixtures + protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); camelContext.addComponent("amqp", amqpComponent("amqp://localhost:" + amqpPort)); @@ -98,6 +116,10 @@ public class AMQPRouteTest extends CamelTestSupport { from("amqp:topic:ping") .to("log:routing") .to("mock:result"); + +from("amqp:queue:wildcard.>") +.to("log:routing") +.to("mock:result"); } }; }
camel git commit: [camel-amqp] Avoiding tests' port conflicts.
Repository: camel Updated Branches: refs/heads/master ec9a37b28 -> ab5db120e [camel-amqp] Avoiding tests' port conflicts. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ab5db120 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ab5db120 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ab5db120 Branch: refs/heads/master Commit: ab5db120ea2d04cf4827178aecafc54cdca6ff78 Parents: ec9a37b Author: Henryk KonsekAuthored: Thu Dec 3 12:17:54 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 3 12:17:54 2015 +0100 -- .../camel/component/amqp/AMQPRouteTest.java | 21 +++- 1 file changed, 12 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ab5db120/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java index d5d37db..ce89bc6 100644 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java +++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java @@ -21,6 +21,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.EndpointInject; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.AvailablePortFinder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -30,6 +31,8 @@ import static org.apache.camel.component.amqp.AMQPComponent.amqpComponent; public class AMQPRouteTest extends CamelTestSupport { +static int amqpPort = AvailablePortFinder.getNextAvailable(); + static BrokerService broker; @EndpointInject(uri = "mock:result") @@ -41,7 +44,7 @@ public class AMQPRouteTest extends CamelTestSupport { public static void beforeClass() throws Exception { broker = new BrokerService(); broker.setPersistent(false); -broker.addConnector("amqp://0.0.0.0:5672"); +broker.addConnector("amqp://0.0.0.0:" + amqpPort); broker.start(); } @@ -54,13 +57,13 @@ public class AMQPRouteTest extends CamelTestSupport { public void testJmsQueue() throws Exception { resultEndpoint.expectedMessageCount(1); resultEndpoint.message(0).header("cheese").isEqualTo(123); -template.sendBodyAndHeader("amqp1-0:queue:ping", expectedBody, "cheese", 123); +template.sendBodyAndHeader("amqp:queue:ping", expectedBody, "cheese", 123); resultEndpoint.assertIsSatisfied(); } @Test public void testRequestReply() { -String response = template.requestBody("amqp1-0:queue:inOut", expectedBody, String.class); +String response = template.requestBody("amqp:queue:inOut", expectedBody, String.class); assertEquals("response", response); } @@ -68,31 +71,31 @@ public class AMQPRouteTest extends CamelTestSupport { public void testJmsTopic() throws Exception { resultEndpoint.expectedMessageCount(2); resultEndpoint.message(0).header("cheese").isEqualTo(123); -template.sendBodyAndHeader("amqp1-0:topic:ping", expectedBody, "cheese", 123); +template.sendBodyAndHeader("amqp:topic:ping", expectedBody, "cheese", 123); resultEndpoint.assertIsSatisfied(); } protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); -camelContext.addComponent("amqp1-0", amqpComponent("amqp://localhost:5672")); +camelContext.addComponent("amqp", amqpComponent("amqp://localhost:" + amqpPort)); return camelContext; } protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { -from("amqp1-0:queue:ping") +from("amqp:queue:ping") .to("log:routing") .to("mock:result"); -from("amqp1-0:queue:inOut") +from("amqp:queue:inOut") .setBody().constant("response"); -from("amqp1-0:topic:ping") +from("amqp:topic:ping") .to("log:routing") .to("mock:result"); -from("amqp1-0:topic:ping") +from("amqp:topic:ping") .to("log:routing") .to("mock:result");
camel git commit: [camel-amqp] Added AMQP connection details.
Repository: camel Updated Branches: refs/heads/master 38b12bfb0 -> 3be8c9536 [camel-amqp] Added AMQP connection details. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3be8c953 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3be8c953 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3be8c953 Branch: refs/heads/master Commit: 3be8c9536a4376f2b289f3a63e2942b3ab91e1ba Parents: 38b12bf Author: Henryk KonsekAuthored: Thu Dec 3 13:16:30 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 3 13:16:30 2015 +0100 -- .../camel/component/amqp/AMQPComponent.java | 13 ++ .../component/amqp/AMQPConnectionDetails.java | 49 .../camel/component/amqp/AMQPRouteTest.java | 36 +- 3 files changed, 86 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/3be8c953/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index 8dcf7e6..dc4c2ed 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -17,6 +17,7 @@ package org.apache.camel.component.amqp; import java.net.MalformedURLException; +import java.util.Set; import javax.jms.ConnectionFactory; import org.apache.camel.CamelContext; @@ -47,6 +48,18 @@ public class AMQPComponent extends JmsComponent { setConnectionFactory(connectionFactory); } +// Life-cycle + +@Override +protected void doStart() throws Exception { +Set connectionDetails = getCamelContext().getRegistry().findByType(AMQPConnectionDetails.class); +if (connectionDetails.size() == 1) { +AMQPConnectionDetails details = connectionDetails.iterator().next(); +setConnectionFactory(new JmsConnectionFactory(details.username(), details.password(), details.uri())); +} +super.doStart(); +} + // Factory methods /** http://git-wip-us.apache.org/repos/asf/camel/blob/3be8c953/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java new file mode 100644 index 000..545bd27 --- /dev/null +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java @@ -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.component.amqp; + +public class AMQPConnectionDetails { + +private final String uri; + +private final String username; + +private final String password; + +public AMQPConnectionDetails(String uri, String username, String password) { +this.uri = uri; +this.username = username; +this.password = password; +} + +public AMQPConnectionDetails(String uri) { +this(uri, null, null); +} + +public String uri() { +return uri; +} + +public String username() { +return username; +} + +public String password() { +return password; +} + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/3be8c953/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
camel git commit: [CAMEL-9388] Provide properties-based AMQP connection discovery.
Repository: camel Updated Branches: refs/heads/master aa99c809d -> 2dd2d4147 [CAMEL-9388] Provide properties-based AMQP connection discovery. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2dd2d414 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2dd2d414 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2dd2d414 Branch: refs/heads/master Commit: 2dd2d4147de61fc309d66cc0ff5923e93a28951f Parents: aa99c80 Author: Henryk KonsekAuthored: Thu Dec 3 16:04:36 2015 +0100 Committer: Henryk Konsek Committed: Thu Dec 3 16:04:36 2015 +0100 -- .../component/amqp/AMQPConnectionDetails.java | 38 .../camel/component/amqp/AMQPRouteTest.java | 8 - 2 files changed, 45 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/2dd2d414/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java index 545bd27..fa06b5b 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConnectionDetails.java @@ -16,8 +16,19 @@ */ package org.apache.camel.component.amqp; +import org.apache.camel.CamelContext; +import org.apache.camel.component.properties.PropertiesComponent; + public class AMQPConnectionDetails { +public static final String AMQP_HOST = "AMQP_SERVICE_HOST"; + +public static final String AMQP_PORT = "AMQP_SERVICE_PORT"; + +public static final String AMQP_USERNAME = "AMQP_SERVICE_USERNAME"; + +public static final String AMQP_PASSWORD = "AMQP_SERVICE_PASSWORD"; + private final String uri; private final String username; @@ -34,6 +45,21 @@ public class AMQPConnectionDetails { this(uri, null, null); } +public static AMQPConnectionDetails discoverAMQP(CamelContext camelContext) { +try { +PropertiesComponent propertiesComponent = camelContext.getComponent("properties", PropertiesComponent.class); + +String host = property(propertiesComponent, AMQP_HOST, "localhost"); +int port = Integer.parseInt(property(propertiesComponent, AMQP_PORT , "5672")); +String username = property(propertiesComponent, AMQP_USERNAME, null); +String password = property(propertiesComponent, AMQP_PASSWORD, null); + +return new AMQPConnectionDetails("amqp://" + host + ":" + port, username, password); +} catch (Exception e) { +throw new RuntimeException(e); +} +} + public String uri() { return uri; } @@ -46,4 +72,16 @@ public class AMQPConnectionDetails { return password; } +// Helpers + +private static String property(PropertiesComponent propertiesComponent, String key, String defaultValue) { +try { +return propertiesComponent.parseUri(propertiesComponent.getPrefixToken() + key + propertiesComponent.getSuffixToken()); +} catch (IllegalArgumentException e) { +return defaultValue; +} catch (Exception e) { +throw new RuntimeException(e); +} +} + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2dd2d414/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java index fa7319d..e7303fc 100644 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java +++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java @@ -22,6 +22,7 @@ import org.apache.camel.EndpointInject; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.impl.JndiRegistry; +import org.apache.camel.impl.PropertyPlaceholderDelegateRegistry; import org.apache.camel.test.AvailablePortFinder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.AfterClass; @@ -29,6 +30,8 @@ import org.junit.BeforeClass; import org.junit.Test; import static org.apache.camel.component.amqp.AMQPComponent.amqpComponent; +import static
camel git commit: [CAMEL-9381] Upgraded AMQP to qpid-jms-client.
Repository: camel Updated Branches: refs/heads/master 1f2127362 -> 4997c2e92 [CAMEL-9381] Upgraded AMQP to qpid-jms-client. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4997c2e9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4997c2e9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4997c2e9 Branch: refs/heads/master Commit: 4997c2e929d11a1e45fbaaaff3c9cbf6cfbeea08 Parents: 1f21273 Author: Henryk KonsekAuthored: Tue Dec 1 16:30:22 2015 +0100 Committer: Henryk Konsek Committed: Tue Dec 1 16:30:22 2015 +0100 -- components/camel-amqp/pom.xml | 22 ++-- .../camel/component/amqp/AMQPComponent.java | 11 ++-- .../camel/component/amqp/AMQPRouteTest.java | 20 +++ .../camel-amqp/src/test/resources/config.json | 27 - .../camel-amqp/src/test/resources/log4j.xml | 37 - components/camel-amqp/src/test/resources/passwd | 23 .../src/test/resources/virtualhosts.xml | 58 parent/pom.xml | 1 + .../features/src/main/resources/features.xml| 4 +- 9 files changed, 34 insertions(+), 169 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/pom.xml -- diff --git a/components/camel-amqp/pom.xml b/components/camel-amqp/pom.xml index b3aeed5..03ae156 100644 --- a/components/camel-amqp/pom.xml +++ b/components/camel-amqp/pom.xml @@ -30,6 +30,13 @@ Camel AMQP component which is based on the Apache Qid project + + + org.apache.qpid.jms, + ${camel.osgi.import.defaults}, + * + org.apache.camel.component.amqp.* org.apache.camel.spi.ComponentResolver;component=amqp @@ -46,8 +53,8 @@ org.apache.qpid - qpid-amqp-1-0-client-jms - ${qpid-version} + qpid-jms-client + ${qpid-jms-client-version} org.apache.qpid @@ -57,9 +64,14 @@ - org.apache.qpid - qpid-broker - ${qpid-version} + org.apache.activemq + activemq-broker + test + + + org.apache.activemq + activemq-amqp + ${activemq-version} test http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index 6397fd4..383b960 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -24,8 +24,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Component; import org.apache.camel.component.jms.JmsComponent; import org.apache.camel.component.jms.JmsConfiguration; -import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl; -import org.apache.qpid.client.AMQConnectionFactory; +import org.apache.qpid.jms.JmsConnectionFactory; /** * This component supports the AMQP protocol using the Client API of the Apache Qpid project. @@ -52,19 +51,19 @@ public class AMQPComponent extends JmsComponent { if (old) { return amqpComponentOld(uri); } -return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri)); +return new AMQPComponent(new JmsConnectionFactory(uri)); } public static Component amqpComponentOld(String uri) throws URISyntaxException { -return new AMQPComponent(new AMQConnectionFactory(uri)); +return new AMQPComponent(new JmsConnectionFactory(uri)); } public static Component amqpComponent(String uri) throws MalformedURLException { -return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri)); +return new AMQPComponent(new JmsConnectionFactory(uri)); } public static AMQPComponent amqp10Component(String uri) throws MalformedURLException { -ConnectionFactoryImpl connectionFactory = ConnectionFactoryImpl.createFromURL(uri); +JmsConnectionFactory connectionFactory = new JmsConnectionFactory(uri); connectionFactory.setTopicPrefix("topic://"); return new AMQPComponent(connectionFactory); } http://git-wip-us.apache.org/repos/asf/camel/blob/4997c2e9/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git
camel git commit: Removed unused test class.
Repository: camel Updated Branches: refs/heads/master 4997c2e92 -> be5580c8b Removed unused test class. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/be5580c8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/be5580c8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/be5580c8 Branch: refs/heads/master Commit: be5580c8b672f5718b6500335978c666554ec5e1 Parents: 4997c2e Author: Henryk KonsekAuthored: Tue Dec 1 16:36:12 2015 +0100 Committer: Henryk Konsek Committed: Tue Dec 1 16:36:12 2015 +0100 -- .../camel/component/amqp/PurchaseOrder.java | 69 1 file changed, 69 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/be5580c8/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/PurchaseOrder.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/PurchaseOrder.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/PurchaseOrder.java deleted file mode 100644 index 5b10f1f..000 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/PurchaseOrder.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * 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.component.amqp; - -import java.io.Serializable; - -/** - * A simple POJO for testing - * - * @version - */ -public class PurchaseOrder implements Serializable { -private static final long serialVersionUID = 1L; - -private String product; -private double amount; - -public PurchaseOrder(String product, double amount) { -this.product = product; -this.amount = amount; -} - -@Override -public boolean equals(Object other) { -if (this == other) { -return true; -} -if (other == null) { -return false; -} -if (this.getClass() != other.getClass()) { -return false; -} -PurchaseOrder that = (PurchaseOrder) other; -return this.product.equals(that.product) && this.amount == that.amount; -} - -@Override -public int hashCode() { -return product.hashCode() * 37 + (int) Math.round(amount); -} - -@Override -public String toString() { -return "PurchaseOrder[" + product + " x " + amount + "]"; -} - -public double getAmount() { -return amount; -} - -public String getProduct() { -return product; -} -} \ No newline at end of file
camel git commit: Added AMQP topic tests.
Repository: camel Updated Branches: refs/heads/master be5580c8b -> 15a00115b Added AMQP topic tests. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/15a00115 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/15a00115 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/15a00115 Branch: refs/heads/master Commit: 15a00115b2365a0bde3c1fc96e41d555d553b6ca Parents: be5580c Author: Henryk KonsekAuthored: Tue Dec 1 16:37:20 2015 +0100 Committer: Henryk Konsek Committed: Tue Dec 1 16:37:20 2015 +0100 -- .../camel/component/amqp/AMQPRouteTest.java | 30 +++- 1 file changed, 23 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/15a00115/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java index e78e035..e2a6f15 100644 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java +++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java @@ -24,23 +24,31 @@ import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Before; import org.junit.Test; -import static org.apache.camel.component.amqp.AMQPComponent.amqpComponent; +import static org.apache.camel.component.amqp.AMQPComponent.amqp10Component; public class AMQPRouteTest extends CamelTestSupport { + protected MockEndpoint resultEndpoint; + protected BrokerService broker; - -@Test -public void testJmsRouteWithTextMessage() throws Exception { -String expectedBody = "Hello there!"; -resultEndpoint.reset(); +String expectedBody = "Hello there!"; + +@Test +public void testJmsQueue() throws Exception { resultEndpoint.expectedMessageCount(1); resultEndpoint.message(0).header("cheese").isEqualTo(123); template.sendBodyAndHeader("amqp1-0:queue:ping", expectedBody, "cheese", 123); resultEndpoint.assertIsSatisfied(); } +@Test +public void testJmsTopic() throws Exception { +resultEndpoint.expectedMessageCount(2); +resultEndpoint.message(0).header("cheese").isEqualTo(123); +template.sendBodyAndHeader("amqp1-0:topic:ping", expectedBody, "cheese", 123); +resultEndpoint.assertIsSatisfied(); +} @Before public void setUp() throws Exception { @@ -61,7 +69,7 @@ public class AMQPRouteTest extends CamelTestSupport { protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); -camelContext.addComponent("amqp1-0", amqpComponent("amqp://localhost:5672", false)); +camelContext.addComponent("amqp1-0", amqp10Component("amqp://localhost:5672")); return camelContext; } @@ -71,6 +79,14 @@ public class AMQPRouteTest extends CamelTestSupport { from("amqp1-0:queue:ping") .to("log:routing") .to("mock:result"); + +from("amqp1-0:topic:ping") +.to("log:routing") +.to("mock:result"); + +from("amqp1-0:topic:ping") +.to("log:routing") +.to("mock:result"); } }; }
camel git commit: [CAMEL-9381] Removed AMQP 0.9 tests.
Repository: camel Updated Branches: refs/heads/master 87dbfa08d -> 1f2127362 [CAMEL-9381] Removed AMQP 0.9 tests. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1f212736 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1f212736 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1f212736 Branch: refs/heads/master Commit: 1f2127362409efa41b75d2b5bbf555b2ec6c6c99 Parents: 87dbfa0 Author: Henryk KonsekAuthored: Tue Dec 1 15:24:05 2015 +0100 Committer: Henryk Konsek Committed: Tue Dec 1 15:24:05 2015 +0100 -- .../apache/camel/component/amqp/AMQPRouteTest.java| 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1f212736/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java index b388698..1b63ad8 100644 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java +++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java @@ -27,9 +27,6 @@ import org.junit.Test; import static org.apache.camel.component.amqp.AMQPComponent.amqpComponent; -/** - * @version - */ public class AMQPRouteTest extends CamelTestSupport { protected MockEndpoint resultEndpoint; protected Broker broker; @@ -38,11 +35,6 @@ public class AMQPRouteTest extends CamelTestSupport { public void testJmsRouteWithTextMessage() throws Exception { String expectedBody = "Hello there!"; -resultEndpoint.expectedMessageCount(1); -resultEndpoint.message(0).header("cheese").isEqualTo(123); -template.sendBodyAndHeader("amqp0-9:queue:ping", expectedBody, "cheese", 123); -resultEndpoint.assertIsSatisfied(); - resultEndpoint.reset(); resultEndpoint.expectedMessageCount(1); resultEndpoint.message(0).header("cheese").isEqualTo(123); @@ -73,7 +65,6 @@ public class AMQPRouteTest extends CamelTestSupport { protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); -camelContext.addComponent("amqp0-9", amqpComponent("amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'", true)); camelContext.addComponent("amqp1-0", amqpComponent("amqp://guest:guest@localhost:5672?remote-host=test", false)); return camelContext; } @@ -81,14 +72,11 @@ public class AMQPRouteTest extends CamelTestSupport { protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { -from("amqp0-9:queue:ping") -.to("log:routing") -.to("mock:result"); - from("amqp1-0:queue:ping") .to("log:routing") .to("mock:result"); } }; } + }
camel git commit: [CAMEL-9381] Upgraded AMQP factory methods.
Repository: camel Updated Branches: refs/heads/master 15a00115b -> de6f32fe3 [CAMEL-9381] Upgraded AMQP factory methods. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/de6f32fe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/de6f32fe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/de6f32fe Branch: refs/heads/master Commit: de6f32fe309b1c9515a18288f96b62c904e0bae4 Parents: 15a0011 Author: Henryk KonsekAuthored: Tue Dec 1 17:14:21 2015 +0100 Committer: Henryk Konsek Committed: Tue Dec 1 17:14:21 2015 +0100 -- .../camel/component/amqp/AMQPComponent.java | 23 .../camel/component/amqp/AMQPRouteTest.java | 4 ++-- 2 files changed, 11 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/de6f32fe/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index 383b960..e326cf4 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -47,22 +47,17 @@ public class AMQPComponent extends JmsComponent { setConnectionFactory(connectionFactory); } -public static Component amqpComponent(String uri, boolean old) throws MalformedURLException, URISyntaxException { -if (old) { -return amqpComponentOld(uri); -} -return new AMQPComponent(new JmsConnectionFactory(uri)); -} - -public static Component amqpComponentOld(String uri) throws URISyntaxException { -return new AMQPComponent(new JmsConnectionFactory(uri)); -} - -public static Component amqpComponent(String uri) throws MalformedURLException { -return new AMQPComponent(new JmsConnectionFactory(uri)); +/** + * Use {@code amqpComponent(String uri)} instead. + */ +@Deprecated +public static AMQPComponent amqp10Component(String uri) throws MalformedURLException { +JmsConnectionFactory connectionFactory = new JmsConnectionFactory(uri); +connectionFactory.setTopicPrefix("topic://"); +return new AMQPComponent(connectionFactory); } -public static AMQPComponent amqp10Component(String uri) throws MalformedURLException { +public static AMQPComponent amqpComponent(String uri) { JmsConnectionFactory connectionFactory = new JmsConnectionFactory(uri); connectionFactory.setTopicPrefix("topic://"); return new AMQPComponent(connectionFactory); http://git-wip-us.apache.org/repos/asf/camel/blob/de6f32fe/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java index e2a6f15..73ac9e0 100644 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java +++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java @@ -24,7 +24,7 @@ import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Before; import org.junit.Test; -import static org.apache.camel.component.amqp.AMQPComponent.amqp10Component; +import static org.apache.camel.component.amqp.AMQPComponent.amqpComponent; public class AMQPRouteTest extends CamelTestSupport { @@ -69,7 +69,7 @@ public class AMQPRouteTest extends CamelTestSupport { protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); -camelContext.addComponent("amqp1-0", amqp10Component("amqp://localhost:5672")); +camelContext.addComponent("amqp1-0", amqpComponent("amqp://localhost:5672")); return camelContext; }
camel git commit: Improved AMQP test coverage.
Repository: camel Updated Branches: refs/heads/master de6f32fe3 -> 106783fee Improved AMQP test coverage. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/106783fe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/106783fe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/106783fe Branch: refs/heads/master Commit: 106783fee2b9de40f12e4f85cc01731af7b75aa3 Parents: de6f32f Author: Henryk KonsekAuthored: Tue Dec 1 17:31:18 2015 +0100 Committer: Henryk Konsek Committed: Tue Dec 1 17:31:18 2015 +0100 -- .../camel/component/amqp/AMQPComponent.java | 2 - .../camel/component/amqp/AMQPRouteTest.java | 48 2 files changed, 28 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/106783fe/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index e326cf4..3100e20 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -17,11 +17,9 @@ package org.apache.camel.component.amqp; import java.net.MalformedURLException; -import java.net.URISyntaxException; import javax.jms.ConnectionFactory; import org.apache.camel.CamelContext; -import org.apache.camel.Component; import org.apache.camel.component.jms.JmsComponent; import org.apache.camel.component.jms.JmsConfiguration; import org.apache.qpid.jms.JmsConnectionFactory; http://git-wip-us.apache.org/repos/asf/camel/blob/106783fe/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java -- diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java index 73ac9e0..d5d37db 100644 --- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java +++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java @@ -18,22 +18,38 @@ package org.apache.camel.component.amqp; import org.apache.activemq.broker.BrokerService; import org.apache.camel.CamelContext; +import org.apache.camel.EndpointInject; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import static org.apache.camel.component.amqp.AMQPComponent.amqpComponent; public class AMQPRouteTest extends CamelTestSupport { -protected MockEndpoint resultEndpoint; +static BrokerService broker; -protected BrokerService broker; +@EndpointInject(uri = "mock:result") +MockEndpoint resultEndpoint; String expectedBody = "Hello there!"; +@BeforeClass +public static void beforeClass() throws Exception { +broker = new BrokerService(); +broker.setPersistent(false); +broker.addConnector("amqp://0.0.0.0:5672"); +broker.start(); +} + +@AfterClass +public static void afterClass() throws Exception { +broker.stop(); +} + @Test public void testJmsQueue() throws Exception { resultEndpoint.expectedMessageCount(1); @@ -43,6 +59,12 @@ public class AMQPRouteTest extends CamelTestSupport { } @Test +public void testRequestReply() { +String response = template.requestBody("amqp1-0:queue:inOut", expectedBody, String.class); +assertEquals("response", response); +} + +@Test public void testJmsTopic() throws Exception { resultEndpoint.expectedMessageCount(2); resultEndpoint.message(0).header("cheese").isEqualTo(123); @@ -50,23 +72,6 @@ public class AMQPRouteTest extends CamelTestSupport { resultEndpoint.assertIsSatisfied(); } -@Before -public void setUp() throws Exception { -broker = new BrokerService(); -broker.setPersistent(false); -broker.addConnector("amqp://0.0.0.0:5672"); -broker.start(); - -super.setUp(); -resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class); -} - -@Override -public void tearDown() throws Exception { -super.tearDown(); -broker.stop(); -} - protected CamelContext
camel git commit: [CAMEL-9357] KuraRouter should provide default routes configuration.
Repository: camel Updated Branches: refs/heads/master 385a4b4fc -> f13b8851c [CAMEL-9357] KuraRouter should provide default routes configuration. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f13b8851 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f13b8851 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f13b8851 Branch: refs/heads/master Commit: f13b8851c61e6a08405903b9608d3ef0994af53b Parents: 385a4b4 Author: Henryk KonsekAuthored: Tue Nov 24 09:42:28 2015 +0100 Committer: Henryk Konsek Committed: Tue Nov 24 09:42:28 2015 +0100 -- .../main/java/org/apache/camel/component/kura/KuraRouter.java | 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f13b8851/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index 7c5c00b..fcb1dcd 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -105,6 +105,11 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator // Callbacks +@Override +public void configure() throws Exception { +log.debug("No programmatic routes configuration found."); +} + protected CamelContext createCamelContext() { return new OsgiDefaultCamelContext(bundleContext); }
camel git commit: [CAMEL-9351] Kura router should offer SCR programming model.
Repository: camel Updated Branches: refs/heads/master 5ebb037a1 -> b914c04cc [CAMEL-9351] Kura router should offer SCR programming model. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b914c04c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b914c04c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b914c04c Branch: refs/heads/master Commit: b914c04ccfb0a16020bd4eb0396d51a08804eaa7 Parents: 5ebb037 Author: Henryk KonsekAuthored: Mon Nov 23 10:33:25 2015 +0100 Committer: Henryk Konsek Committed: Mon Nov 23 10:33:25 2015 +0100 -- .../java/org/apache/camel/component/kura/KuraRouter.java | 10 ++ 1 file changed, 10 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b914c04c/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index 96865cd..7c5c00b 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -18,6 +18,7 @@ package org.apache.camel.component.kura; import java.io.ByteArrayInputStream; import java.io.InputStream; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.ConsumerTemplate; @@ -30,6 +31,7 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -93,6 +95,14 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator log.debug("Bundle {} stopped.", bundleContext.getBundle().getBundleId()); } +protected void activate(ComponentContext componentContext, Map properties) throws Exception { +start(componentContext.getBundleContext()); +} + +protected void deactivate(ComponentContext componentContext) throws Exception { +stop(componentContext.getBundleContext()); +} + // Callbacks protected CamelContext createCamelContext() {
camel git commit: Added PID callback to KuraRouter.
Repository: camel Updated Branches: refs/heads/master 1f7264f85 -> 26368f7ab Added PID callback to KuraRouter. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/26368f7a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/26368f7a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/26368f7a Branch: refs/heads/master Commit: 26368f7ab7962f4eba1bdbb83f2d161fe31c403e Parents: 1f7264f Author: Henryk KonsekAuthored: Thu Nov 19 22:40:16 2015 +0100 Committer: Henryk Konsek Committed: Thu Nov 19 22:40:34 2015 +0100 -- .../java/org/apache/camel/component/kura/KuraRouter.java | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/26368f7a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index ea10ae1..96865cd 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -58,7 +58,7 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator camelContext.addRoutes(this); ConfigurationAdmin configurationAdmin = requiredService(ConfigurationAdmin.class); -Configuration camelKuraConfig = configurationAdmin.getConfiguration("kura.camel"); +Configuration camelKuraConfig = configurationAdmin.getConfiguration(camelXmlRoutesPid()); if (camelKuraConfig != null && camelKuraConfig.getProperties() != null) { Object routePropertyValue = camelKuraConfig.getProperties().get(camelXmlRoutesProperty()); if (routePropertyValue != null) { @@ -120,7 +120,11 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator // Private helpers -private String camelXmlRoutesProperty() { +protected String camelXmlRoutesPid() { +return "kura.camel"; +} + +protected String camelXmlRoutesProperty() { return "kura.camel." + bundleContext.getBundle().getSymbolicName() + ".route"; }
camel git commit: [CAMEL-9333] KuraRouter should try to load XML routes from ConfigAdmin
Repository: camel Updated Branches: refs/heads/master 018d9849e -> 1a26ccf58 [CAMEL-9333] KuraRouter should try to load XML routes from ConfigAdmin Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1a26ccf5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1a26ccf5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1a26ccf5 Branch: refs/heads/master Commit: 1a26ccf58ddcf34fa04b13bff5fbce04b6f1ff6e Parents: 018d984 Author: Henryk KonsekAuthored: Tue Nov 17 11:27:29 2015 +0100 Committer: Henryk Konsek Committed: Tue Nov 17 11:27:58 2015 +0100 -- components/camel-kura/pom.xml | 5 .../apache/camel/component/kura/KuraRouter.java | 22 ++ .../camel/component/kura/KuraRouterTest.java| 30 +++- .../camel-kura/src/test/resources/route.xml | 6 4 files changed, 62 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1a26ccf5/components/camel-kura/pom.xml -- diff --git a/components/camel-kura/pom.xml b/components/camel-kura/pom.xml index 4bf22e8..35580b9 100644 --- a/components/camel-kura/pom.xml +++ b/components/camel-kura/pom.xml @@ -71,6 +71,11 @@ mockito-core test + +commons-io +commons-io +test + http://git-wip-us.apache.org/repos/asf/camel/blob/1a26ccf5/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index b3f16ca..ea10ae1 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -16,14 +16,20 @@ */ package org.apache.camel.component.kura; +import java.io.ByteArrayInputStream; +import java.io.InputStream; + import org.apache.camel.CamelContext; import org.apache.camel.ConsumerTemplate; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.core.osgi.OsgiDefaultCamelContext; +import org.apache.camel.model.RoutesDefinition; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,6 +57,16 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator camelContext = createCamelContext(); camelContext.addRoutes(this); +ConfigurationAdmin configurationAdmin = requiredService(ConfigurationAdmin.class); +Configuration camelKuraConfig = configurationAdmin.getConfiguration("kura.camel"); +if (camelKuraConfig != null && camelKuraConfig.getProperties() != null) { +Object routePropertyValue = camelKuraConfig.getProperties().get(camelXmlRoutesProperty()); +if (routePropertyValue != null) { +InputStream routesXml = new ByteArrayInputStream(routePropertyValue.toString().getBytes()); +RoutesDefinition loadedRoutes = camelContext.loadRoutesDefinition(routesXml); +camelContext.addRouteDefinitions(loadedRoutes.getRoutes()); +} +} beforeStart(camelContext); log.debug("About to start Camel Kura router: {}", getClass().getName()); @@ -102,4 +118,10 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator return (T) bundleContext.getService(reference); } +// Private helpers + +private String camelXmlRoutesProperty() { +return "kura.camel." + bundleContext.getBundle().getSymbolicName() + ".route"; +} + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/1a26ccf5/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java -- diff --git a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java index 97822bd..b184af9 100644 --- a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java +++
camel git commit: Added missing license.
Repository: camel Updated Branches: refs/heads/master 1a26ccf58 -> 5068678c4 Added missing license. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5068678c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5068678c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5068678c Branch: refs/heads/master Commit: 5068678c43695ed3811b4c1f2edea8f0b2b0a59c Parents: 1a26ccf Author: Henryk KonsekAuthored: Tue Nov 17 11:28:40 2015 +0100 Committer: Henryk Konsek Committed: Tue Nov 17 11:28:40 2015 +0100 -- .../camel-kura/src/test/resources/route.xml | 18 ++ 1 file changed, 18 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5068678c/components/camel-kura/src/test/resources/route.xml -- diff --git a/components/camel-kura/src/test/resources/route.xml b/components/camel-kura/src/test/resources/route.xml index ca034ea..1cc1d8b 100644 --- a/components/camel-kura/src/test/resources/route.xml +++ b/components/camel-kura/src/test/resources/route.xml @@ -1,3 +1,21 @@ + http://camel.apache.org/schema/spring;>
camel git commit: [CAMEL-9329] Kura router should provide OSGi compendium services.
Repository: camel Updated Branches: refs/heads/master ba8480357 -> dc0b730f6 [CAMEL-9329] Kura router should provide OSGi compendium services. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dc0b730f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dc0b730f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dc0b730f Branch: refs/heads/master Commit: dc0b730f68ece9d593fcd6f3c65d146f9e05c31f Parents: ba84803 Author: Henryk KonsekAuthored: Mon Nov 16 10:22:34 2015 +0100 Committer: Henryk Konsek Committed: Mon Nov 16 10:22:34 2015 +0100 -- components/camel-kura/pom.xml | 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/dc0b730f/components/camel-kura/pom.xml -- diff --git a/components/camel-kura/pom.xml b/components/camel-kura/pom.xml index e264cdb..4bf22e8 100644 --- a/components/camel-kura/pom.xml +++ b/components/camel-kura/pom.xml @@ -37,6 +37,7 @@ 1.6.4 3.8.1.v20120830-144521 + 3.3.100.v20120522-1822 @@ -50,6 +51,11 @@ ${eclipse-osgi.version} +org.eclipse.birt.runtime +org.eclipse.osgi.services +${eclipse-osgi-services.version} + + org.slf4j slf4j-api ${kura-slf4j.version}
camel git commit: [CAMEL-9328] KuraRouter should provide required and option service resolvers.
Repository: camel Updated Branches: refs/heads/master dc0b730f6 -> 005df4cb7 [CAMEL-9328] KuraRouter should provide required and option service resolvers. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/005df4cb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/005df4cb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/005df4cb Branch: refs/heads/master Commit: 005df4cb73063d19ae11e79a4106ba30c235f24c Parents: dc0b730 Author: Henryk KonsekAuthored: Mon Nov 16 10:24:21 2015 +0100 Committer: Henryk Konsek Committed: Mon Nov 16 10:24:21 2015 +0100 -- .../apache/camel/component/kura/KuraRouter.java | 10 ++ .../camel/component/kura/KuraRouterTest.java | 19 +++ 2 files changed, 29 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/005df4cb/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index 1548633..b3f16ca 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -49,7 +49,9 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator this.bundleContext = bundleContext; log.debug("Initializing bundle {}.", bundleContext.getBundle().getBundleId()); camelContext = createCamelContext(); + camelContext.addRoutes(this); + beforeStart(camelContext); log.debug("About to start Camel Kura router: {}", getClass().getName()); camelContext.start(); @@ -89,6 +91,14 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator protected T service(Class serviceType) { ServiceReference reference = bundleContext.getServiceReference(serviceType); +return reference == null ? null : (T) bundleContext.getService(reference); +} + +protected T requiredService(Class serviceType) { +ServiceReference reference = bundleContext.getServiceReference(serviceType); +if (reference == null) { +throw new IllegalStateException("Cannot find service: " + serviceType.getName()); +} return (T) bundleContext.getService(reference); } http://git-wip-us.apache.org/repos/asf/camel/blob/005df4cb/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java -- diff --git a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java index 03fefa4..6e8dbf9 100644 --- a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java +++ b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java @@ -25,8 +25,10 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.osgi.framework.BundleContext; +import org.osgi.service.cm.ConfigurationAdmin; import static org.mockito.BDDMockito.given; +import static org.mockito.Matchers.any; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; @@ -76,6 +78,23 @@ public class KuraRouterTest extends Assert { assertNotNull(router.consumerTemplate); } +@Test +public void shouldReturnNoService() { + given(bundleContext.getServiceReference(any(Class.class))).willReturn(null); +assertNull(router.service(ConfigurationAdmin.class)); +} + +@Test +public void shouldReturnService() { +assertNotNull(router.service(ConfigurationAdmin.class)); +} + +@Test(expected = IllegalStateException.class) +public void shouldValidateLackOfService() { + given(bundleContext.getServiceReference(any(Class.class))).willReturn(null); +router.requiredService(ConfigurationAdmin.class); +} + } class TestKuraRouter extends KuraRouter {
camel git commit: Refactoring.
Repository: camel Updated Branches: refs/heads/master 005df4cb7 -> aa4191fec Refactoring. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aa4191fe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aa4191fe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aa4191fe Branch: refs/heads/master Commit: aa4191fec006d3c1161caadbacf02ec92f9cb70c Parents: 005df4c Author: Henryk KonsekAuthored: Mon Nov 16 10:26:26 2015 +0100 Committer: Henryk Konsek Committed: Mon Nov 16 10:26:26 2015 +0100 -- .../camel/component/kura/KuraRouterTest.java| 21 ++-- 1 file changed, 11 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/aa4191fe/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java -- diff --git a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java index 6e8dbf9..97822bd 100644 --- a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java +++ b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java @@ -95,18 +95,19 @@ public class KuraRouterTest extends Assert { router.requiredService(ConfigurationAdmin.class); } -} +static class TestKuraRouter extends KuraRouter { -class TestKuraRouter extends KuraRouter { +@Override +public void configure() throws Exception { +from("direct:start").to("mock:test"); +} -@Override -public void configure() throws Exception { -from("direct:start").to("mock:test"); -} +@Override +protected CamelContext createCamelContext() { +return new DefaultCamelContext(); +} -@Override -protected CamelContext createCamelContext() { -return new DefaultCamelContext(); } -} \ No newline at end of file +} +
camel git commit: Improved logging.
Repository: camel Updated Branches: refs/heads/master 02e3bc66b -> eb2ec72a2 Improved logging. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/eb2ec72a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/eb2ec72a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/eb2ec72a Branch: refs/heads/master Commit: eb2ec72a2e12d56c13d69410e7892cd5fc36661a Parents: 02e3bc6 Author: Henryk KonsekAuthored: Thu Nov 12 15:50:36 2015 +0100 Committer: Henryk Konsek Committed: Thu Nov 12 15:50:36 2015 +0100 -- .../src/main/java/org/apache/camel/component/kura/KuraRouter.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/eb2ec72a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index 9650da6..9233c29 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -48,6 +48,7 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator camelContext = createCamelContext(); camelContext.addRoutes(this); beforeStart(camelContext); +log.debug("About to start Camel Kura router: {}", getClass().getName()); camelContext.start(); producerTemplate = camelContext.createProducerTemplate(); log.debug("Bundle {} started.", bundleContext.getBundle().getBundleId());
camel git commit: [CAMEL-9314] Improve error logging in Kura router
Repository: camel Updated Branches: refs/heads/master 7e28d0af4 -> 02e3bc66b [CAMEL-9314] Improve error logging in Kura router Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/02e3bc66 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/02e3bc66 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/02e3bc66 Branch: refs/heads/master Commit: 02e3bc66bcbfef8b46a4c1e24f14af657d8210f5 Parents: 7e28d0a Author: Henryk KonsekAuthored: Thu Nov 12 15:47:18 2015 +0100 Committer: Henryk Konsek Committed: Thu Nov 12 15:47:18 2015 +0100 -- .../apache/camel/component/kura/KuraRouter.java | 27 ++-- 1 file changed, 19 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/02e3bc66/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index 2dfda67..9650da6 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -42,14 +42,25 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator @Override public void start(BundleContext bundleContext) throws Exception { -this.bundleContext = bundleContext; -log.debug("Initializing bundle {}.", bundleContext.getBundle().getBundleId()); -camelContext = createCamelContext(); -camelContext.addRoutes(this); -beforeStart(camelContext); -camelContext.start(); -producerTemplate = camelContext.createProducerTemplate(); -log.debug("Bundle {} started.", bundleContext.getBundle().getBundleId()); +try { +this.bundleContext = bundleContext; +log.debug("Initializing bundle {}.", bundleContext.getBundle().getBundleId()); +camelContext = createCamelContext(); +camelContext.addRoutes(this); +beforeStart(camelContext); +camelContext.start(); +producerTemplate = camelContext.createProducerTemplate(); +log.debug("Bundle {} started.", bundleContext.getBundle().getBundleId()); +} catch (Throwable e) { +String errorMessage = "Problem when starting Kura module " + getClass().getName() + ":"; +log.warn(errorMessage, e); + +// Print error to the Kura console. +System.err.println(errorMessage); +e.printStackTrace(); + +throw e; +} } @Override
camel git commit: [CAMEL-9315] KuraRouter should provide consumer template
Repository: camel Updated Branches: refs/heads/master eb2ec72a2 -> d16c52f58 [CAMEL-9315] KuraRouter should provide consumer template Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d16c52f5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d16c52f5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d16c52f5 Branch: refs/heads/master Commit: d16c52f5820c162be78625c65735a743cf76546e Parents: eb2ec72 Author: Henryk KonsekAuthored: Thu Nov 12 15:56:43 2015 +0100 Committer: Henryk Konsek Committed: Thu Nov 12 15:56:43 2015 +0100 -- .../main/java/org/apache/camel/component/kura/KuraRouter.java | 4 .../java/org/apache/camel/component/kura/KuraRouterTest.java| 5 + 2 files changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d16c52f5/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java -- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index 9233c29..1548633 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -17,6 +17,7 @@ package org.apache.camel.component.kura; import org.apache.camel.CamelContext; +import org.apache.camel.ConsumerTemplate; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.core.osgi.OsgiDefaultCamelContext; @@ -38,6 +39,8 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator protected ProducerTemplate producerTemplate; +protected ConsumerTemplate consumerTemplate; + // Lifecycle @Override @@ -51,6 +54,7 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator log.debug("About to start Camel Kura router: {}", getClass().getName()); camelContext.start(); producerTemplate = camelContext.createProducerTemplate(); +consumerTemplate = camelContext.createConsumerTemplate(); log.debug("Bundle {} started.", bundleContext.getBundle().getBundleId()); } catch (Throwable e) { String errorMessage = "Problem when starting Kura module " + getClass().getName() + ":"; http://git-wip-us.apache.org/repos/asf/camel/blob/d16c52f5/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java -- diff --git a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java index ba03eef..03fefa4 100644 --- a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java +++ b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java @@ -71,6 +71,11 @@ public class KuraRouterTest extends Assert { mockEndpoint.assertIsSatisfied(); } +@Test +public void shouldCreateConsumerTemplate() throws Exception { +assertNotNull(router.consumerTemplate); +} + } class TestKuraRouter extends KuraRouter {
camel git commit: [CAMEL-9256] Paho file persistence store should be configurable
Repository: camel Updated Branches: refs/heads/camel-2.16.x e791fc277 -> 8ad367357 [CAMEL-9256] Paho file persistence store should be configurable Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8ad36735 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8ad36735 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8ad36735 Branch: refs/heads/camel-2.16.x Commit: 8ad3673577846167376a6fe18d7fec853ec4e703 Parents: e791fc2 Author: Henryk KonsekAuthored: Mon Oct 26 12:01:37 2015 +0100 Committer: Henryk Konsek Committed: Mon Oct 26 12:01:37 2015 +0100 -- .../camel/component/paho/PahoEndpoint.java | 23 +++- 1 file changed, 22 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/8ad36735/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java index 2b38b2e..08b55f4 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java @@ -64,6 +64,8 @@ public class PahoEndpoint extends DefaultEndpoint { private int qos = DEFAULT_QOS; @UriParam(defaultValue = "MEMORY") private PahoPersistence persistence = MEMORY; +@UriParam(description = "Base directory used by file persistence.", defaultValue = "Current directory") +private String filePersistenceDirectory; // Collaboration members @UriParam @@ -116,7 +118,15 @@ public class PahoEndpoint extends DefaultEndpoint { // Resolvers protected MqttClientPersistence resolvePersistence() { -return persistence == MEMORY ? new MemoryPersistence() : new MqttDefaultFilePersistence(); +if (persistence == MEMORY) { +return new MemoryPersistence(); +} else { +if (filePersistenceDirectory != null) { +return new MqttDefaultFilePersistence(filePersistenceDirectory); +} else { +return new MqttDefaultFilePersistence(); +} +} } protected MqttConnectOptions resolveMqttConnectOptions() { @@ -194,6 +204,17 @@ public class PahoEndpoint extends DefaultEndpoint { this.persistence = persistence; } +public String getFilePersistenceDirectory() { +return filePersistenceDirectory; +} + +/** + * Base directory used by the file persistence provider. + */ +public void setFilePersistenceDirectory(String filePersistenceDirectory) { +this.filePersistenceDirectory = filePersistenceDirectory; +} + public MqttClient getClient() { return client; }
camel git commit: Updated Javadoc.
Repository: camel Updated Branches: refs/heads/master 0f393b668 -> 30e34e7bd Updated Javadoc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/30e34e7b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/30e34e7b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/30e34e7b Branch: refs/heads/master Commit: 30e34e7bd5bc8c2eeaeee61239571ad14588ca1e Parents: 0f393b6 Author: Henryk KonsekAuthored: Mon Oct 26 12:05:05 2015 +0100 Committer: Henryk Konsek Committed: Mon Oct 26 12:05:05 2015 +0100 -- .../java/org/apache/camel/component/paho/PahoComponent.java | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/30e34e7b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java index 3756a67..acc2d20 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java @@ -22,6 +22,9 @@ import org.apache.camel.Endpoint; import org.apache.camel.impl.UriEndpointComponent; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +/** + * Component to integrate with the Eclispe Paho MQTT library. + */ public class PahoComponent extends UriEndpointComponent { private String brokerUrl; @@ -32,6 +35,8 @@ public class PahoComponent extends UriEndpointComponent { super(PahoEndpoint.class); } +// Overridden + @Override protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { PahoEndpoint answer = new PahoEndpoint(uri, remaining, this); @@ -50,6 +55,8 @@ public class PahoComponent extends UriEndpointComponent { return answer; } +// Getters and setters + public String getBrokerUrl() { return brokerUrl; }
camel git commit: [CAMEL-9256] Paho file persistence store should be configurable
Repository: camel Updated Branches: refs/heads/master b45652154 -> 0f393b668 [CAMEL-9256] Paho file persistence store should be configurable Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0f393b66 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0f393b66 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0f393b66 Branch: refs/heads/master Commit: 0f393b668ee87961d3f66bf300eb4ffcfb9c49ea Parents: b456521 Author: Henryk KonsekAuthored: Mon Oct 26 11:58:47 2015 +0100 Committer: Henryk Konsek Committed: Mon Oct 26 11:58:47 2015 +0100 -- .../camel/component/paho/PahoEndpoint.java | 23 +++- 1 file changed, 22 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/0f393b66/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java index bc6ee97..0527306 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java @@ -62,6 +62,8 @@ public class PahoEndpoint extends DefaultEndpoint { private int qos = DEFAULT_QOS; @UriParam(defaultValue = "MEMORY") private PahoPersistence persistence = MEMORY; +@UriParam(description = "Base directory used by file persistence.", defaultValue = "Current directory") +private String filePersistenceDirectory; // Collaboration members @UriParam @@ -114,7 +116,15 @@ public class PahoEndpoint extends DefaultEndpoint { // Resolvers protected MqttClientPersistence resolvePersistence() { -return persistence == MEMORY ? new MemoryPersistence() : new MqttDefaultFilePersistence(); +if (persistence == MEMORY) { +return new MemoryPersistence(); +} else { +if (filePersistenceDirectory != null) { +return new MqttDefaultFilePersistence(filePersistenceDirectory); +} else { +return new MqttDefaultFilePersistence(); +} +} } protected MqttConnectOptions resolveMqttConnectOptions() { @@ -203,6 +213,17 @@ public class PahoEndpoint extends DefaultEndpoint { this.persistence = persistence; } +public String getFilePersistenceDirectory() { +return filePersistenceDirectory; +} + +/** + * Base directory used by the file persistence provider. + */ +public void setFilePersistenceDirectory(String filePersistenceDirectory) { +this.filePersistenceDirectory = filePersistenceDirectory; +} + public MqttClient getClient() { return client; }
camel git commit: [CAMEL-9245] camel-paho - Endpoint should allow a flexible naming.
Repository: camel Updated Branches: refs/heads/master 0ddf4b1ca -> 14e9236ac [CAMEL-9245] camel-paho - Endpoint should allow a flexible naming. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/14e9236a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/14e9236a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/14e9236a Branch: refs/heads/master Commit: 14e9236aca9e1cd93f180158767d7e102257f1b6 Parents: 0ddf4b1 Author: Henryk KonsekAuthored: Sun Oct 25 21:28:39 2015 +0100 Committer: Henryk Konsek Committed: Sun Oct 25 21:28:39 2015 +0100 -- .../camel/component/paho/PahoComponent.java | 2 +- .../camel/component/paho/PahoEndpoint.java | 11 ++--- .../camel/component/paho/PahoComponentTest.java | 24 +++- 3 files changed, 26 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/14e9236a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java index c9cbc41..3756a67 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java @@ -34,7 +34,7 @@ public class PahoComponent extends UriEndpointComponent { @Override protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { -PahoEndpoint answer = new PahoEndpoint(uri, this); +PahoEndpoint answer = new PahoEndpoint(uri, remaining, this); if (brokerUrl != null) { answer.setBrokerUrl(brokerUrl); http://git-wip-us.apache.org/repos/asf/camel/blob/14e9236a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java index 4264522..bc6ee97 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java @@ -71,16 +71,9 @@ public class PahoEndpoint extends DefaultEndpoint { private transient MqttClient client; -public PahoEndpoint(String uri, Component component) { +public PahoEndpoint(String uri, String topic, Component component) { super(uri, component); -if (topic == null) { -int optionIndex = uri.indexOf("?"); -if (optionIndex > 0) { -topic = uri.substring(7, optionIndex); -} else { -topic = uri.substring(7); -} -} +this.topic = topic; } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/14e9236a/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java -- diff --git a/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java b/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java index 8013f8f..27f0ed8 100644 --- a/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java +++ b/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java @@ -36,7 +36,10 @@ public class PahoComponentTest extends CamelTestSupport { @EndpointInject(uri = "mock:test") MockEndpoint mock; - + +@EndpointInject(uri = "mock:testCustomizedPaho") +MockEndpoint testCustomizedPahoMock; + BrokerService broker; int mqttPort = AvailablePortFinder.getNextAvailable(); @@ -66,6 +69,9 @@ public class PahoComponentTest extends CamelTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { +PahoComponent customizedPaho = new PahoComponent(); +context.addComponent("customizedPaho", customizedPaho); + from("direct:test").to("paho:queue?brokerUrl=tcp://localhost:" + mqttPort); from("paho:queue?brokerUrl=tcp://localhost:" + mqttPort).to("mock:test"); @@ -74,6 +80,9 @@ public class PahoComponentTest extends CamelTestSupport {
camel git commit: [CAMEL-9245] camel-paho - Endpoint should allow a flexible naming.
Repository: camel Updated Branches: refs/heads/camel-2.16.x 5005e3f74 -> e791fc277 [CAMEL-9245] camel-paho - Endpoint should allow a flexible naming. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e791fc27 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e791fc27 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e791fc27 Branch: refs/heads/camel-2.16.x Commit: e791fc27756fddce2eaa759c86250c8c5e7f9a0f Parents: 5005e3f Author: Henryk KonsekAuthored: Sun Oct 25 21:39:36 2015 +0100 Committer: Henryk Konsek Committed: Sun Oct 25 21:39:36 2015 +0100 -- .../java/org/apache/camel/component/paho/PahoComponent.java| 2 +- .../java/org/apache/camel/component/paho/PahoEndpoint.java | 6 ++ 2 files changed, 3 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e791fc27/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java index 232d38e..fd11188 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java @@ -34,7 +34,7 @@ public class PahoComponent extends UriEndpointComponent { @Override protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { -PahoEndpoint answer = new PahoEndpoint(uri, this); +PahoEndpoint answer = new PahoEndpoint(uri, remaining, this); if (brokerUrl != null) { answer.setBrokerUrl(brokerUrl); http://git-wip-us.apache.org/repos/asf/camel/blob/e791fc27/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java index 5ca943a..2b38b2e 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java @@ -73,11 +73,9 @@ public class PahoEndpoint extends DefaultEndpoint { private transient MqttClient client; -public PahoEndpoint(String uri, Component component) { +public PahoEndpoint(String uri, String topic, Component component) { super(uri, component); -if (topic == null) { -topic = uri.substring(7); -} +this.topic = topic; } @Override
camel git commit: Improved Javadoc.
Repository: camel Updated Branches: refs/heads/master 14e9236ac -> bd3c4c4b1 Improved Javadoc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bd3c4c4b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bd3c4c4b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bd3c4c4b Branch: refs/heads/master Commit: bd3c4c4b1327effdc1a4241105d8b729f9a4d27a Parents: 14e9236 Author: Henryk KonsekAuthored: Sun Oct 25 21:53:03 2015 +0100 Committer: Henryk Konsek Committed: Sun Oct 25 21:53:03 2015 +0100 -- .../java/org/apache/camel/component/paho/PahoConstants.java| 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/bd3c4c4b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java index 4c8d1ff..8b6a932 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java @@ -16,8 +16,14 @@ */ package org.apache.camel.component.paho; +/** + * Constants to use when working with Paho component. + */ public final class PahoConstants { +/** + * Header indicating a topic of a MQTT message. + */ public static final String MQTT_TOPIC = "CamelMqttTopic"; @Deprecated
camel git commit: [CAMEL-9203] camel-amqp should provide qpid dependencies
Repository: camel Updated Branches: refs/heads/master 899e34191 -> 015532438 [CAMEL-9203] camel-amqp should provide qpid dependencies Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/01553243 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/01553243 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/01553243 Branch: refs/heads/master Commit: 015532438780c84fa46cb8e9bc9b353662177712 Parents: 899e341 Author: Henryk KonsekAuthored: Fri Oct 9 09:23:22 2015 +0200 Committer: Henryk Konsek Committed: Fri Oct 9 09:23:22 2015 +0200 -- components/camel-amqp/pom.xml | 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/01553243/components/camel-amqp/pom.xml -- diff --git a/components/camel-amqp/pom.xml b/components/camel-amqp/pom.xml index cbb063f..b3aeed5 100644 --- a/components/camel-amqp/pom.xml +++ b/components/camel-amqp/pom.xml @@ -48,13 +48,11 @@ org.apache.qpid qpid-amqp-1-0-client-jms ${qpid-version} - true org.apache.qpid qpid-client ${qpid-version} -true
camel git commit: [CAMEL-9204] Provide AMQP component factory method for AMQP 1.0.
Repository: camel Updated Branches: refs/heads/master 015532438 -> 8b4b19faf [CAMEL-9204] Provide AMQP component factory method for AMQP 1.0. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8b4b19fa Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8b4b19fa Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8b4b19fa Branch: refs/heads/master Commit: 8b4b19faffd17f281db1a24ad5d32e497d35e940 Parents: 0155324 Author: Henryk KonsekAuthored: Fri Oct 9 10:05:08 2015 +0200 Committer: Henryk Konsek Committed: Fri Oct 9 10:05:08 2015 +0200 -- .../java/org/apache/camel/component/amqp/AMQPComponent.java| 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/8b4b19fa/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index 1d465bf..6397fd4 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -63,4 +63,10 @@ public class AMQPComponent extends JmsComponent { return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri)); } +public static AMQPComponent amqp10Component(String uri) throws MalformedURLException { +ConnectionFactoryImpl connectionFactory = ConnectionFactoryImpl.createFromURL(uri); +connectionFactory.setTopicPrefix("topic://"); +return new AMQPComponent(connectionFactory); +} + }
camel git commit: Updated Javadoc.
Repository: camel Updated Branches: refs/heads/master 8b4b19faf -> e205f90e5 Updated Javadoc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e205f90e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e205f90e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e205f90e Branch: refs/heads/master Commit: e205f90e53b36cbdc8d2bc9055eee8f9209b3948 Parents: 8b4b19f Author: Henryk KonsekAuthored: Fri Oct 9 10:11:13 2015 +0200 Committer: Henryk Konsek Committed: Fri Oct 9 10:11:13 2015 +0200 -- .../main/java/org/apache/camel/component/amqp/AMQPEndpoint.java | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e205f90e/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPEndpoint.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPEndpoint.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPEndpoint.java index ce630f6..4fb5c9e 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPEndpoint.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPEndpoint.java @@ -22,6 +22,10 @@ import org.apache.camel.spi.UriEndpoint; @UriEndpoint(scheme = "amqp", extendsScheme = "jms", title = "AMQP", syntax = "amqp:destinationType:destinationName", consumerClass = JmsConsumer.class, label = "messaging") +/** + * AMQP endpoint. This class extends JmsEndpoint because it uses Apache Qpid JMS-compatible client for + * performing the AMQP connectivity. + */ public class AMQPEndpoint extends JmsEndpoint { }
camel git commit: [CAMEL-9204] Provide AMQP component factory method for AMQP 1.0. (cherry picked from commit 8b4b19f)
Repository: camel Updated Branches: refs/heads/camel-2.16.x e21ccdb2e -> 252bee8ed [CAMEL-9204] Provide AMQP component factory method for AMQP 1.0. (cherry picked from commit 8b4b19f) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/252bee8e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/252bee8e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/252bee8e Branch: refs/heads/camel-2.16.x Commit: 252bee8ede067c5b0cd1de394319fee34f94050d Parents: e21ccdb Author: Henryk KonsekAuthored: Fri Oct 9 10:05:08 2015 +0200 Committer: Henryk Konsek Committed: Fri Oct 9 10:15:46 2015 +0200 -- .../java/org/apache/camel/component/amqp/AMQPComponent.java| 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/252bee8e/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java -- diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java index 1d465bf..6397fd4 100644 --- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java +++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java @@ -63,4 +63,10 @@ public class AMQPComponent extends JmsComponent { return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri)); } +public static AMQPComponent amqp10Component(String uri) throws MalformedURLException { +ConnectionFactoryImpl connectionFactory = ConnectionFactoryImpl.createFromURL(uri); +connectionFactory.setTopicPrefix("topic://"); +return new AMQPComponent(connectionFactory); +} + }
camel git commit: [CAMEL-9203] camel-amqp should provide qpid dependencies (cherry picked from commit 0155324)
Repository: camel Updated Branches: refs/heads/camel-2.16.x 2d6fcb484 -> e21ccdb2e [CAMEL-9203] camel-amqp should provide qpid dependencies (cherry picked from commit 0155324) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e21ccdb2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e21ccdb2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e21ccdb2 Branch: refs/heads/camel-2.16.x Commit: e21ccdb2e71d57ef4c344f7554dd91a5ef88f0ae Parents: 2d6fcb4 Author: Henryk KonsekAuthored: Fri Oct 9 09:23:22 2015 +0200 Committer: Henryk Konsek Committed: Fri Oct 9 10:15:35 2015 +0200 -- components/camel-amqp/pom.xml | 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e21ccdb2/components/camel-amqp/pom.xml -- diff --git a/components/camel-amqp/pom.xml b/components/camel-amqp/pom.xml index b7b46c8..5050ce0 100644 --- a/components/camel-amqp/pom.xml +++ b/components/camel-amqp/pom.xml @@ -48,13 +48,11 @@ org.apache.qpid qpid-amqp-1-0-client-jms ${qpid-version} - true org.apache.qpid qpid-client ${qpid-version} -true
camel git commit: [CAMEL-9029] JGroups managed routes can be started too early. (cherry picked from commit 22b3a36)
Repository: camel Updated Branches: refs/heads/camel-2.15.x 3b38ddc3f - 9acec2e7a [CAMEL-9029] JGroups managed routes can be started too early. (cherry picked from commit 22b3a36) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9acec2e7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9acec2e7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9acec2e7 Branch: refs/heads/camel-2.15.x Commit: 9acec2e7ab61ad7d8f4a79a5167c212bd9176baf Parents: 3b38ddc Author: Henryk Konsek hekon...@gmail.com Authored: Tue Jul 28 16:09:30 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue Jul 28 16:12:42 2015 +0200 -- .../java/org/apache/camel/component/jgroups/JGroupsFilters.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/9acec2e7/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java -- diff --git a/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java b/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java index 468feeb..4711198 100644 --- a/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java +++ b/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java @@ -63,7 +63,7 @@ public final class JGroupsFilters { return channelAddress.equals(coordinatorNodeAddress); } LOG.debug(Body {} is not an instance of org.jgroups.View . Skipping filter., body); -return true; +return false; } }; }
camel git commit: [CAMEL-9029] JGroups managed routes can be started too early.
Repository: camel Updated Branches: refs/heads/master 61887fa20 - 22b3a36bd [CAMEL-9029] JGroups managed routes can be started too early. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/22b3a36b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/22b3a36b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/22b3a36b Branch: refs/heads/master Commit: 22b3a36bd08e2c681bed1a673b0a8cf333223e0f Parents: 61887fa Author: Henryk Konsek hekon...@gmail.com Authored: Tue Jul 28 16:09:30 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue Jul 28 16:09:30 2015 +0200 -- .../java/org/apache/camel/component/jgroups/JGroupsFilters.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/22b3a36b/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java -- diff --git a/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java b/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java index 468feeb..4711198 100644 --- a/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java +++ b/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/JGroupsFilters.java @@ -63,7 +63,7 @@ public final class JGroupsFilters { return channelAddress.equals(coordinatorNodeAddress); } LOG.debug(Body {} is not an instance of org.jgroups.View . Skipping filter., body); -return true; +return false; } }; }
camel git commit: [CAMEL-8987] Vert.x endpoints supports mutliple consumers.
Repository: camel Updated Branches: refs/heads/master 14a7dd791 - da9f0f773 [CAMEL-8987] Vert.x endpoints supports mutliple consumers. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/da9f0f77 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/da9f0f77 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/da9f0f77 Branch: refs/heads/master Commit: da9f0f773f37a09c61c276e0e4b6ac19ab4ba09b Parents: 14a7dd7 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Jul 20 17:08:39 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Jul 20 17:08:39 2015 +0200 -- .../camel/component/vertx/VertxEndpoint.java| 8 +++- .../vertx/VertxMultipleConsumerTest.java| 48 2 files changed, 55 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/da9f0f77/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java -- diff --git a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java index e1fef5c..2831282 100644 --- a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java +++ b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java @@ -19,6 +19,7 @@ package org.apache.camel.component.vertx; import io.vertx.core.Vertx; import io.vertx.core.eventbus.EventBus; import org.apache.camel.Consumer; +import org.apache.camel.MultipleConsumersSupport; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.impl.DefaultEndpoint; @@ -31,7 +32,7 @@ import org.apache.camel.spi.UriPath; * A Camel Endpoint for working with a href=http://vertx.io/;vert.x/a event bus endpoints */ @UriEndpoint(scheme = vertx, title = Vert.x, syntax = vertx:address, consumerClass = VertxConsumer.class, label = eventbus) -public class VertxEndpoint extends DefaultEndpoint { +public class VertxEndpoint extends DefaultEndpoint implements MultipleConsumersSupport { @UriPath @Metadata(required = true) private String address; @@ -62,6 +63,11 @@ public class VertxEndpoint extends DefaultEndpoint { return true; } +@Override +public boolean isMultipleConsumersSupported() { +return true; +} + public EventBus getEventBus() { if (getVertx() != null) { return getVertx().eventBus(); http://git-wip-us.apache.org/repos/asf/camel/blob/da9f0f77/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java -- diff --git a/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java new file mode 100644 index 000..d20299d --- /dev/null +++ b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxMultipleConsumerTest.java @@ -0,0 +1,48 @@ +/** + * 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.component.vertx; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.junit.Test; + +public class VertxMultipleConsumerTest extends VertxBaseTestSupport { + +protected String startUri = vertx:foo.start?pubSub=true; +protected String resultUri = mock:result; + +protected MockEndpoint resultEndpoint; + +@Test +public void shouldSendMessageToMultpleConsumers() throws Exception { +resultEndpoint = context.getEndpoint(resultUri, MockEndpoint.class); +resultEndpoint.expectedMessageCount(2); + +template.sendBody(startUri, msg); + +resultEndpoint.assertIsSatisfied(); +} + +protected RouteBuilder createRouteBuilder() throws
camel git commit: Improved logging.
Repository: camel Updated Branches: refs/heads/master da9f0f773 - ebf0f8dff Improved logging. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ebf0f8df Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ebf0f8df Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ebf0f8df Branch: refs/heads/master Commit: ebf0f8dffe4d87fa906d5dde662d3e1db246393f Parents: da9f0f7 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Jul 20 17:16:28 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Jul 20 17:16:28 2015 +0200 -- .../main/java/org/apache/camel/component/vertx/VertxComponent.java | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ebf0f8df/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java -- diff --git a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java index cf4a326..2478c24 100644 --- a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java +++ b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java @@ -191,6 +191,8 @@ public class VertxComponent extends UriEndpointComponent implements EndpointComp LOG.info(Waiting for EventBus to be ready using {} sec as timeout, timeout); latch.await(timeout, TimeUnit.SECONDS); } +} else { +LOG.debug(Using Vert.x instance set on the component level.); } }
[1/2] camel git commit: CAMEL-8801 Make spring-boot auto-configuration defer to existing beans
Repository: camel Updated Branches: refs/heads/master f91155ed8 - 803cf77d6 CAMEL-8801 Make spring-boot auto-configuration defer to existing beans Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/89da3536 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/89da3536 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/89da3536 Branch: refs/heads/master Commit: 89da35368e75f7b18172444a79b5bb2067b9f36c Parents: 5e10eba Author: Chris Pimlott ch...@spartansoftwareinc.com Authored: Tue May 26 12:10:27 2015 -0700 Committer: Chris Pimlott ch...@spartansoftwareinc.com Committed: Fri May 29 16:31:27 2015 -0700 -- .../spring/boot/CamelAutoConfiguration.java | 3 + .../boot/CamelNonInvasiveCamelContextTest.java | 83 .../src/test/resources/externalCamelContext.xml | 19 + 3 files changed, 105 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/89da3536/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index 0f444ac..9034f09 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -43,6 +43,7 @@ public class CamelAutoConfiguration { * context. */ @Bean +@ConditionalOnMissingBean(CamelContext.class) CamelContext camelContext(ApplicationContext applicationContext, CamelConfigurationProperties configurationProperties) { CamelContext camelContext = new SpringCamelContext(applicationContext); @@ -75,6 +76,7 @@ public class CamelAutoConfiguration { * Default producer template for the bootstrapped Camel context. */ @Bean +@ConditionalOnMissingBean(ProducerTemplate.class) ProducerTemplate producerTemplate(CamelContext camelContext, CamelConfigurationProperties configurationProperties) { return camelContext.createProducerTemplate(configurationProperties.getProducerTemplateCacheSize()); @@ -84,6 +86,7 @@ public class CamelAutoConfiguration { * Default consumer template for the bootstrapped Camel context. */ @Bean +@ConditionalOnMissingBean(ConsumerTemplate.class) ConsumerTemplate consumerTemplate(CamelContext camelContext, CamelConfigurationProperties configurationProperties) { return camelContext.createConsumerTemplate(configurationProperties.getConsumerTemplateCacheSize()); http://git-wip-us.apache.org/repos/asf/camel/blob/89da3536/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java -- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java new file mode 100644 index 000..26c8562 --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java @@ -0,0 +1,83 @@ +/** + * 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.spring.boot; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import javax.annotation.Resource; + +import org.apache.camel.CamelContext; +import org.apache.camel.ConsumerTemplate; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.spring.boot.CamelNonInvasiveCamelContextTest.TestApplication; +import org.junit.Test; +import
[2/2] camel git commit: Merge branch 'master' of https://github.com/pimlottc/camel
Merge branch 'master' of https://github.com/pimlottc/camel Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/803cf77d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/803cf77d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/803cf77d Branch: refs/heads/master Commit: 803cf77d6de15537ef41e7a2352b8d1c5e91c846 Parents: f91155e 89da353 Author: Henryk Konsek hekon...@gmail.com Authored: Tue Jun 2 16:52:55 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue Jun 2 16:52:55 2015 +0200 -- .../spring/boot/CamelAutoConfiguration.java | 3 + .../boot/CamelNonInvasiveCamelContextTest.java | 83 .../src/test/resources/externalCamelContext.xml | 19 + 3 files changed, 105 insertions(+) --
camel git commit: Fixed CheckStyle.
Repository: camel Updated Branches: refs/heads/master 803cf77d6 - 5fcb0261c Fixed CheckStyle. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5fcb0261 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5fcb0261 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5fcb0261 Branch: refs/heads/master Commit: 5fcb0261cee237e800290a0fe2f7a00e01c41525 Parents: 803cf77 Author: Henryk Konsek hekon...@gmail.com Authored: Tue Jun 2 16:59:33 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue Jun 2 16:59:33 2015 +0200 -- .../camel/spring/boot/CamelNonInvasiveCamelContextTest.java| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5fcb0261/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java -- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java index 26c8562..55b3ee6 100644 --- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelNonInvasiveCamelContextTest.java @@ -16,9 +16,6 @@ */ package org.apache.camel.spring.boot; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - import javax.annotation.Resource; import org.apache.camel.CamelContext; @@ -33,6 +30,9 @@ import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.context.annotation.ImportResource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + @RunWith(SpringJUnit4ClassRunner.class) @EnableAutoConfiguration @SpringApplicationConfiguration(classes = { TestApplication.class, CamelNonInvasiveCamelContextTest.class })
camel git commit: Grape component now copies URI options to the endpoint.
Repository: camel Updated Branches: refs/heads/master b30d3c29f - a678aee80 Grape component now copies URI options to the endpoint. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a678aee8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a678aee8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a678aee8 Branch: refs/heads/master Commit: a678aee8036e04a62110d60c1b74fed6eb0f940e Parents: b30d3c2 Author: Henryk Konsek hekon...@gmail.com Authored: Fri May 29 13:15:11 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Fri May 29 13:15:11 2015 +0200 -- .../org/apache/camel/component/grape/GrapeComponent.groovy | 4 +++- .../org/apache/camel/component/grape/GrapeComponentTest.groovy | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a678aee8/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy -- diff --git a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy index 63df020..dc1ce3a 100644 --- a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy +++ b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy @@ -28,7 +28,9 @@ class GrapeComponent extends UriEndpointComponent { @Override protected GrapeEndpoint createEndpoint(String uri, String remaining, MapString, Object parameters) { -new GrapeEndpoint(uri, remaining, this) +GrapeEndpoint grapeEndpoint = new GrapeEndpoint(uri, remaining, this) +setProperties(grapeEndpoint, parameters); +grapeEndpoint } PatchesRepository getPatchesRepository() { http://git-wip-us.apache.org/repos/asf/camel/blob/a678aee8/components/camel-grape/src/test/groovy/org/apache/camel/component/grape/GrapeComponentTest.groovy -- diff --git a/components/camel-grape/src/test/groovy/org/apache/camel/component/grape/GrapeComponentTest.groovy b/components/camel-grape/src/test/groovy/org/apache/camel/component/grape/GrapeComponentTest.groovy index 15bbee6..86272c3 100644 --- a/components/camel-grape/src/test/groovy/org/apache/camel/component/grape/GrapeComponentTest.groovy +++ b/components/camel-grape/src/test/groovy/org/apache/camel/component/grape/GrapeComponentTest.groovy @@ -18,7 +18,6 @@ package org.apache.camel.component.grape import org.apache.camel.ServiceStatus import org.apache.camel.builder.RouteBuilder -import org.apache.camel.component.grape.FilePatchesRepository import org.apache.camel.impl.DefaultCamelContext import org.junit.Assert import org.junit.Before
camel git commit: [CAMEL-8808] Created Grape component.
Repository: camel Updated Branches: refs/heads/master c936be321 - 520295b22 [CAMEL-8808] Created Grape component. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/520295b2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/520295b2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/520295b2 Branch: refs/heads/master Commit: 520295b22b03058c5b4149ad7cd5b99c4af9aef3 Parents: c936be3 Author: Henryk Konsek hekon...@gmail.com Authored: Wed May 27 22:37:39 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed May 27 22:37:39 2015 +0200 -- components/camel-grape/pom.xml | 114 +++ .../grape/FilePatchesRepository.groovy | 60 ++ .../camel/component/grape/GrapeCommand.groovy | 25 .../camel/component/grape/GrapeComponent.groovy | 38 +++ .../camel/component/grape/GrapeConstants.groovy | 23 .../camel/component/grape/GrapeEndpoint.groovy | 70 .../camel/component/grape/GrapeProducer.groovy | 68 +++ .../component/grape/MavenCoordinates.groovy | 50 .../component/grape/PatchesRepository.groovy| 27 + .../services/org/apache/camel/component/grape | 17 +++ .../component/grape/GrapeComponentTest.groovy | 100 components/pom.xml | 1 + parent/pom.xml | 8 +- 13 files changed, 598 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/520295b2/components/camel-grape/pom.xml -- diff --git a/components/camel-grape/pom.xml b/components/camel-grape/pom.xml new file mode 100644 index 000..9197371 --- /dev/null +++ b/components/camel-grape/pom.xml @@ -0,0 +1,114 @@ +?xml version=1.0 encoding=UTF-8? +!-- + 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. +-- +project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; + + modelVersion4.0.0/modelVersion + + parent + groupIdorg.apache.camel/groupId + artifactIdcomponents/artifactId + version2.16-SNAPSHOT/version + /parent + + artifactIdcamel-grape/artifactId + nameCamel :: Grape/name + descriptionCamel Component for Grape/description + + properties + groovy-eclipse-batch.version2.3.7-01/groovy-eclipse-batch.version + groovy-eclipse-compiler.version2.9.1-01/groovy-eclipse-compiler.version + plexus-compiler-api.version2.4/plexus-compiler-api.version + /properties + + dependencies + dependency + groupIdcommons-io/groupId + artifactIdcommons-io/artifactId + version${commons-io-version}/version + /dependency + dependency + groupIdorg.apache.commons/groupId + artifactIdcommons-lang3/artifactId + version${commons-lang3-version}/version + /dependency + dependency + groupIdorg.apache.camel/groupId + artifactIdcamel-core/artifactId + /dependency + dependency + groupIdorg.apache.ivy/groupId + artifactIdivy/artifactId + version${ivy-version}/version + /dependency + dependency + groupIdorg.codehaus.groovy/groupId + artifactIdgroovy/artifactId + version${groovy-version}/version + /dependency + + !-- Testing -- + dependency + groupIdorg.apache.camel/groupId + artifactIdcamel-test/artifactId + scopetest/scope +
camel git commit: [CAMEL-8808] Fixed broken build.
Repository: camel Updated Branches: refs/heads/master a63d1649b - b378bcded [CAMEL-8808] Fixed broken build. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b378bcde Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b378bcde Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b378bcde Branch: refs/heads/master Commit: b378bcdedfbd0ac375d052ca4dccdbad6bed1ce9 Parents: a63d164 Author: Henryk Konsek hekon...@gmail.com Authored: Wed May 27 22:50:23 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed May 27 22:50:23 2015 +0200 -- .../apache/camel/component/grape/FilePatchesRepository.groovy | 2 +- .../org/apache/camel/component/grape/GrapeComponent.groovy | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b378bcde/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/FilePatchesRepository.groovy -- diff --git a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/FilePatchesRepository.groovy b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/FilePatchesRepository.groovy index 2689453..66d25b0 100644 --- a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/FilePatchesRepository.groovy +++ b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/FilePatchesRepository.groovy @@ -28,7 +28,7 @@ class FilePatchesRepository implements PatchesRepository { private final File repository FilePatchesRepository() { -this(Paths.get(SystemUtils.userHome.absolutePath, .camel-iot-labs, patches).toFile()) +this(Paths.get(SystemUtils.userHome.absolutePath, .camel, patches).toFile()) } FilePatchesRepository(File repository) { http://git-wip-us.apache.org/repos/asf/camel/blob/b378bcde/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy -- diff --git a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy index 663fcb5..63df020 100644 --- a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy +++ b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy @@ -20,10 +20,10 @@ import org.apache.camel.impl.UriEndpointComponent class GrapeComponent extends UriEndpointComponent { -PatchesRepository patchesRepository = new FilePatchesRepository() +private PatchesRepository patchesRepository = new FilePatchesRepository() -GrapeComponent(ClassGrapeEndpoint endpointClass) { -super(endpointClass) +GrapeComponent() { +super(GrapeEndpoint.class) } @Override
camel git commit: [CAMEL-8808] Added endpoint documentation.
Repository: camel Updated Branches: refs/heads/master 520295b22 - a63d1649b [CAMEL-8808] Added endpoint documentation. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a63d1649 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a63d1649 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a63d1649 Branch: refs/heads/master Commit: a63d1649b76e3a6872d38662ab8cc9b9fe1451b3 Parents: 520295b Author: Henryk Konsek hekon...@gmail.com Authored: Wed May 27 22:46:21 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed May 27 22:46:21 2015 +0200 -- .../org/apache/camel/component/grape/GrapeComponent.groovy | 8 ++-- .../org/apache/camel/component/grape/GrapeEndpoint.groovy| 5 - 2 files changed, 10 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a63d1649/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy -- diff --git a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy index a3d8d7b..663fcb5 100644 --- a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy +++ b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy @@ -16,12 +16,16 @@ */ package org.apache.camel.component.grape -import org.apache.camel.impl.DefaultComponent +import org.apache.camel.impl.UriEndpointComponent -class GrapeComponent extends DefaultComponent { +class GrapeComponent extends UriEndpointComponent { PatchesRepository patchesRepository = new FilePatchesRepository() +GrapeComponent(ClassGrapeEndpoint endpointClass) { +super(endpointClass) +} + @Override protected GrapeEndpoint createEndpoint(String uri, String remaining, MapString, Object parameters) { new GrapeEndpoint(uri, remaining, this) http://git-wip-us.apache.org/repos/asf/camel/blob/a63d1649/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy -- diff --git a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy index 0053b54..3f0a08b 100644 --- a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy +++ b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy @@ -21,9 +21,12 @@ import org.apache.camel.Consumer import org.apache.camel.Processor import org.apache.camel.Producer import org.apache.camel.impl.DefaultEndpoint +import org.apache.camel.spi.UriEndpoint import static groovy.grape.Grape.grab +import static org.apache.camel.component.grape.MavenCoordinates.parseMavenCoordinates +@UriEndpoint(scheme = grape, title = Grape, producerOnly = true, label = management,deployment, syntax = grape:defaultCoordinates) class GrapeEndpoint extends DefaultEndpoint { private final String defaultCoordinates @@ -37,7 +40,7 @@ class GrapeEndpoint extends DefaultEndpoint { def classLoader = camelContext.applicationContextClassLoader def patchesRepository = camelContext.getComponent('grape', GrapeComponent.class).patchesRepository patchesRepository.listPatches().each { -def coordinates = MavenCoordinates.parseMavenCoordinates(it) +def coordinates = parseMavenCoordinates(it) grab(classLoader: classLoader, group: coordinates.groupId, module: coordinates.artifactId, version: coordinates.version) }
camel git commit: Improved RAT checks.
Repository: camel Updated Branches: refs/heads/camel-2.14.x e95e191b0 - 98ba97b1f Improved RAT checks. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/98ba97b1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/98ba97b1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/98ba97b1 Branch: refs/heads/camel-2.14.x Commit: 98ba97b1f8c7a3f11c7881a7194935d2760793ce Parents: e95e191 Author: Henryk Konsek hekon...@gmail.com Authored: Wed May 20 07:58:19 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed May 20 07:58:19 2015 +0200 -- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/98ba97b1/pom.xml -- diff --git a/pom.xml b/pom.xml index 3f00b5d..aa13f41 100755 --- a/pom.xml +++ b/pom.xml @@ -182,7 +182,7 @@ exclude**/src/signatures/*.txt/exclude exclude**/file-sig-api.txt/exclude exclude**/MerchandiseRestResource.apxc/exclude - excludecomponents/camel-dropbox/src/main/resources/META-INF/Dropbox_API_Terms_and_Conditions.txt/exclude + exclude**/META-INF/Dropbox_API_Terms_and_Conditions.txt/exclude !-- generated files -- exclude**/target/**/*/exclude exclude**/eclipse-classes/**/*/exclude @@ -193,7 +193,7 @@ exclude**/avro/**/*.avpr/exclude exclude**/OSGI-INF/bundle.info/exclude exclude**/test_rsa*/exclude -exclude**/examples/*/src/**/data/**/*.xml/exclude +exclude**/src/**/data/**/*.xml/exclude /excludes /configuration /plugin
camel git commit: Added myself to the KEYS.
Repository: camel Updated Branches: refs/heads/camel-2.14.x 8050e1e6d - e95e191b0 Added myself to the KEYS. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e95e191b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e95e191b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e95e191b Branch: refs/heads/camel-2.14.x Commit: e95e191b0357feee47febe4a9b6e6fa3a5f598e5 Parents: 8050e1e Author: Henryk Konsek hekon...@gmail.com Authored: Wed May 20 07:29:30 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed May 20 07:29:48 2015 +0200 -- KEYS | 34 ++ 1 file changed, 34 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e95e191b/KEYS -- diff --git a/KEYS b/KEYS index cf65015..0174020 100644 --- a/KEYS +++ b/KEYS @@ -1014,3 +1014,37 @@ ly+0IqM8hQmA113GdFh8FPs9PuOvln7gp1Lqn4f7JKBZHHQbLkD/ppn3sLlZb/Xq S0maYlA= =OANb -END PGP PUBLIC KEY BLOCK- +pub 2048R/9C8D3B59 2012-10-10 +uid Henryk Konsek hekon...@apache.com +sub 2048R/4DF29C4A 2012-10-10 + +-BEGIN PGP PUBLIC KEY BLOCK- +Version: GnuPG v1 + +mQENBFB05RYBCAC5Gvz0zm/upu2XNyiDCxGe62vCjRWGo+lLRmlAYxYLm9iMI7Tf +8Vh32TlgVCn0D0fKsFzz/7cmPCXjaTNH/8wc+cJrZVPgO4+9h9DKPADjtpbaYIgR +toHMSLHH+jzcIJ4Q3uCXR0CoM7tDvybCfHGInkUTECYGEa6Owbl6yJ/KBfUqXxGk +hayAnNXO3kQXWutqkCEfUmGbXHq7YYcPf2jQc3a1oIB1BQcMSGOlsko3Dvf/kOrr +7tiEOAlpdkQRc5oSnw4wmWwU+Sij9kTdymka5lCBxhrgsnv4YhFgn4tXyhn405pR +l4MBcvDanM3KpVHYzNKfb2SMgpVdqk1A8hxRABEBAAG0I0hlbnJ5ayBLb25zZWsg +PGhla29uc2VrQGFwYWNoZS5jb20+iQE4BBMBAgAiBQJQdOUWAhsDBgsJCAcDAgYV +CAIJCgsEFgIDAQIeAQIXgAAKCRBo2rMmnI07WYAiB/46HxLhPNNRQ0O1sThZZiXz +OrELs0KePIDMb2Y++N/iRiR5qi/sCXmLD1AvHaknCN7fucWiVnRepGAgogC2rt8P ++Cnfa+aFo+Cck8OXX915GS5uUoWJhdMWRAAgVBNg5LdiAQD0dkG2v8uzfAW1n/eR +dvnSGTGzxAJ2kTQ9zRuljOKYn639w/ErfzN88jNpVNe658xHRgwxVOxxRuWHW5EF +Z5YWZZDAkhmbKPk8nnbdqJGXI/mGbczGYIZt9CJcy5dbELmFoz6aFL1dYMwzHFjv +LKZSrxLi52vXny3gNOCOki21cJWqnDYrlZTXoHteb3dftJvuf+yW5SjTRc0lx1me +uQENBFB05RYBCAC8oKi2jJ39OAtRC7BTeaTIcTtTeoZel1xTL6jxOt5ijF8md2ra +VL5lVhrthCWuWXanypT3Gc0lcn14RcFy3zXdEamRmihpKfSsMzbmvd2BD7PCzwk7 +6My8XRHXuwWCsjdn2RmtwUMNlkOVSMAMOiUEQg2nUOIQkzblMmzlYH+3aTrYxdn+ +y6J2/odY/SVrOH2crmImh/pPB3Q9u5LA+G3wXWsyccIBQgPqTtMLpEZyyL4/1MiX +cjnpA90ICyhC0AYSAwNe0yshKy702ucGO3OwpNPEm5L6hprw0TUZDKCcQORr5sI9 +teR2rauC8Q582mIiB9WMN2vJ2MMUO6kGJtkpABEBAAGJAR8EGAECAAkFAlB05RYC +GwwACgkQaNqzJpyNO1mFegf/bTN0NFDem3bGMSlEZedOTUMSRsEGZY7/nD0sfmLe +gSsAoxKQg48/MnSFRGgWkSCSkerZRtjmLi0JguP0ufxcV/t5dd0nbYrIC/YrYHNu +hijWCHSd+XY67RD9sQ3AV+SA0/4y8vZlnudrDz6SvP5EV3bZ+p8TBE7ch7OgyLM9 +zisG9BugFPsD5S7Zy0+ES2x4E+IxVYzZrUiajfT1PLrAgLfQ2TOwCggvSRU17xu8 +VcGkOXenZaUgBAp1p1GyxGlmFa8/VJAhsMzUvOUVU2T3nVKb/moMk7kZ34L11Ycm +O89+mqkE1TM0W6OF2aHV+RbQgyyufR/gsvKBfIKxEDATew== +=eNwt +-END PGP PUBLIC KEY BLOCK-
camel git commit: Added extra RAT exclusions.
Repository: camel Updated Branches: refs/heads/camel-2.14.x ea9d95f06 - 96a6e4ec4 Added extra RAT exclusions. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/96a6e4ec Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/96a6e4ec Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/96a6e4ec Branch: refs/heads/camel-2.14.x Commit: 96a6e4ec4c940da64f0db5fb7980d2b78f07648f Parents: ea9d95f Author: Henryk Konsek hekon...@gmail.com Authored: Tue May 19 21:29:14 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue May 19 21:29:14 2015 +0200 -- pom.xml | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/96a6e4ec/pom.xml -- diff --git a/pom.xml b/pom.xml index b7c1705..3f00b5d 100755 --- a/pom.xml +++ b/pom.xml @@ -180,6 +180,9 @@ excludes**/src/main/resources/META-INF/cxf/cxf.extension/excludes excludes**/src/main/resources/META-INF/cxf/bus-extensions.txt/excludes exclude**/src/signatures/*.txt/exclude +exclude**/file-sig-api.txt/exclude +exclude**/MerchandiseRestResource.apxc/exclude + excludecomponents/camel-dropbox/src/main/resources/META-INF/Dropbox_API_Terms_and_Conditions.txt/exclude !-- generated files -- exclude**/target/**/*/exclude exclude**/eclipse-classes/**/*/exclude
camel git commit: Added myself to the KEYS.
Repository: camel Updated Branches: refs/heads/master c3d0f2f22 - f627cdf95 Added myself to the KEYS. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f627cdf9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f627cdf9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f627cdf9 Branch: refs/heads/master Commit: f627cdf952109f68b5e811190e85de53a9b454c6 Parents: c3d0f2f Author: Henryk Konsek hekon...@gmail.com Authored: Mon May 18 21:28:53 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon May 18 21:28:53 2015 +0200 -- KEYS | 35 +++ 1 file changed, 35 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f627cdf9/KEYS -- diff --git a/KEYS b/KEYS index cf65015..13e88d8 100644 --- a/KEYS +++ b/KEYS @@ -1014,3 +1014,38 @@ ly+0IqM8hQmA113GdFh8FPs9PuOvln7gp1Lqn4f7JKBZHHQbLkD/ppn3sLlZb/Xq S0maYlA= =OANb -END PGP PUBLIC KEY BLOCK- +pub 2048R/9C8D3B59 2012-10-10 +uid Henryk Konsek hekon...@apache.com +sub 2048R/4DF29C4A 2012-10-10 + +-BEGIN PGP PUBLIC KEY BLOCK- +Version: GnuPG v1 + +mQENBFB05RYBCAC5Gvz0zm/upu2XNyiDCxGe62vCjRWGo+lLRmlAYxYLm9iMI7Tf +8Vh32TlgVCn0D0fKsFzz/7cmPCXjaTNH/8wc+cJrZVPgO4+9h9DKPADjtpbaYIgR +toHMSLHH+jzcIJ4Q3uCXR0CoM7tDvybCfHGInkUTECYGEa6Owbl6yJ/KBfUqXxGk +hayAnNXO3kQXWutqkCEfUmGbXHq7YYcPf2jQc3a1oIB1BQcMSGOlsko3Dvf/kOrr +7tiEOAlpdkQRc5oSnw4wmWwU+Sij9kTdymka5lCBxhrgsnv4YhFgn4tXyhn405pR +l4MBcvDanM3KpVHYzNKfb2SMgpVdqk1A8hxRABEBAAG0I0hlbnJ5ayBLb25zZWsg +PGhla29uc2VrQGFwYWNoZS5jb20+iQE4BBMBAgAiBQJQdOUWAhsDBgsJCAcDAgYV +CAIJCgsEFgIDAQIeAQIXgAAKCRBo2rMmnI07WYAiB/46HxLhPNNRQ0O1sThZZiXz +OrELs0KePIDMb2Y++N/iRiR5qi/sCXmLD1AvHaknCN7fucWiVnRepGAgogC2rt8P ++Cnfa+aFo+Cck8OXX915GS5uUoWJhdMWRAAgVBNg5LdiAQD0dkG2v8uzfAW1n/eR +dvnSGTGzxAJ2kTQ9zRuljOKYn639w/ErfzN88jNpVNe658xHRgwxVOxxRuWHW5EF +Z5YWZZDAkhmbKPk8nnbdqJGXI/mGbczGYIZt9CJcy5dbELmFoz6aFL1dYMwzHFjv +LKZSrxLi52vXny3gNOCOki21cJWqnDYrlZTXoHteb3dftJvuf+yW5SjTRc0lx1me +uQENBFB05RYBCAC8oKi2jJ39OAtRC7BTeaTIcTtTeoZel1xTL6jxOt5ijF8md2ra +VL5lVhrthCWuWXanypT3Gc0lcn14RcFy3zXdEamRmihpKfSsMzbmvd2BD7PCzwk7 +6My8XRHXuwWCsjdn2RmtwUMNlkOVSMAMOiUEQg2nUOIQkzblMmzlYH+3aTrYxdn+ +y6J2/odY/SVrOH2crmImh/pPB3Q9u5LA+G3wXWsyccIBQgPqTtMLpEZyyL4/1MiX +cjnpA90ICyhC0AYSAwNe0yshKy702ucGO3OwpNPEm5L6hprw0TUZDKCcQORr5sI9 +teR2rauC8Q582mIiB9WMN2vJ2MMUO6kGJtkpABEBAAGJAR8EGAECAAkFAlB05RYC +GwwACgkQaNqzJpyNO1mFegf/bTN0NFDem3bGMSlEZedOTUMSRsEGZY7/nD0sfmLe +gSsAoxKQg48/MnSFRGgWkSCSkerZRtjmLi0JguP0ufxcV/t5dd0nbYrIC/YrYHNu +hijWCHSd+XY67RD9sQ3AV+SA0/4y8vZlnudrDz6SvP5EV3bZ+p8TBE7ch7OgyLM9 +zisG9BugFPsD5S7Zy0+ES2x4E+IxVYzZrUiajfT1PLrAgLfQ2TOwCggvSRU17xu8 +VcGkOXenZaUgBAp1p1GyxGlmFa8/VJAhsMzUvOUVU2T3nVKb/moMk7kZ34L11Ycm +O89+mqkE1TM0W6OF2aHV+RbQgyyufR/gsvKBfIKxEDATew== +=eNwt +-END PGP PUBLIC KEY BLOCK- +
camel git commit: Ignoring signatures API during RAT check.
Repository: camel Updated Branches: refs/heads/camel-2.14.x 35cbfbb14 - ea9d95f06 Ignoring signatures API during RAT check. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ea9d95f0 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ea9d95f0 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ea9d95f0 Branch: refs/heads/camel-2.14.x Commit: ea9d95f06eb5ba8908b5e5c7c705c8aca48a9d4f Parents: 35cbfbb Author: Henryk Konsek hekon...@gmail.com Authored: Mon May 18 22:00:39 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon May 18 22:00:39 2015 +0200 -- pom.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ea9d95f0/pom.xml -- diff --git a/pom.xml b/pom.xml index 73e8ea7..b7c1705 100755 --- a/pom.xml +++ b/pom.xml @@ -179,6 +179,7 @@ !-- cxf does not handle comments here -- excludes**/src/main/resources/META-INF/cxf/cxf.extension/excludes excludes**/src/main/resources/META-INF/cxf/bus-extensions.txt/excludes +exclude**/src/signatures/*.txt/exclude !-- generated files -- exclude**/target/**/*/exclude exclude**/eclipse-classes/**/*/exclude
camel git commit: Added Javadoc.
Repository: camel Updated Branches: refs/heads/master 98902f02d - a2bb3c905 Added Javadoc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a2bb3c90 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a2bb3c90 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a2bb3c90 Branch: refs/heads/master Commit: a2bb3c9053f5eebcdebcacc3ea52b8aa77cdcd41 Parents: 98902f0 Author: Henryk Konsek hekon...@gmail.com Authored: Tue May 12 18:03:44 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue May 12 18:03:44 2015 +0200 -- .../main/java/org/apache/camel/spring/boot/RoutesCollector.java | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a2bb3c90/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java index 2b0a050..e5dc610 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java @@ -30,6 +30,10 @@ import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.core.io.Resource; +/** + * Collects routes from the various sources (like Spring application context beans registry or opinionated classpath + * locations) and injects these into the Camel context. + */ public class RoutesCollector implements ApplicationListenerContextRefreshedEvent { // Static collaborators
camel git commit: [CAMEL-8460] Fixed double context refresh issue.
Repository: camel Updated Branches: refs/heads/camel-2.15.x a9201e41e - 21107ffe4 [CAMEL-8460] Fixed double context refresh issue. (cherry picked from commit 98902f02d143b6e81c8d7f0b8048b1788ecbcb50) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/21107ffe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/21107ffe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/21107ffe Branch: refs/heads/camel-2.15.x Commit: 21107ffe44ff88828a4f8bcc777ec7797e885c5f Parents: a9201e4 Author: Henryk Konsek hekon...@gmail.com Authored: Tue May 12 18:12:01 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue May 12 18:12:01 2015 +0200 -- .../spring/boot/CamelAutoConfiguration.java | 2 +- .../camel/spring/boot/RoutesCollector.java | 66 ++-- .../parent/SpringBootWithParentContextTest.java | 51 +++ 3 files changed, 99 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/21107ffe/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index dc9abc8..0f444ac 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -68,7 +68,7 @@ public class CamelAutoConfiguration { @ConditionalOnMissingBean(RoutesCollector.class) RoutesCollector routesCollector(ApplicationContext applicationContext) { CollectionCamelContextConfiguration configurations = applicationContext.getBeansOfType(CamelContextConfiguration.class).values(); -return new RoutesCollector(applicationContext, new ArrayListCamelContextConfiguration(configurations)); +return new RoutesCollector(new ArrayListCamelContextConfiguration(configurations)); } /** http://git-wip-us.apache.org/repos/asf/camel/blob/21107ffe/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java index b0c501a..2b0a050 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java @@ -16,57 +16,85 @@ */ package org.apache.camel.spring.boot; +import java.io.FileNotFoundException; +import java.util.ArrayList; import java.util.List; import org.apache.camel.CamelContext; import org.apache.camel.RoutesBuilder; +import org.apache.camel.model.RoutesDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.core.io.Resource; public class RoutesCollector implements ApplicationListenerContextRefreshedEvent { +// Static collaborators + private static final Logger LOG = LoggerFactory.getLogger(RoutesCollector.class); // Collaborators -private final ApplicationContext applicationContext; - private final ListCamelContextConfiguration camelContextConfigurations; // Constructors -public RoutesCollector(ApplicationContext applicationContext, ListCamelContextConfiguration camelContextConfigurations) { -this.applicationContext = applicationContext; -this.camelContextConfigurations = camelContextConfigurations; +public RoutesCollector(ListCamelContextConfiguration camelContextConfigurations) { +this.camelContextConfigurations = new ArrayListCamelContextConfiguration(camelContextConfigurations); } // Overridden @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { -CamelContext camelContext = contextRefreshedEvent.getApplicationContext().getBean(CamelContext.class); -LOG.debug(Post-processing CamelContext bean: {}, camelContext.getName()); -for (RoutesBuilder routesBuilder : applicationContext.getBeansOfType(RoutesBuilder.class).values()) { +ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext(); +
camel git commit: [CAMEL-8460] Fixed double context refresh issue.
Repository: camel Updated Branches: refs/heads/master fb59878eb - 98902f02d [CAMEL-8460] Fixed double context refresh issue. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/98902f02 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/98902f02 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/98902f02 Branch: refs/heads/master Commit: 98902f02d143b6e81c8d7f0b8048b1788ecbcb50 Parents: fb59878 Author: Henryk Konsek hekon...@gmail.com Authored: Tue May 12 18:00:41 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue May 12 18:00:41 2015 +0200 -- .../camel/spring/boot/RoutesCollector.java | 42 .../parent/SpringBootWithParentContextTest.java | 51 2 files changed, 74 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/98902f02/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java index c4809f9..2b0a050 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java @@ -51,29 +51,33 @@ public class RoutesCollector implements ApplicationListenerContextRefreshedEven @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext(); -CamelContext camelContext = contextRefreshedEvent.getApplicationContext().getBean(CamelContext.class); -LOG.debug(Post-processing CamelContext bean: {}, camelContext.getName()); -for (RoutesBuilder routesBuilder : applicationContext.getBeansOfType(RoutesBuilder.class).values()) { -try { -LOG.debug(Injecting following route into the CamelContext: {}, routesBuilder); -camelContext.addRoutes(routesBuilder); -} catch (Exception e) { -throw new RuntimeException(e); +if (applicationContext.getParent() == null) { +CamelContext camelContext = contextRefreshedEvent.getApplicationContext().getBean(CamelContext.class); +LOG.debug(Post-processing CamelContext bean: {}, camelContext.getName()); +for (RoutesBuilder routesBuilder : applicationContext.getBeansOfType(RoutesBuilder.class).values()) { +try { +LOG.debug(Injecting following route into the CamelContext: {}, routesBuilder); +camelContext.addRoutes(routesBuilder); +} catch (Exception e) { +throw new RuntimeException(e); +} } -} -loadXmlRoutes(applicationContext, camelContext); +loadXmlRoutes(applicationContext, camelContext); -if (camelContextConfigurations != null) { -for (CamelContextConfiguration camelContextConfiguration : camelContextConfigurations) { -LOG.debug(CamelContextConfiguration found. Invoking: {}, camelContextConfiguration); -camelContextConfiguration.beforeApplicationStart(camelContext); +if (camelContextConfigurations != null) { +for (CamelContextConfiguration camelContextConfiguration : camelContextConfigurations) { +LOG.debug(CamelContextConfiguration found. Invoking: {}, camelContextConfiguration); + camelContextConfiguration.beforeApplicationStart(camelContext); +} } -} -try { -camelContext.start(); -} catch (Exception e) { -throw new CamelSpringBootInitializationException(e); +try { +camelContext.start(); +} catch (Exception e) { +throw new CamelSpringBootInitializationException(e); +} +} else { +LOG.debug(Not at root context - defer adding routes); } } http://git-wip-us.apache.org/repos/asf/camel/blob/98902f02/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/parent/SpringBootWithParentContextTest.java -- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/parent/SpringBootWithParentContextTest.java
[1/2] camel git commit: [CAMEL-8655] Created Camel Spring Boot example.
Repository: camel Updated Branches: refs/heads/master 196c1f5ea - e1ff9ae54 [CAMEL-8655] Created Camel Spring Boot example. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/00faf61f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/00faf61f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/00faf61f Branch: refs/heads/master Commit: 00faf61f83b7cea05fe2d557ee13546e0914ff9c Parents: 196c1f5 Author: Henryk Konsek hekon...@gmail.com Authored: Fri Apr 24 09:16:36 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Fri Apr 24 09:16:36 2015 +0200 -- examples/camel-example-spring-boot/README.txt | 29 +++ examples/camel-example-spring-boot/pom.xml | 107 ++ .../example/spring/boot/MySpringBootRouter.java | 38 .../src/main/resources/META-INF/LICENSE.txt | 203 +++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../src/main/resources/application.yml | 1 + .../spring/boot/MySpringBootRouterTest.java | 42 7 files changed, 431 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/00faf61f/examples/camel-example-spring-boot/README.txt -- diff --git a/examples/camel-example-spring-boot/README.txt b/examples/camel-example-spring-boot/README.txt new file mode 100644 index 000..eab7655 --- /dev/null +++ b/examples/camel-example-spring-boot/README.txt @@ -0,0 +1,29 @@ +Spring Example +== + +This example shows how to work with the simple Camel application based on the Spring Boot. + +The example generates messages using timer trigger, writes them to the standard output and the mock +endpoint (for testing purposes). + +You will need to compile this example first: + mvn install + +To run the example type + mvn spring-boot:run + +You will see the message printed to the console every second. + +To stop the example hit ctrl + c + +This example is documented at + http://camel.apache.org/spring-boot-example.html + +If you hit any problems please talk to us on the Camel Forums + http://camel.apache.org/discussion-forums.html + +Please help us make Apache Camel better - we appreciate any feedback you +may have. Enjoy! + + +The Camel riders! http://git-wip-us.apache.org/repos/asf/camel/blob/00faf61f/examples/camel-example-spring-boot/pom.xml -- diff --git a/examples/camel-example-spring-boot/pom.xml b/examples/camel-example-spring-boot/pom.xml new file mode 100755 index 000..28be114 --- /dev/null +++ b/examples/camel-example-spring-boot/pom.xml @@ -0,0 +1,107 @@ +?xml version=1.0 encoding=UTF-8? +!-- + 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. +-- +project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; + + modelVersion4.0.0/modelVersion + + parent + groupIdorg.apache.camel/groupId + artifactIdexamples/artifactId + version2.16-SNAPSHOT/version + /parent + + artifactIdcamel-example-spring-boot/artifactId + packagingwar/packaging + nameCamel :: Example :: Spring Boot/name + descriptionAn example showing how to work with Camel and Spring Boot/description + + properties + spring.boot-version1.2.3.RELEASE/spring.boot-version + + maven-war-plugin.version2.6/maven-war-plugin.version + /properties + + dependencyManagement + dependencies + dependency + groupIdorg.springframework.boot/groupId + artifactIdspring-boot-dependencies/artifactId + version${spring.boot-version}/version + typepom/type +
[2/2] camel git commit: [CAMEL-8655] Created Camel Spring Boot example.
[CAMEL-8655] Created Camel Spring Boot example. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e1ff9ae5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e1ff9ae5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e1ff9ae5 Branch: refs/heads/master Commit: e1ff9ae54321443851e1cc72694a6300f003afd4 Parents: 00faf61 Author: Henryk Konsek hekon...@gmail.com Authored: Fri Apr 24 09:16:50 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Fri Apr 24 09:16:50 2015 +0200 -- examples/pom.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e1ff9ae5/examples/pom.xml -- diff --git a/examples/pom.xml b/examples/pom.xml index 7d02eea..cdade2a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -72,6 +72,7 @@ modulecamel-example-spark-rest-tomcat/module modulecamel-example-splunk/module modulecamel-example-spring/module +modulecamel-example-spring-boot/module modulecamel-example-spring-javaconfig/module modulecamel-example-spring-jms/module modulecamel-example-spring-ws/module
camel git commit: Improved example docs.
Repository: camel Updated Branches: refs/heads/master e1ff9ae54 - dd1f69450 Improved example docs. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dd1f6945 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dd1f6945 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dd1f6945 Branch: refs/heads/master Commit: dd1f6945084eeaa9edb6e23b0b7ba4ae9279defd Parents: e1ff9ae Author: Henryk Konsek hekon...@gmail.com Authored: Fri Apr 24 09:22:44 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Fri Apr 24 09:22:44 2015 +0200 -- examples/camel-example-spring-boot/README.txt | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/dd1f6945/examples/camel-example-spring-boot/README.txt -- diff --git a/examples/camel-example-spring-boot/README.txt b/examples/camel-example-spring-boot/README.txt index eab7655..53ed3d5 100644 --- a/examples/camel-example-spring-boot/README.txt +++ b/examples/camel-example-spring-boot/README.txt @@ -6,6 +6,10 @@ This example shows how to work with the simple Camel application based on the Sp The example generates messages using timer trigger, writes them to the standard output and the mock endpoint (for testing purposes). +This example exposes Jolokia API and Spring Boot actuators endpoints (like metrics) via the webmvc endpoint. We consider +this as the best practice - Spring Boot applications with these API exposed can be easily monitored and managed by the +3rd parties tools. + You will need to compile this example first: mvn install
camel git commit: Spring Boot example is not the proper fat WAR.
Repository: camel Updated Branches: refs/heads/master dd1f69450 - c86c2f11f Spring Boot example is not the proper fat WAR. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c86c2f11 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c86c2f11 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c86c2f11 Branch: refs/heads/master Commit: c86c2f11f090a54c4a721ac51c4c0fd401192e24 Parents: dd1f694 Author: Henryk Konsek hekon...@gmail.com Authored: Fri Apr 24 09:30:20 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Fri Apr 24 09:30:20 2015 +0200 -- examples/camel-example-spring-boot/README.txt | 8 ++ .../boot/MySpringBootRouterWarInitializer.java | 29 2 files changed, 37 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c86c2f11/examples/camel-example-spring-boot/README.txt -- diff --git a/examples/camel-example-spring-boot/README.txt b/examples/camel-example-spring-boot/README.txt index 53ed3d5..468a898 100644 --- a/examples/camel-example-spring-boot/README.txt +++ b/examples/camel-example-spring-boot/README.txt @@ -10,12 +10,20 @@ This example exposes Jolokia API and Spring Boot actuators endpoints (like metri this as the best practice - Spring Boot applications with these API exposed can be easily monitored and managed by the 3rd parties tools. +We recommend to package your application as a fat WAR. Fat WARs can be executed just as regular fat jars, but you can also +deploy them to the servlet containers like Tomcat. Fat WAR approach gives you the deployment flexibility, so we highly +recommend it. + You will need to compile this example first: mvn install To run the example type mvn spring-boot:run +You can also execute the fat WAR directly: + + java -jar target/camel-example-spring-boot-2.x-SNAPSHOT.war + You will see the message printed to the console every second. To stop the example hit ctrl + c http://git-wip-us.apache.org/repos/asf/camel/blob/c86c2f11/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouterWarInitializer.java -- diff --git a/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouterWarInitializer.java b/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouterWarInitializer.java new file mode 100644 index 000..e0640f8 --- /dev/null +++ b/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouterWarInitializer.java @@ -0,0 +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.example.spring.boot; + +import org.apache.camel.spring.boot.FatJarRouter; +import org.apache.camel.spring.boot.FatWarInitializer; + +public class MySpringBootRouterWarInitializer extends FatWarInitializer { + +@Override +protected Class? extends FatJarRouter routerClass() { +return MySpringBootRouter.class; +} + +}
camel git commit: [CAMEL-8685] Netty HTTP resolves OPTIONS prefix matches earlier
Repository: camel Updated Branches: refs/heads/master 234640052 - 5b27ecc8a [CAMEL-8685] Netty HTTP resolves OPTIONS prefix matches earlier Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b27ecc8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b27ecc8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b27ecc8 Branch: refs/heads/master Commit: 5b27ecc8aae83f6a4a8b1cd14133387f01d77151 Parents: 2346400 Author: Henryk Konsek hekon...@gmail.com Authored: Wed Apr 22 13:44:00 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed Apr 22 13:44:00 2015 +0200 -- .../netty/http/RestContextPathMatcher.java | 4 ++ .../HttpServerMultiplexChannelHandler.java | 44 -- .../NettyHttpRestContextPathMatcherTest.java| 63 .../netty4/http/RestContextPathMatcher.java | 4 ++ .../HttpServerMultiplexChannelHandler.java | 45 -- .../NettyHttpRestContextPathMatcherTest.java| 63 6 files changed, 211 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5b27ecc8/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java index efc9258..30ab534 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java @@ -74,6 +74,10 @@ public class RestContextPathMatcher extends DefaultContextPathMatcher { consumerPath = consumerPath.substring(0, consumerPath.length() - 1); } +if (matchOnUriPrefix (requestPath.startsWith(consumerPath) || consumerPath.isEmpty())) { +return true; +} + // split using single char / is optimized in the jdk String[] requestPaths = requestPath.split(/); String[] consumerPaths = consumerPath.split(/); http://git-wip-us.apache.org/repos/asf/camel/blob/5b27ecc8/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java index 07de856..2c1a753 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java @@ -19,6 +19,7 @@ package org.apache.camel.component.netty.http.handlers; import java.nio.channels.ClosedChannelException; import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -176,18 +177,26 @@ public class HttpServerMultiplexChannelHandler extends SimpleChannelUpstreamHand } // then see if we got a direct match -IteratorMap.EntryContextPathMatcher, HttpServerChannelHandler it = candidates.iterator(); -while (it.hasNext()) { -Map.EntryContextPathMatcher, HttpServerChannelHandler entry = it.next(); +ListHttpServerChannelHandler directMatches = new LinkedListHttpServerChannelHandler(); +for (Map.EntryContextPathMatcher, HttpServerChannelHandler entry : candidates) { if (entry.getKey().matchesRest(path, false)) { -answer = entry.getValue(); -break; +directMatches.add(entry.getValue()); +} +} +if (directMatches.size() == 1) { // Single match found, just return it without any further analysis. +answer = directMatches.get(0); +} else if (directMatches.size() 1) { // possible if the prefix match occurred +ListHttpServerChannelHandler directMatchesWithOptions = handlersWithExplicitOptionsMethod(directMatches); +if (!directMatchesWithOptions.isEmpty()) { // prefer options matches +answer = handlerWithTheLongestMatchingPrefix(directMatchesWithOptions); +} else { +answer
camel git commit: [CAMEL-8685] Netty HTTP resolves OPTIONS prefix matches earlier (cherry picked from commit 5b27ecc)
Repository: camel Updated Branches: refs/heads/camel-2.15.x a93c74c41 - 517db2078 [CAMEL-8685] Netty HTTP resolves OPTIONS prefix matches earlier (cherry picked from commit 5b27ecc) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/517db207 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/517db207 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/517db207 Branch: refs/heads/camel-2.15.x Commit: 517db207815e36c32cdd510bed84b85df3b8b54a Parents: a93c74c Author: Henryk Konsek hekon...@gmail.com Authored: Wed Apr 22 13:44:00 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed Apr 22 13:50:24 2015 +0200 -- .../netty/http/RestContextPathMatcher.java | 4 ++ .../HttpServerMultiplexChannelHandler.java | 44 -- .../NettyHttpRestContextPathMatcherTest.java| 63 .../netty4/http/RestContextPathMatcher.java | 4 ++ .../HttpServerMultiplexChannelHandler.java | 45 -- .../NettyHttpRestContextPathMatcherTest.java| 63 6 files changed, 211 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/517db207/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java index efc9258..30ab534 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/RestContextPathMatcher.java @@ -74,6 +74,10 @@ public class RestContextPathMatcher extends DefaultContextPathMatcher { consumerPath = consumerPath.substring(0, consumerPath.length() - 1); } +if (matchOnUriPrefix (requestPath.startsWith(consumerPath) || consumerPath.isEmpty())) { +return true; +} + // split using single char / is optimized in the jdk String[] requestPaths = requestPath.split(/); String[] consumerPaths = consumerPath.split(/); http://git-wip-us.apache.org/repos/asf/camel/blob/517db207/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java index 07de856..2c1a753 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerMultiplexChannelHandler.java @@ -19,6 +19,7 @@ package org.apache.camel.component.netty.http.handlers; import java.nio.channels.ClosedChannelException; import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -176,18 +177,26 @@ public class HttpServerMultiplexChannelHandler extends SimpleChannelUpstreamHand } // then see if we got a direct match -IteratorMap.EntryContextPathMatcher, HttpServerChannelHandler it = candidates.iterator(); -while (it.hasNext()) { -Map.EntryContextPathMatcher, HttpServerChannelHandler entry = it.next(); +ListHttpServerChannelHandler directMatches = new LinkedListHttpServerChannelHandler(); +for (Map.EntryContextPathMatcher, HttpServerChannelHandler entry : candidates) { if (entry.getKey().matchesRest(path, false)) { -answer = entry.getValue(); -break; +directMatches.add(entry.getValue()); +} +} +if (directMatches.size() == 1) { // Single match found, just return it without any further analysis. +answer = directMatches.get(0); +} else if (directMatches.size() 1) { // possible if the prefix match occurred +ListHttpServerChannelHandler directMatchesWithOptions = handlersWithExplicitOptionsMethod(directMatches); +if (!directMatchesWithOptions.isEmpty()) { // prefer options matches +answer =
camel git commit: [CAMEL-8645] Camel Netty component should not intercept consumers with httpMethodRestrict=OPTIONS. Thanks for @stijnvanbael for the patch!
Repository: camel Updated Branches: refs/heads/master 1b99e8c53 - ca1aaa1b2 [CAMEL-8645] Camel Netty component should not intercept consumers with httpMethodRestrict=OPTIONS. Thanks for @stijnvanbael for the patch! Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ca1aaa1b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ca1aaa1b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ca1aaa1b Branch: refs/heads/master Commit: ca1aaa1b292ac7275853f2f27e6c5f7d5de618ac Parents: 1b99e8c Author: Henryk Konsek hekon...@gmail.com Authored: Thu Apr 16 12:02:50 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Thu Apr 16 12:02:50 2015 +0200 -- .../http/handlers/HttpServerChannelHandler.java | 4 +- .../netty/http/NettyHttpCustomOptionsTest.java | 44 .../http/handlers/HttpServerChannelHandler.java | 4 +- .../netty4/http/NettyHttpCustomOptionsTest.java | 44 4 files changed, 94 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ca1aaa1b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java index 4888b8c..cd6dfed 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java @@ -94,7 +94,9 @@ public class HttpServerChannelHandler extends ServerChannelHandler { } // if its an OPTIONS request then return which methods is allowed -if (OPTIONS.equals(request.getMethod().getName())) { +boolean isRestrictedToOptions = consumer.getEndpoint().getHttpMethodRestrict() != null + consumer.getEndpoint().getHttpMethodRestrict().contains(OPTIONS); +if (OPTIONS.equals(request.getMethod().getName()) !isRestrictedToOptions) { String s; if (consumer.getEndpoint().getHttpMethodRestrict() != null) { s = OPTIONS, + consumer.getEndpoint().getHttpMethodRestrict(); http://git-wip-us.apache.org/repos/asf/camel/blob/ca1aaa1b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java -- diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java new file mode 100644 index 000..0e2bb06 --- /dev/null +++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java @@ -0,0 +1,44 @@ +/** + * 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.component.netty.http; + +import org.apache.camel.builder.RouteBuilder; +import org.junit.Test; + +import static org.apache.camel.Exchange.HTTP_METHOD; + +public class NettyHttpCustomOptionsTest extends BaseNettyTest { + +String expectedResponse = response; + +@Test +public void shouldReturnCustomResponseForOptions() throws Exception { +String response = template.requestBodyAndHeader(netty-http:http://localhost:{{port}}/foo;, , HTTP_METHOD, OPTIONS, String.class); +assertEquals(expectedResponse, response); +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { +
camel git commit: [CAMEL-8645] Camel Netty component should not intercept consumers with httpMethodRestrict=OPTIONS. Thanks for @stijnvanbael for the patch! (cherry picked from commit ca1aaa1)
Repository: camel Updated Branches: refs/heads/camel-2.15.x ff554c053 - bb59db2d8 [CAMEL-8645] Camel Netty component should not intercept consumers with httpMethodRestrict=OPTIONS. Thanks for @stijnvanbael for the patch! (cherry picked from commit ca1aaa1) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bb59db2d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bb59db2d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bb59db2d Branch: refs/heads/camel-2.15.x Commit: bb59db2d81af634364bb9a3f09c2745565d114c3 Parents: ff554c0 Author: Henryk Konsek hekon...@gmail.com Authored: Thu Apr 16 12:02:50 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Thu Apr 16 12:09:29 2015 +0200 -- .../http/handlers/HttpServerChannelHandler.java | 4 +- .../netty/http/NettyHttpCustomOptionsTest.java | 44 .../http/handlers/HttpServerChannelHandler.java | 4 +- .../netty4/http/NettyHttpCustomOptionsTest.java | 44 4 files changed, 94 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/bb59db2d/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java index 4888b8c..cd6dfed 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java @@ -94,7 +94,9 @@ public class HttpServerChannelHandler extends ServerChannelHandler { } // if its an OPTIONS request then return which methods is allowed -if (OPTIONS.equals(request.getMethod().getName())) { +boolean isRestrictedToOptions = consumer.getEndpoint().getHttpMethodRestrict() != null + consumer.getEndpoint().getHttpMethodRestrict().contains(OPTIONS); +if (OPTIONS.equals(request.getMethod().getName()) !isRestrictedToOptions) { String s; if (consumer.getEndpoint().getHttpMethodRestrict() != null) { s = OPTIONS, + consumer.getEndpoint().getHttpMethodRestrict(); http://git-wip-us.apache.org/repos/asf/camel/blob/bb59db2d/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java -- diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java new file mode 100644 index 000..0e2bb06 --- /dev/null +++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCustomOptionsTest.java @@ -0,0 +1,44 @@ +/** + * 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.component.netty.http; + +import org.apache.camel.builder.RouteBuilder; +import org.junit.Test; + +import static org.apache.camel.Exchange.HTTP_METHOD; + +public class NettyHttpCustomOptionsTest extends BaseNettyTest { + +String expectedResponse = response; + +@Test +public void shouldReturnCustomResponseForOptions() throws Exception { +String response = template.requestBodyAndHeader(netty-http:http://localhost:{{port}}/foo;, , HTTP_METHOD, OPTIONS, String.class); +assertEquals(expectedResponse, response); +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { +
camel git commit: [CAMEL-8532] Spring Boot applications should block the main thread of the execution. (cherry picked from commit 472903b)
Repository: camel Updated Branches: refs/heads/camel-2.15.x b657207da - ff554c053 [CAMEL-8532] Spring Boot applications should block the main thread of the execution. (cherry picked from commit 472903b) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ff554c05 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ff554c05 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ff554c05 Branch: refs/heads/camel-2.15.x Commit: ff554c053f9532d57037066564c029f8a6747c0d Parents: b657207 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 23 11:04:30 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Thu Apr 16 09:12:45 2015 +0200 -- .../spring/boot/CamelAutoConfiguration.java | 5 ++ .../CamelSpringBootApplicationController.java | 54 .../apache/camel/spring/boot/FatJarRouter.java | 6 ++- .../StandaloneFatJarRouterTest.java | 7 ++- 4 files changed, 70 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ff554c05/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index aba9623..dc9abc8 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -60,6 +60,11 @@ public class CamelAutoConfiguration { } @Bean +CamelSpringBootApplicationController applicationController(ApplicationContext applicationContext, CamelContext camelContext) { +return new CamelSpringBootApplicationController(applicationContext, camelContext); +} + +@Bean @ConditionalOnMissingBean(RoutesCollector.class) RoutesCollector routesCollector(ApplicationContext applicationContext) { CollectionCamelContextConfiguration configurations = applicationContext.getBeansOfType(CamelContextConfiguration.class).values(); http://git-wip-us.apache.org/repos/asf/camel/blob/ff554c05/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java new file mode 100644 index 000..7ff3714 --- /dev/null +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java @@ -0,0 +1,54 @@ +/** + * 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.spring.boot; + +import java.util.Collections; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.main.MainSupport; +import org.springframework.context.ApplicationContext; + +public class CamelSpringBootApplicationController { + +private final MainSupport mainSupport; + +public CamelSpringBootApplicationController(final ApplicationContext applicationContext, final CamelContext camelContext) { +this.mainSupport = new MainSupport() { +@Override +protected ProducerTemplate findOrCreateCamelTemplate() { +return applicationContext.getBean(ProducerTemplate.class); +} + +@Override +protected MapString, CamelContext getCamelContextMap() { +return Collections.singletonMap(camelContext, camelContext); +} +}; +} + +public void blockMainThread() { +try { +
camel git commit: [CAMEL-8554] Narrowed possible conversions to Pojo objects.
Repository: camel Updated Branches: refs/heads/master 581910646 - e4b5ecc4a [CAMEL-8554] Narrowed possible conversions to Pojo objects. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e4b5ecc4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e4b5ecc4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e4b5ecc4 Branch: refs/heads/master Commit: e4b5ecc4a68c005ea773d300b148135acd70424a Parents: 5819106 Author: Henryk Konsek hekon...@gmail.com Authored: Thu Apr 9 22:14:01 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Thu Apr 9 22:14:01 2015 +0200 -- .../converter/JacksonTypeConverters.java| 12 - .../jackson/JacksonConversionsSimpleTest.java | 46 2 files changed, 56 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e4b5ecc4/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java -- diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java index efe51ce..123cb2d 100644 --- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java @@ -30,8 +30,7 @@ public final class JacksonTypeConverters { @FallbackConverter public static T T convertTo(ClassT type, Exchange exchange, Object value, TypeConverterRegistry registry) { -if (type.isAssignableFrom(String.class)) { -// do not convert to String +if (isNotPojoType(type)) { return null; } @@ -45,4 +44,13 @@ public final class JacksonTypeConverters { return null; } +private static boolean isNotPojoType(Class? type) { +boolean isString = String.class.isAssignableFrom(type); +boolean isNumber = Number.class.isAssignableFrom(type) +|| int.class.isAssignableFrom(type) || long.class.isAssignableFrom(type) +|| short.class.isAssignableFrom(type) || char.class.isAssignableFrom(type) +|| float.class.isAssignableFrom(type) || double.class.isAssignableFrom(type); +return isString || isNumber; +} + } http://git-wip-us.apache.org/repos/asf/camel/blob/e4b5ecc4/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java -- diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java new file mode 100644 index 000..868ebab --- /dev/null +++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java @@ -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.component.jackson; + +import java.util.HashMap; + +import org.apache.camel.component.jackson.converter.JacksonTypeConverters; +import org.junit.Assert; +import org.junit.Test; + +public class JacksonConversionsSimpleTest extends Assert { + +@Test +public void shouldNotConvertMapToString() { +Object convertedObject = JacksonTypeConverters.convertTo(String.class, null, new HashMapString, String(), null); +assertNull(convertedObject); +} + +@Test +public void shouldNotConvertMapToNumber() { +Object convertedObject = JacksonTypeConverters.convertTo(Long.class, null, new HashMapString, String(), null); +assertNull(convertedObject); +} + +@Test +public void shouldNotConvertMapToPrimitive() { +Object
camel git commit: [CAMEL-8554] Jackson mapper can be read from the registry.
Repository: camel Updated Branches: refs/heads/master e4b5ecc4a - 15cdf38f5 [CAMEL-8554] Jackson mapper can be read from the registry. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/15cdf38f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/15cdf38f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/15cdf38f Branch: refs/heads/master Commit: 15cdf38f578018aa2b4d86707b03ef44dd965d3c Parents: e4b5ecc Author: Henryk Konsek hekon...@gmail.com Authored: Thu Apr 9 22:35:19 2015 +0200 Committer: Henryk Konsek hekon...@gmail.com Committed: Thu Apr 9 22:35:19 2015 +0200 -- components/camel-jackson/pom.xml| 5 .../converter/JacksonTypeConverters.java| 14 - .../jackson/JacksonConversionsSimpleTest.java | 31 +--- 3 files changed, 45 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/15cdf38f/components/camel-jackson/pom.xml -- diff --git a/components/camel-jackson/pom.xml b/components/camel-jackson/pom.xml index a5eb9a8..8c7445e 100644 --- a/components/camel-jackson/pom.xml +++ b/components/camel-jackson/pom.xml @@ -70,6 +70,11 @@ artifactIdjunit/artifactId scopetest/scope /dependency +dependency +groupIdorg.mockito/groupId +artifactIdmockito-core/artifactId +scopetest/scope +/dependency /dependencies /project http://git-wip-us.apache.org/repos/asf/camel/blob/15cdf38f/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java -- diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java index 123cb2d..345c9b8 100644 --- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java @@ -17,14 +17,18 @@ package org.apache.camel.component.jackson.converter; import java.util.Map; +import java.util.Set; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.Exchange; import org.apache.camel.FallbackConverter; +import org.apache.camel.spi.Registry; import org.apache.camel.spi.TypeConverterRegistry; public final class JacksonTypeConverters { +private static final ObjectMapper DEFAULT_MAPPER = new ObjectMapper(); + private JacksonTypeConverters() { } @@ -35,7 +39,7 @@ public final class JacksonTypeConverters { } if (value instanceof Map) { -ObjectMapper mapper = new ObjectMapper(); +ObjectMapper mapper = resolveObjectMapper(exchange.getContext().getRegistry()); if (mapper.canSerialize(type)) { return mapper.convertValue(value, type); } @@ -53,4 +57,12 @@ public final class JacksonTypeConverters { return isString || isNumber; } +private static ObjectMapper resolveObjectMapper(Registry registry) { +SetObjectMapper mappers = registry.findByType(ObjectMapper.class); +if (mappers.size() == 1) { +return mappers.iterator().next(); +} +return DEFAULT_MAPPER; +} + } http://git-wip-us.apache.org/repos/asf/camel/blob/15cdf38f/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java -- diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java index 868ebab..53e0fb6 100644 --- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java +++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsSimpleTest.java @@ -18,29 +18,52 @@ package org.apache.camel.component.jackson; import java.util.HashMap; -import org.apache.camel.component.jackson.converter.JacksonTypeConverters; +import static java.util.Collections.singleton; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.camel.Exchange; import org.junit.Assert; import org.junit.Test; +import static org.apache.camel.component.jackson.converter.JacksonTypeConverters.convertTo; +import static org.mockito.BDDMockito.given; +import static
camel git commit: [CAMEL-8554] Jackons component now provides map = pojo fallback converter.
Repository: camel Updated Branches: refs/heads/master 33b96b0b5 - 2fa60111a [CAMEL-8554] Jackons component now provides map = pojo fallback converter. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2fa60111 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2fa60111 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2fa60111 Branch: refs/heads/master Commit: 2fa60111add917affc161570892efda4a763f56a Parents: 33b96b0 Author: Henryk Konsek hekon...@gmail.com Authored: Thu Mar 26 08:57:05 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Thu Mar 26 08:57:05 2015 +0100 -- .../converter/JacksonTypeConverters.java| 39 +++ .../services/org/apache/camel/TypeConverter | 17 +++ .../jackson/JacksonConversionsTest.java | 51 3 files changed, 107 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/2fa60111/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java -- diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java new file mode 100644 index 000..edaffb2 --- /dev/null +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java @@ -0,0 +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.component.jackson.converter; + +import java.util.Map; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.camel.Exchange; +import org.apache.camel.FallbackConverter; +import org.apache.camel.spi.TypeConverterRegistry; + +public final class JacksonTypeConverters { + +private JacksonTypeConverters() { +} + +@FallbackConverter +public static T T convertTo(ClassT type, Exchange exchange, Object value, TypeConverterRegistry registry) { +if (value instanceof Map) { +return new ObjectMapper().convertValue(value, type); +} +return null; +} + +} http://git-wip-us.apache.org/repos/asf/camel/blob/2fa60111/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter -- diff --git a/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter new file mode 100644 index 000..6ad0528 --- /dev/null +++ b/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter @@ -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. +# +org.apache.camel.component.jackson.converter.JacksonTypeConverters \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2fa60111/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsTest.java -- diff --git
camel git commit: Spring Boot - XML routes detection is now optional.
Repository: camel Updated Branches: refs/heads/master 8098936f5 - b225ec2ca Spring Boot - XML routes detection is now optional. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b225ec2c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b225ec2c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b225ec2c Branch: refs/heads/master Commit: b225ec2ca9ac90a8cd69840ca33f7652404ce238 Parents: 8098936 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 23 15:03:25 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 23 15:03:43 2015 +0100 -- .../java/org/apache/camel/spring/boot/RoutesCollector.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b225ec2c/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java index 72c4eda..c4809f9 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java @@ -16,6 +16,8 @@ */ package org.apache.camel.spring.boot; +import java.io.FileNotFoundException; +import java.util.ArrayList; import java.util.List; import org.apache.camel.CamelContext; @@ -30,6 +32,8 @@ import org.springframework.core.io.Resource; public class RoutesCollector implements ApplicationListenerContextRefreshedEvent { +// Static collaborators + private static final Logger LOG = LoggerFactory.getLogger(RoutesCollector.class); // Collaborators @@ -39,7 +43,7 @@ public class RoutesCollector implements ApplicationListenerContextRefreshedEven // Constructors public RoutesCollector(ListCamelContextConfiguration camelContextConfigurations) { -this.camelContextConfigurations = camelContextConfigurations; +this.camelContextConfigurations = new ArrayListCamelContextConfiguration(camelContextConfigurations); } // Overridden @@ -76,12 +80,15 @@ public class RoutesCollector implements ApplicationListenerContextRefreshedEven // Helpers private void loadXmlRoutes(ApplicationContext applicationContext, CamelContext camelContext) { +LOG.debug(Started XML routes detection. Scanning classpath (/camel/*.xml)...); try { Resource[] xmlRoutes = applicationContext.getResources(classpath:camel/*.xml); for (Resource xmlRoute : xmlRoutes) { RoutesDefinition xmlDefinition = camelContext.loadRoutesDefinition(xmlRoute.getInputStream()); camelContext.addRouteDefinitions(xmlDefinition.getRoutes()); } +} catch (FileNotFoundException e) { +LOG.debug(No XMl routes found in the classpath (/camel/*.xml). Skipping XML routes detection.); } catch (Exception e) { throw new RuntimeException(e); }
camel git commit: [CAMEL-8532] Spring Boot applications should block the main thread of the execution.
Repository: camel Updated Branches: refs/heads/master 0f1d5c757 - 472903bf2 [CAMEL-8532] Spring Boot applications should block the main thread of the execution. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/472903bf Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/472903bf Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/472903bf Branch: refs/heads/master Commit: 472903bf2dc069b7cd47dcdbfa957603092c282e Parents: 0f1d5c7 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 23 11:04:30 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 23 11:04:30 2015 +0100 -- .../spring/boot/CamelAutoConfiguration.java | 5 ++ .../CamelSpringBootApplicationController.java | 54 .../apache/camel/spring/boot/FatJarRouter.java | 6 ++- .../StandaloneFatJarRouterTest.java | 7 ++- 4 files changed, 70 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/472903bf/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index 5fdac34..0f444ac 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -60,6 +60,11 @@ public class CamelAutoConfiguration { } @Bean +CamelSpringBootApplicationController applicationController(ApplicationContext applicationContext, CamelContext camelContext) { +return new CamelSpringBootApplicationController(applicationContext, camelContext); +} + +@Bean @ConditionalOnMissingBean(RoutesCollector.class) RoutesCollector routesCollector(ApplicationContext applicationContext) { CollectionCamelContextConfiguration configurations = applicationContext.getBeansOfType(CamelContextConfiguration.class).values(); http://git-wip-us.apache.org/repos/asf/camel/blob/472903bf/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java new file mode 100644 index 000..7ff3714 --- /dev/null +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java @@ -0,0 +1,54 @@ +/** + * 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.spring.boot; + +import java.util.Collections; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.main.MainSupport; +import org.springframework.context.ApplicationContext; + +public class CamelSpringBootApplicationController { + +private final MainSupport mainSupport; + +public CamelSpringBootApplicationController(final ApplicationContext applicationContext, final CamelContext camelContext) { +this.mainSupport = new MainSupport() { +@Override +protected ProducerTemplate findOrCreateCamelTemplate() { +return applicationContext.getBean(ProducerTemplate.class); +} + +@Override +protected MapString, CamelContext getCamelContextMap() { +return Collections.singletonMap(camelContext, camelContext); +} +}; +} + +public void blockMainThread() { +try { +mainSupport.enableHangupSupport(); +
camel git commit: [CAMEL-8523] Spring Boot should automagically load XML routes definitions from classpath.
Repository: camel Updated Branches: refs/heads/master 9b1b92cf8 - 2b6bf5f8c [CAMEL-8523] Spring Boot should automagically load XML routes definitions from classpath. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2b6bf5f8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2b6bf5f8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2b6bf5f8 Branch: refs/heads/master Commit: 2b6bf5f8ca0c509b565a36c98e3e63219b77b7f0 Parents: 9b1b92c Author: Henryk Konsek hekon...@gmail.com Authored: Fri Mar 20 16:43:11 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Fri Mar 20 16:43:11 2015 +0100 -- .../spring/boot/CamelAutoConfiguration.java | 2 +- .../camel/spring/boot/RoutesCollector.java | 25 .../spring/boot/CamelAutoConfigurationTest.java | 18 +- .../src/test/resources/camel/camelContext.xml | 7 ++ 4 files changed, 46 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/2b6bf5f8/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index aba9623..5fdac34 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -63,7 +63,7 @@ public class CamelAutoConfiguration { @ConditionalOnMissingBean(RoutesCollector.class) RoutesCollector routesCollector(ApplicationContext applicationContext) { CollectionCamelContextConfiguration configurations = applicationContext.getBeansOfType(CamelContextConfiguration.class).values(); -return new RoutesCollector(applicationContext, new ArrayListCamelContextConfiguration(configurations)); +return new RoutesCollector(new ArrayListCamelContextConfiguration(configurations)); } /** http://git-wip-us.apache.org/repos/asf/camel/blob/2b6bf5f8/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java index b0c501a..72c4eda 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java @@ -20,11 +20,13 @@ import java.util.List; import org.apache.camel.CamelContext; import org.apache.camel.RoutesBuilder; +import org.apache.camel.model.RoutesDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.core.io.Resource; public class RoutesCollector implements ApplicationListenerContextRefreshedEvent { @@ -32,14 +34,11 @@ public class RoutesCollector implements ApplicationListenerContextRefreshedEven // Collaborators -private final ApplicationContext applicationContext; - private final ListCamelContextConfiguration camelContextConfigurations; // Constructors -public RoutesCollector(ApplicationContext applicationContext, ListCamelContextConfiguration camelContextConfigurations) { -this.applicationContext = applicationContext; +public RoutesCollector(ListCamelContextConfiguration camelContextConfigurations) { this.camelContextConfigurations = camelContextConfigurations; } @@ -47,6 +46,7 @@ public class RoutesCollector implements ApplicationListenerContextRefreshedEven @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { +ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext(); CamelContext camelContext = contextRefreshedEvent.getApplicationContext().getBean(CamelContext.class); LOG.debug(Post-processing CamelContext bean: {}, camelContext.getName()); for (RoutesBuilder routesBuilder : applicationContext.getBeansOfType(RoutesBuilder.class).values()) { @@ -57,6 +57,9 @@ public class RoutesCollector implements ApplicationListenerContextRefreshedEven throw new RuntimeException(e);
camel git commit: [Paho] Added MqttConnectOptions autodetection.
Repository: camel Updated Branches: refs/heads/master 3d46316cd - 368be192d [Paho] Added MqttConnectOptions autodetection. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/368be192 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/368be192 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/368be192 Branch: refs/heads/master Commit: 368be192d18c34e35ba4ee8ec0bab9b91f25a7dc Parents: 3d46316 Author: Henryk Konsek hekon...@gmail.com Authored: Thu Mar 19 22:40:10 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Thu Mar 19 22:40:10 2015 +0100 -- .../apache/camel/component/paho/PahoEndpoint.java| 15 +++ .../camel/component/paho/PahoComponentTest.java | 11 +++ 2 files changed, 26 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/368be192/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java index a83380d..1c2e46a 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.paho; +import java.util.Set; + import static java.lang.System.nanoTime; import org.apache.camel.Component; @@ -32,12 +34,16 @@ import org.eclipse.paho.client.mqttv3.MqttClientPersistence; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.apache.camel.component.paho.PahoPersistence.MEMORY; @UriEndpoint(scheme = paho, consumerClass = PahoConsumer.class, label = messaging, syntax = paho:topic) public class PahoEndpoint extends DefaultEndpoint { +private static final Logger LOG = LoggerFactory.getLogger(PahoEndpoint.class); + // Constants private static final String DEFAULT_BROKER_URL = tcp://localhost:1883; @@ -119,6 +125,15 @@ public class PahoEndpoint extends DefaultEndpoint { if (connectOptions != null) { return connectOptions; } +SetMqttConnectOptions connectOptions = getCamelContext().getRegistry().findByType(MqttConnectOptions.class); +if (connectOptions.size() == 1) { +LOG.info(Single MqttConnectOptions instance found in the registry. It will be used by the endpoint.); +return connectOptions.iterator().next(); +} else if (connectOptions.size() 1) { +LOG.warn(Found {} instances of the MqttConnectOptions in the registry. None of these will be used by the endpoint. ++ Please use 'connectOptions' endpoint option to select one., +connectOptions.size()); +} return new MqttConnectOptions(); } http://git-wip-us.apache.org/repos/asf/camel/blob/368be192/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java -- diff --git a/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java b/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java index 43674da..905f6fd 100644 --- a/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java +++ b/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoComponentTest.java @@ -121,6 +121,17 @@ public class PahoComponentTest extends CamelTestSupport { } @Test +public void shouldAutomaticallyUseConnectionOptionsFromRegistry() { +// Given +PahoEndpoint pahoWithConnectOptionsFromRegistry = getMandatoryEndpoint( +paho:registryConnectOptions?brokerUrl=tcp://localhost: + mqttPort, +PahoEndpoint.class); + +// Then +assertSame(connectOptions, pahoWithConnectOptionsFromRegistry.resolveMqttConnectOptions()); +} + +@Test public void shouldKeepOriginalMessageInHeader() throws InterruptedException { // Given final String msg = msg;
camel git commit: [CAMEL-8506] Add SEARCH operation to Elasticsearch component
Repository: camel Updated Branches: refs/heads/master 1e17b6b59 - 014ecdb47 [CAMEL-8506] Add SEARCH operation to Elasticsearch component Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/014ecdb4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/014ecdb4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/014ecdb4 Branch: refs/heads/master Commit: 014ecdb47d61d9f44776facb9e7ee270e74925f6 Parents: 1e17b6b Author: Henryk Konsek hekon...@gmail.com Authored: Wed Mar 18 13:47:50 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed Mar 18 13:47:50 2015 +0100 -- .../ElasticsearchConfiguration.java | 1 + .../elasticsearch/ElasticsearchProducer.java| 6 ++ .../ElasticsearchActionRequestConverter.java| 11 ++ .../ElasticsearchComponentTest.java | 21 4 files changed, 39 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/014ecdb4/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java -- diff --git a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java index c38158c..7db78c7 100644 --- a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java +++ b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchConfiguration.java @@ -39,6 +39,7 @@ public class ElasticsearchConfiguration { public static final String OPERATION_BULK_INDEX = BULK_INDEX; public static final String OPERATION_GET_BY_ID = GET_BY_ID; public static final String OPERATION_DELETE = DELETE; +public static final String OPERATION_SEARCH = SEARCH; public static final String PARAM_INDEX_ID = indexId; public static final String PARAM_DATA = data; public static final String PARAM_INDEX_NAME = indexName; http://git-wip-us.apache.org/repos/asf/camel/blob/014ecdb4/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java -- diff --git a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java index c60a1df..2c2647a 100644 --- a/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java +++ b/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/ElasticsearchProducer.java @@ -28,6 +28,7 @@ import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.index.IndexRequest; +import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.Client; /** @@ -69,6 +70,8 @@ public class ElasticsearchProducer extends DefaultProducer { } } else if (request instanceof DeleteRequest) { return ElasticsearchConfiguration.OPERATION_DELETE; +} else if (request instanceof SearchRequest) { +return ElasticsearchConfiguration.OPERATION_SEARCH; } String operationConfig = exchange.getIn().getHeader(ElasticsearchConfiguration.PARAM_OPERATION, String.class); @@ -131,6 +134,9 @@ public class ElasticsearchProducer extends DefaultProducer { } else if (ElasticsearchConfiguration.OPERATION_DELETE.equals(operation)) { DeleteRequest deleteRequest = message.getBody(DeleteRequest.class); message.setBody(client.delete(deleteRequest).actionGet()); +} else if (ElasticsearchConfiguration.OPERATION_SEARCH.equals(operation)) { +SearchRequest searchRequest = message.getBody(SearchRequest.class); +message.setBody(client.search(searchRequest).actionGet()); } else { throw new IllegalArgumentException(ElasticsearchConfiguration.PARAM_OPERATION + value ' + operation + ' is not supported); } http://git-wip-us.apache.org/repos/asf/camel/blob/014ecdb4/components/camel-elasticsearch/src/main/java/org/apache/camel/component/elasticsearch/converter/ElasticsearchActionRequestConverter.java -- diff --git
camel git commit: Refactoring.
Repository: camel Updated Branches: refs/heads/master 0dedb66da - fc3d9f223 Refactoring. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fc3d9f22 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fc3d9f22 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fc3d9f22 Branch: refs/heads/master Commit: fc3d9f22350723afd254bea51fee0351a059ab8e Parents: 0dedb66 Author: Henryk Konsek hekon...@gmail.com Authored: Tue Mar 17 15:54:29 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue Mar 17 15:54:29 2015 +0100 -- .../camel/component/paho/PahoEndpoint.java | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/fc3d9f22/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java index f2b634e..a83380d 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.paho; +import static java.lang.System.nanoTime; + import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; @@ -31,22 +33,29 @@ import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence; -import static java.lang.System.nanoTime; import static org.apache.camel.component.paho.PahoPersistence.MEMORY; @UriEndpoint(scheme = paho, consumerClass = PahoConsumer.class, label = messaging, syntax = paho:topic) public class PahoEndpoint extends DefaultEndpoint { +// Constants + +private static final String DEFAULT_BROKER_URL = tcp://localhost:1883; + +private static final int DEFAULT_QOS = 2; + +private static final String DEFAULT_QOS_STRING = DEFAULT_QOS + ; + // Configuration members @UriPath @Metadata(required = true) private String topic; @UriParam private String clientId = camel- + nanoTime(); -@UriParam(defaultValue = tcp://localhost:1883) -private String brokerUrl = tcp://localhost:1883; -@UriParam(defaultValue = 2) -private int qos = 2; +@UriParam(defaultValue = DEFAULT_BROKER_URL) +private String brokerUrl = DEFAULT_BROKER_URL; +@UriParam(defaultValue = DEFAULT_QOS_STRING) +private int qos = DEFAULT_QOS; @UriParam(defaultValue = MEMORY) private PahoPersistence persistence = MEMORY;
[1/2] camel git commit: Improved logging.
Repository: camel Updated Branches: refs/heads/master fc3d9f223 - 3bcc9d482 Improved logging. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b5a5904a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b5a5904a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b5a5904a Branch: refs/heads/master Commit: b5a5904a4206ca26cb8690e25c2049bdee867afe Parents: fc3d9f2 Author: Henryk Konsek hekon...@gmail.com Authored: Tue Mar 17 16:00:59 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Tue Mar 17 16:00:59 2015 +0100 -- .../java/org/apache/camel/component/paho/PahoConsumer.java | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b5a5904a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConsumer.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConsumer.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConsumer.java index c4d2386..31f56e3 100644 --- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConsumer.java +++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConsumer.java @@ -25,9 +25,13 @@ import org.apache.camel.impl.DefaultConsumer; import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.MqttCallback; import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PahoConsumer extends DefaultConsumer { +private static final Logger LOG = LoggerFactory.getLogger(PahoConsumer.class); + public PahoConsumer(Endpoint endpoint, Processor processor) { super(endpoint, processor); } @@ -40,7 +44,7 @@ public class PahoConsumer extends DefaultConsumer { getEndpoint().getClient().setCallback(new MqttCallback() { @Override public void connectionLost(Throwable cause) { - +LOG.debug(MQTT broker connection lost:, cause); } @Override @@ -56,7 +60,7 @@ public class PahoConsumer extends DefaultConsumer { @Override public void deliveryComplete(IMqttDeliveryToken token) { - +LOG.debug(Delivery complete. Token: {}., token); } }); }
camel git commit: Created Paho component.
Repository: camel Updated Branches: refs/heads/master f01ab0513 - f88d6dda3 Created Paho component. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f88d6dda Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f88d6dda Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f88d6dda Branch: refs/heads/master Commit: f88d6dda3fcb7f2d948de280dfa2353b06585f8e Parents: f01ab05 Author: Henryk Konsek hekon...@gmail.com Authored: Sat Mar 14 20:45:43 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Sat Mar 14 20:45:43 2015 +0100 -- components/camel-paho/pom.xml | 78 + .../camel/component/paho/PahoComponent.java | 33 .../camel/component/paho/PahoConsumer.java | 78 + .../camel/component/paho/PahoEndpoint.java | 169 +++ .../camel/component/paho/PahoPersistence.java | 23 +++ .../camel/component/paho/PahoProducer.java | 47 ++ .../services/org/apache/camel/component/paho| 1 + .../camel/component/paho/PahoComponentTest.java | 121 + components/pom.xml | 1 + 9 files changed, 551 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f88d6dda/components/camel-paho/pom.xml -- diff --git a/components/camel-paho/pom.xml b/components/camel-paho/pom.xml new file mode 100644 index 000..7245efc --- /dev/null +++ b/components/camel-paho/pom.xml @@ -0,0 +1,78 @@ +?xml version=1.0 encoding=UTF-8? +!-- + 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. +-- +project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; + +modelVersion4.0.0/modelVersion + +parent +groupIdorg.apache.camel/groupId +artifactIdcomponents/artifactId +version2.16-SNAPSHOT/version +/parent + +artifactIdcamel-paho/artifactId +packagingbundle/packaging +nameCamel :: Paho/name +descriptionCamel Eclipse Paho support/description + +properties + camel.osgi.export.pkgorg.apache.camel.component.paho.*/camel.osgi.export.pkg + camel.osgi.export.serviceorg.apache.camel.spi.ComponentResolver;component=paho/camel.osgi.export.service +/properties + +dependencies +dependency +groupIdorg.apache.camel/groupId +artifactIdcamel-core/artifactId +/dependency +dependency +groupIdorg.eclipse.paho/groupId +artifactIdorg.eclipse.paho.client.mqttv3/artifactId +version1.0.2/version +/dependency + +dependency +groupIdorg.apache.camel/groupId +artifactIdcamel-test/artifactId +scopetest/scope +/dependency +dependency +groupIdorg.apache.activemq/groupId +artifactIdactivemq-broker/artifactId +scopetest/scope +/dependency +dependency +groupIdorg.apache.activemq/groupId +artifactIdactivemq-mqtt/artifactId +version${activemq-version}/version +scopetest/scope +/dependency +/dependencies + +repositories +repository +ideclipse-paho/id + urlhttps://repo.eclipse.org/content/repositories/paho-releases/url +snapshots +enabledfalse/enabled +/snapshots +/repository +/repositories + +/project http://git-wip-us.apache.org/repos/asf/camel/blob/f88d6dda/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java -- diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java new file mode 100644 index 000..98e80b0 --- /dev/null +++
camel git commit: [CAMEL-8450] Netty component should not stop/null static timer when stopping
Repository: camel Updated Branches: refs/heads/master 066ab818b - 72c65431b [CAMEL-8450] Netty component should not stop/null static timer when stopping Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/72c65431 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/72c65431 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/72c65431 Branch: refs/heads/master Commit: 72c65431b0dc0c5df847fc4ce628e50794cb8934 Parents: 066ab81 Author: Henryk Konsek hekon...@gmail.com Authored: Fri Mar 6 12:12:54 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Fri Mar 6 12:12:54 2015 +0100 -- .../camel/component/netty/NettyComponent.java | 3 -- .../netty/NettyConcurrentTimerAccessTest.java | 52 2 files changed, 52 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/72c65431/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java -- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java index 3954e2e..b140cba 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java @@ -146,9 +146,6 @@ public class NettyComponent extends UriEndpointComponent { @Override protected void doStop() throws Exception { -timer.stop(); -timer = null; - if (executorService != null) { getCamelContext().getExecutorServiceManager().shutdownNow(executorService); executorService = null; http://git-wip-us.apache.org/repos/asf/camel/blob/72c65431/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTimerAccessTest.java -- diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTimerAccessTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTimerAccessTest.java new file mode 100644 index 000..e3355e3 --- /dev/null +++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTimerAccessTest.java @@ -0,0 +1,52 @@ +/** + * 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.component.netty; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.impl.JndiRegistry; +import org.apache.camel.test.AvailablePortFinder; +import org.junit.Test; + +public class NettyConcurrentTimerAccessTest extends BaseNettyTest { + +int secondPort = AvailablePortFinder.getNextAvailable(25000); + +@Test +public void stoppingOneComponentShouldNotAffectTheOther() throws Exception { +context.getComponent(netty1, NettyComponent.class).stop(); +template.sendBody(netty2:tcp://localhost: + secondPort + /pleaseCreateNewEndpoint, msg); +} + +@Override +protected JndiRegistry createRegistry() throws Exception { +JndiRegistry registry = super.createRegistry(); +registry.bind(netty1, new NettyComponent()); +registry.bind(netty2, new NettyComponent()); +return registry; +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +public void configure() throws Exception { +from(netty1:tcp://localhost:{{port}}).to(mock:test); +from(netty2:tcp://localhost: + secondPort).to(mock:test); +} +}; +} + +}
[1/2] camel git commit: [Spring Boot] Fixed routes collection.
Repository: camel Updated Branches: refs/heads/master 7307c0f3d - f34705754 [Spring Boot] Fixed routes collection. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2b0e1e2d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2b0e1e2d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2b0e1e2d Branch: refs/heads/master Commit: 2b0e1e2daa6cc160c6b3fbd4880d6002cf90f02d Parents: 7307c0f Author: Henryk Konsek hekon...@gmail.com Authored: Wed Mar 4 16:25:43 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed Mar 4 17:56:57 2015 +0100 -- .../camel/spring/boot/RoutesCollector.java | 10 ++-- .../spring/boot/DuplicatedRouteIdTest.java | 61 2 files changed, 66 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/2b0e1e2d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java index 1d1c805..e5cc977 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java @@ -49,11 +49,6 @@ public class RoutesCollector implements BeanPostProcessor, PriorityOrdered { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { -return bean; -} - -@Override -public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof CamelContext beanName.equals(camelContext)) { CamelContext camelContext = (CamelContext) bean; LOG.debug(Post-processing CamelContext bean: {}, camelContext.getName()); @@ -76,6 +71,11 @@ public class RoutesCollector implements BeanPostProcessor, PriorityOrdered { } @Override +public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { +return bean; +} + +@Override public int getOrder() { return Ordered.LOWEST; } http://git-wip-us.apache.org/repos/asf/camel/blob/2b0e1e2d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java -- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java new file mode 100644 index 000..eb5feb1 --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java @@ -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.spring.boot; + +import org.apache.camel.RoutesBuilder; +import org.apache.camel.builder.RouteBuilder; +import org.junit.Assert; +import org.junit.Test; +import org.springframework.beans.factory.BeanCreationException; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +public class DuplicatedRouteIdTest extends Assert { + +@Test(expected = BeanCreationException.class) +public void shouldDetectDuplicatedRouteId() { +new SpringApplication(DuplicatedRouteIdTestConfiguration.class).run(); +} + +} + +@SpringBootApplication +class DuplicatedRouteIdTestConfiguration { + +@Bean +RoutesBuilder firstRoute() { +return new RouteBuilder() { +@Override +public void configure() throws Exception { +from(seda:first).routeId(foo).to(mock:first); +} +}; +
[2/2] camel git commit: [Spring Boot] Added @Component test.
[Spring Boot] Added @Component test. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3470575 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3470575 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3470575 Branch: refs/heads/master Commit: f3470575496d7f60eb440fcfc8602d4725aef771 Parents: 2b0e1e2 Author: Henryk Konsek hekon...@gmail.com Authored: Wed Mar 4 17:56:40 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed Mar 4 17:56:58 2015 +0100 -- .../boot/componentroute/ComponentRoute.java | 30 +++ .../boot/componentroute/ComponentRouteTest.java | 55 2 files changed, 85 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f3470575/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java -- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java new file mode 100644 index 000..9dad981 --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java @@ -0,0 +1,30 @@ +/** + * 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.spring.boot.componentroute; + +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; + +@Component +public class ComponentRoute extends RouteBuilder { + +@Override +public void configure() throws Exception { +from(direct:componentRoute).to(mock:componentRoute); +} + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/f3470575/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java -- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java new file mode 100644 index 000..c950f1e --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java @@ -0,0 +1,55 @@ +/** + * 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.spring.boot.componentroute; + +import org.apache.camel.EndpointInject; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.component.mock.MockEndpoint; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootApplication +@SpringApplicationConfiguration(classes = ComponentRouteTest.class) +public class ComponentRouteTest extends Assert { + +@EndpointInject(uri =
camel git commit: [CAMEL-8436][Spring Boot] Delayed CamelContext startup to Spring context refresh.
Repository: camel Updated Branches: refs/heads/master f34705754 - 1c1953ac4 [CAMEL-8436][Spring Boot] Delayed CamelContext startup to Spring context refresh. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1c1953ac Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1c1953ac Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1c1953ac Branch: refs/heads/master Commit: 1c1953ac4dc2319403101b5f04a31e53cdf615f1 Parents: f347057 Author: Henryk Konsek hekon...@gmail.com Authored: Wed Mar 4 22:01:35 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Wed Mar 4 22:01:35 2015 +0100 -- .../spring/boot/CamelAutoConfiguration.java | 1 + .../CamelSpringBootInitializationException.java | 25 .../camel/spring/boot/RoutesCollector.java | 54 +++-- .../spring/boot/DuplicatedRouteIdTest.java | 61 .../boot/componentroute/ComponentRoute.java | 6 ++ .../DuplicatedRouteIdTest.java | 61 6 files changed, 115 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1c1953ac/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index 3931c84..aba9623 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -46,6 +46,7 @@ public class CamelAutoConfiguration { CamelContext camelContext(ApplicationContext applicationContext, CamelConfigurationProperties configurationProperties) { CamelContext camelContext = new SpringCamelContext(applicationContext); +SpringCamelContext.setNoStart(true); if (!configurationProperties.isJmxEnabled()) { camelContext.disableJMX(); http://git-wip-us.apache.org/repos/asf/camel/blob/1c1953ac/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootInitializationException.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootInitializationException.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootInitializationException.java new file mode 100644 index 000..67e0399 --- /dev/null +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootInitializationException.java @@ -0,0 +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.spring.boot; + +public class CamelSpringBootInitializationException extends RuntimeException { + +public CamelSpringBootInitializationException(Throwable cause) { +super(cause); +} + +} http://git-wip-us.apache.org/repos/asf/camel/blob/1c1953ac/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java index e5cc977..b0c501a 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java @@ -19,16 +19,14 @@ package org.apache.camel.spring.boot; import java.util.List; import org.apache.camel.CamelContext; -import org.apache.camel.Ordered; import
camel git commit: Added commons IO to parent POM.
Repository: camel Updated Branches: refs/heads/master 4ffe89dc9 - 4112a72f8 Added commons IO to parent POM. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4112a72f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4112a72f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4112a72f Branch: refs/heads/master Commit: 4112a72f8e52708ab44655e89ec8778f3ee49857 Parents: 4ffe89d Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 2 18:07:29 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 2 18:07:29 2015 +0100 -- components/camel-spring-boot/pom.xml | 2 -- parent/pom.xml | 5 + 2 files changed, 5 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4112a72f/components/camel-spring-boot/pom.xml -- diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml index d23c27c..b0d9649 100644 --- a/components/camel-spring-boot/pom.xml +++ b/components/camel-spring-boot/pom.xml @@ -68,7 +68,6 @@ /dependency !-- Testing dependencies -- - dependency groupIdjunit/groupId artifactIdjunit/artifactId @@ -82,7 +81,6 @@ dependency groupIdcommons-io/groupId artifactIdcommons-io/artifactId -version${commons-io-version}/version scopetest/scope /dependency dependency http://git-wip-us.apache.org/repos/asf/camel/blob/4112a72f/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 944c734..2615f09 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -2311,6 +2311,11 @@ version${commons-collections-version}/version /dependency dependency +groupIdcommons-io/groupId +artifactIdcommons-io/artifactId +version${commons-io-version}/version + /dependency + dependency groupIdcommons-httpclient/groupId artifactIdcommons-httpclient/artifactId version${httpclient-version}/version
camel git commit: Upgraded Spring Boot.
Repository: camel Updated Branches: refs/heads/master 51fa379fd - 4ffe89dc9 Upgraded Spring Boot. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4ffe89dc Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4ffe89dc Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4ffe89dc Branch: refs/heads/master Commit: 4ffe89dc92845f500e79ced93e7d768d53fd1e08 Parents: 51fa379 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 2 18:04:23 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 2 18:04:23 2015 +0100 -- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4ffe89dc/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index af35938..944c734 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -424,7 +424,7 @@ splunk-version1.3.2.0_1/splunk-version spring-batch-version3.0.3.RELEASE/spring-batch-version spring-batch-bundle-version3.0.3.RELEASE_1/spring-batch-bundle-version -spring-boot-version1.2.1.RELEASE/spring-boot-version +spring-boot-version1.2.2.RELEASE/spring-boot-version spring-castor-bundle-version1.2.0/spring-castor-bundle-version spring-data-commons-version1.6.1.RELEASE/spring-data-commons-version spring-data-redis-version1.3.4.RELEASE/spring-data-redis-version
camel git commit: Migrated Spring Boot tests to Netty 4.
Repository: camel Updated Branches: refs/heads/master 2b525b9c5 - 51fa379fd Migrated Spring Boot tests to Netty 4. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/51fa379f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/51fa379f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/51fa379f Branch: refs/heads/master Commit: 51fa379fd4f7f156d3c83ebcf514ecf4ed55893c Parents: 2b525b9 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 2 18:03:55 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 2 18:03:55 2015 +0100 -- components/camel-spring-boot/pom.xml | 4 ++-- .../camel/spring/boot/fatjarroutertests/TestFatJarRouter.java| 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/51fa379f/components/camel-spring-boot/pom.xml -- diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml index a109b9f..d23c27c 100644 --- a/components/camel-spring-boot/pom.xml +++ b/components/camel-spring-boot/pom.xml @@ -88,12 +88,12 @@ dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-test/artifactId -scopetest/scope version${spring-boot-version}/version +scopetest/scope /dependency dependency groupIdorg.apache.camel/groupId -artifactIdcamel-netty-http/artifactId +artifactIdcamel-netty4-http/artifactId scopetest/scope /dependency /dependencies http://git-wip-us.apache.org/repos/asf/camel/blob/51fa379f/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java -- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java index 9770024..ed44d5c 100644 --- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java @@ -25,7 +25,8 @@ public class TestFatJarRouter extends FatJarRouter { @Override public void configure() throws Exception { - from(netty-http:http://0.0.0.0:{{http.port}};).setBody().simple(ref:stringBean); +from(netty4-http:http://0.0.0.0:{{http.port}};). +setBody().simple(ref:stringBean); } @Bean
camel git commit: Optimized POM.
Repository: camel Updated Branches: refs/heads/master 4112a72f8 - d33af55d6 Optimized POM. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d33af55d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d33af55d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d33af55d Branch: refs/heads/master Commit: d33af55d65da9678afaecfbb018e6eadf97fbbae Parents: 4112a72 Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 2 18:09:10 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 2 18:09:10 2015 +0100 -- components/camel-spring-boot/pom.xml | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d33af55d/components/camel-spring-boot/pom.xml -- diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml index b0d9649..5151289 100644 --- a/components/camel-spring-boot/pom.xml +++ b/components/camel-spring-boot/pom.xml @@ -48,13 +48,7 @@ artifactIdcamel-spring/artifactId /dependency -!-- Spring web support -- -dependency -groupIdorg.springframework.boot/groupId -artifactIdspring-boot/artifactId -optionaltrue/optional -version${spring-boot-version}/version -/dependency +!-- Optional Spring web support -- dependency groupIdorg.springframework/groupId artifactIdspring-web/artifactId
camel git commit: Added explicit class exclusion to the RoutesCollector condition.
Repository: camel Updated Branches: refs/heads/master ad35c0bbd - 68ab0afec Added explicit class exclusion to the RoutesCollector condition. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/68ab0afe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/68ab0afe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/68ab0afe Branch: refs/heads/master Commit: 68ab0afec964f4626e457e1fcfdf3af7a5988c46 Parents: ad35c0b Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 2 20:37:21 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 2 20:37:29 2015 +0100 -- .../java/org/apache/camel/spring/boot/CamelAutoConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/68ab0afe/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index 6bd39d3..dbc8028 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -59,7 +59,7 @@ public class CamelAutoConfiguration { } @Bean -@ConditionalOnMissingBean +@ConditionalOnMissingBean(RoutesCollector.class) RoutesCollector routesCollector(ApplicationContext applicationContext) { CollectionCamelContextConfiguration configurations = applicationContext.getBeansOfType(CamelContextConfiguration.class).values(); return new RoutesCollector(applicationContext, new ArrayListCamelContextConfiguration(configurations));
camel git commit: Added extra comments.
Repository: camel Updated Branches: refs/heads/master 68ab0afec - c2e6c7e6e Added extra comments. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c2e6c7e6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c2e6c7e6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c2e6c7e6 Branch: refs/heads/master Commit: c2e6c7e6e3e4eecebe4677a23e37d1a7714222f5 Parents: 68ab0af Author: Henryk Konsek hekon...@gmail.com Authored: Mon Mar 2 20:40:21 2015 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Mon Mar 2 20:40:21 2015 +0100 -- .../java/org/apache/camel/spring/boot/CamelAutoConfiguration.java | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c2e6c7e6/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index dbc8028..3931c84 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -83,6 +83,8 @@ public class CamelAutoConfiguration { return camelContext.createConsumerTemplate(configurationProperties.getConsumerTemplateCacheSize()); } +// SpringCamelContext integration + @Bean PropertiesParser propertiesParser() { return new SpringPropertiesParser();