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 2017/07/04 08:52:47 UTC
[1/4] camel git commit: Fixed CS
Repository: camel
Updated Branches:
refs/heads/camel-2.19.x 26085bb4b -> bb07bcd25
refs/heads/master 717edf803 -> 0bab270c8
Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0bab270c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0bab270c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0bab270c
Branch: refs/heads/master
Commit: 0bab270c89f95d3f1ab3657df1af78ed11fe2992
Parents: 756e56c
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 4 10:52:12 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 4 10:52:19 2017 +0200
----------------------------------------------------------------------
.../apache/camel/catalog/maven/PatchedHttpClientHandler.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0bab270c/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
index 66a26f4..499ed58 100644
--- a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
+++ b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
@@ -5,9 +5,9 @@
* 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * 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.
[4/4] camel git commit: Fixed CS
Posted by da...@apache.org.
Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bb07bcd2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bb07bcd2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bb07bcd2
Branch: refs/heads/camel-2.19.x
Commit: bb07bcd25f3d985ef834fed5d1446529e8214bce
Parents: 26085bb
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 4 10:52:12 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 4 10:52:40 2017 +0200
----------------------------------------------------------------------
.../apache/camel/catalog/maven/PatchedHttpClientHandler.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/bb07bcd2/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
index 66a26f4..499ed58 100644
--- a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
+++ b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
@@ -5,9 +5,9 @@
* 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * 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.
[3/4] camel git commit: CAMEL-11506: camel-catalog-maven should use
Apache Commons http-client 3.1 to download http/https as it has support for
timeout which the basic handler from the JDK does not.
Posted by da...@apache.org.
CAMEL-11506: camel-catalog-maven should use Apache Commons http-client 3.1 to download http/https as it has support for timeout which the basic handler from the JDK does not.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5c08aef8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5c08aef8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5c08aef8
Branch: refs/heads/master
Commit: 5c08aef8b0f279b82cb1e9ae0f0ce97f81c6ae5e
Parents: 717edf8
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 4 10:39:16 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 4 10:52:19 2017 +0200
----------------------------------------------------------------------
platforms/camel-catalog-maven/pom.xml | 7 ++
.../catalog/maven/MavenVersionManager.java | 15 ++++
.../catalog/maven/PatchedHttpClientHandler.java | 72 ++++++++++++++++++++
3 files changed, 94 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5c08aef8/platforms/camel-catalog-maven/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-maven/pom.xml b/platforms/camel-catalog-maven/pom.xml
index 6551506..a45735c 100644
--- a/platforms/camel-catalog-maven/pom.xml
+++ b/platforms/camel-catalog-maven/pom.xml
@@ -61,6 +61,13 @@
<version>${ivy-version}</version>
</dependency>
+ <!-- use http client 3.x for downloading as its better than the JDK client -->
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${httpclient-version}</version>
+ </dependency>
+
<!-- testing -->
<dependency>
<groupId>junit</groupId>
http://git-wip-us.apache.org/repos/asf/camel/blob/5c08aef8/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java
index 066b7ca..d9cfa1a 100644
--- a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java
+++ b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java
@@ -26,6 +26,7 @@ import java.util.Map;
import groovy.grape.Grape;
import groovy.lang.GroovyClassLoader;
import org.apache.camel.catalog.VersionManager;
+import org.apache.ivy.util.url.URLHandlerRegistry;
/**
* A {@link VersionManager} that can load the resources using Maven to download needed artifacts from
@@ -36,6 +37,7 @@ import org.apache.camel.catalog.VersionManager;
public class MavenVersionManager implements VersionManager {
private final ClassLoader classLoader = new GroovyClassLoader();
+ private final PatchedHttpClientHandler httpClient = new PatchedHttpClientHandler();
private String version;
private String runtimeProviderVersion;
private String cacheDirectory;
@@ -61,6 +63,15 @@ public class MavenVersionManager implements VersionManager {
}
/**
+ * Sets the timeout in millis (http.socket.timeout) when downloading via http/https protocols.
+ * <p/>
+ * The default value is 10000
+ */
+ public void setHttpClientTimeout(int timeout) {
+ httpClient.setTimeout(timeout);
+ }
+
+ /**
* To add a 3rd party Maven repository.
*
* @param name the repository name
@@ -81,6 +92,8 @@ public class MavenVersionManager implements VersionManager {
@Override
public boolean loadVersion(String version) {
try {
+ URLHandlerRegistry.setDefault(httpClient);
+
if (cacheDirectory != null) {
System.setProperty("grape.root", cacheDirectory);
}
@@ -113,6 +126,8 @@ public class MavenVersionManager implements VersionManager {
@Override
public boolean loadRuntimeProviderVersion(String groupId, String artifactId, String version) {
try {
+ URLHandlerRegistry.setDefault(httpClient);
+
Grape.setEnableAutoDownload(true);
Map<String, Object> param = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/camel/blob/5c08aef8/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
new file mode 100644
index 0000000..66a26f4
--- /dev/null
+++ b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/PatchedHttpClientHandler.java
@@ -0,0 +1,72 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.catalog.maven;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.ivy.util.url.BasicURLHandler;
+import org.apache.ivy.util.url.HttpClientHandler;
+
+/**
+ * A patched {@link HttpClientHandler} which allows to use HttpClient for downloading via http/https
+ * and have support for timeouts which is not supported out of the box by default.
+ */
+public class PatchedHttpClientHandler extends HttpClientHandler {
+
+ // use basic handler for non http/https as it can load from jar/file etc
+ private BasicURLHandler basic = new BasicURLHandler();
+
+ private int timeout = 10000;
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * Sets the timeout in millis (http.socket.timeout) when downloading via http/https protocols.
+ * <p/>
+ * The default value is 10000
+ */
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+
+ @Override
+ public URLInfo getURLInfo(URL url) {
+ // ensure we always use a timeout
+ String protocol = url.getProtocol();
+ if ("http".equals(protocol) || "https".equals(protocol)) {
+ return super.getURLInfo(url, timeout);
+ } else {
+ // use basic for non http
+ return basic.getURLInfo(url, timeout);
+ }
+ }
+
+ @Override
+ public InputStream openStream(URL url) throws IOException {
+ String protocol = url.getProtocol();
+ if ("http".equals(protocol) || "https".equals(protocol)) {
+ return super.openStream(url);
+ } else {
+ // use basic for non http
+ return basic.openStream(url);
+ }
+ }
+}
[2/4] camel git commit: Polished test
Posted by da...@apache.org.
Polished test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/756e56c8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/756e56c8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/756e56c8
Branch: refs/heads/master
Commit: 756e56c81fa8e1bcf426b201a788a5243087e518
Parents: 5c08aef
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 4 10:43:55 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 4 10:52:19 2017 +0200
----------------------------------------------------------------------
.../camel/catalog/maven/MavenVersionManagerTest.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/756e56c8/platforms/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java b/platforms/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java
index e9cdcb0..bf5fe2f 100644
--- a/platforms/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java
+++ b/platforms/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java
@@ -156,13 +156,13 @@ public class MavenVersionManagerTest extends TestCase {
System.out.println("2.18.1 has " + components + " components");
assertFalse("Should not have ejb component", catalog.findComponentNames().contains("ejb"));
- loaded = catalog.loadVersion("2.19.0-SNAPSHOT");
- assertTrue("Unable to switch to Camel Catalog 2.19.0-SNAPSHOT", loaded);
- loaded = catalog.loadRuntimeProviderVersion("org.apache.camel", "camel-catalog-provider-karaf", "2.19.0-SNAPSHOT");
- assertTrue("Unable to load Karaf Provider Camel Catalog 2.19.0-SNAPSHOT", loaded);
+ loaded = catalog.loadVersion("2.19.1");
+ assertTrue("Unable to switch to Camel Catalog 2.19.1", loaded);
+ loaded = catalog.loadRuntimeProviderVersion("org.apache.camel", "camel-catalog-provider-karaf", "2.19.1");
+ assertTrue("Unable to load Karaf Provider Camel Catalog 2.19.1", loaded);
int componentsNewer = catalog.findComponentNames().size();
assertTrue("Both catalog versions shouldn't have the same count of components.", components != componentsNewer);
- System.out.println("2.19.0-SNAPSHOT has " + componentsNewer + " components");
+ System.out.println("2.19.1 has " + componentsNewer + " components");
assertFalse("Should not have ejb component", catalog.findComponentNames().contains("ejb"));
loaded = catalog.loadVersion("2.18.1");