You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/05/31 13:43:45 UTC
[1/2] camel git commit: CAMEL-10004: Added unit test
Repository: camel
Updated Branches:
refs/heads/camel-2.17.x f276b5fbe -> 0be02b861
refs/heads/master 02fa6a655 -> 3584f0905
CAMEL-10004: Added unit test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3584f090
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3584f090
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3584f090
Branch: refs/heads/master
Commit: 3584f090556c6f4d2860fda5f4eb48405c4a7a99
Parents: 02fa6a6
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 31 15:41:32 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 31 15:42:27 2016 +0200
----------------------------------------------------------------------
.../FtpPollEnrichBridgeErrorHandlerTest.java | 90 ++++++++++++++++++++
1 file changed, 90 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3584f090/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java
new file mode 100644
index 0000000..c550a50
--- /dev/null
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpPollEnrichBridgeErrorHandlerTest.java
@@ -0,0 +1,90 @@
+/**
+ * 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.file.remote;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.junit.Test;
+
+import static org.apache.camel.util.ExchangeHelper.copyResultsPreservePattern;
+
+public class FtpPollEnrichBridgeErrorHandlerTest extends BaseServerTestSupport {
+
+ // we want to poll enrich from FTP and therefore want to fail fast if something is wrong
+ // and then bridge that error to the Camel routing error handler
+ // so we need to turn of reconnection attempts
+ // and turn of auto create as that will pre-login to check if the directory exists
+ // and in case of connection error then throw that as an exception
+ private String uri = "ftp://admin@localhost:" + getPort() + "/unknown/?password=admin"
+ + "&maximumReconnectAttempts=0&autoCreate=false&throwExceptionOnConnectFailed=true&consumer.bridgeErrorHandler=true";
+
+ @Test
+ public void testPollEnrich() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(0);
+ getMockEndpoint("mock:dead").expectedMessageCount(1);
+
+ template.sendBody("seda:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+
+ Exchange out = getMockEndpoint("mock:dead").getExchanges().get(0);
+ assertNotNull(out);
+
+ Exception caught = out.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
+ assertNotNull("Should store caught exception", caught);
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ errorHandler(deadLetterChannel("mock:dead"));
+
+ from("seda:start")
+ // the FTP server is not running and therefore we should get an exception
+ // and use 60s timeout
+ // and turn on aggregation on exception as we have turned on bridge error handler,
+ // so we want to run out custom aggregation strategy for exceptions as well
+ .pollEnrich(uri, 60000, new MyAggregationStrategy(), true)
+ .to("mock:result");
+ }
+ };
+ }
+
+ private class MyAggregationStrategy implements AggregationStrategy {
+
+ @Override
+ public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+ if (newExchange != null) {
+ copyResultsPreservePattern(oldExchange, newExchange);
+ } else {
+ // if no newExchange then there was no message from the external resource
+ // and therefore we should set an empty body to indicate this fact
+ // but keep headers/attachments as we want to propagate those
+ oldExchange.getIn().setBody(null);
+ oldExchange.setOut(null);
+ }
+ // in case of exception we are bridged then we want to perform redeliveries etc.
+ // so we need to turn of exhausted redelivery
+ oldExchange.removeProperties(Exchange.REDELIVERY_EXHAUSTED);
+ return oldExchange;
+ }
+ }
+}
\ No newline at end of file
[2/2] camel git commit: Upgrade mqtt-client version to 1.14 to pickup
some bug fixes.
Posted by da...@apache.org.
Upgrade mqtt-client version to 1.14 to pickup some bug fixes.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0be02b86
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0be02b86
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0be02b86
Branch: refs/heads/camel-2.17.x
Commit: 0be02b86100de056de22f7567abef29b00941861
Parents: f276b5f
Author: Hiram Chirino <hi...@hiramchirino.com>
Authored: Tue May 31 09:35:28 2016 -0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 31 15:43:27 2016 +0200
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0be02b86/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 49ff4a2..fdd6a69 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -407,7 +407,7 @@
<mockito-version>1.9.5</mockito-version>
<mongo-java-driver-version>3.2.2</mongo-java-driver-version>
<mongo-hadoop-version>1.5.0</mongo-hadoop-version>
- <mqtt-client-version>1.12</mqtt-client-version>
+ <mqtt-client-version>1.14</mqtt-client-version>
<msv-version>2013.6.1</msv-version>
<mustache-java-version>0.9.1</mustache-java-version>
<mustache-guava-version>16.0</mustache-guava-version>