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 2014/06/25 15:45:28 UTC
[1/3] git commit: Fix for CAMEL-7534 Expose the component options for
Camel HTTP4
Repository: camel
Updated Branches:
refs/heads/master 8100a976b -> c1fcdfbc8
Fix for CAMEL-7534 Expose the component options for Camel HTTP4
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5d493f91
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5d493f91
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5d493f91
Branch: refs/heads/master
Commit: 5d493f9103b802b01bf42cce4152943090a007b6
Parents: 8100a97
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Wed Jun 25 11:58:00 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Wed Jun 25 11:58:22 2014 +0200
----------------------------------------------------------------------
.../camel/component/http4/HttpEndpoint.java | 13 +++++
...ponentConfigurationAndDocumentationTest.java | 57 ++++++++++++++++++++
2 files changed, 70 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5d493f91/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
index 2ef06b8..ab0fe42 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
@@ -25,6 +25,8 @@ import org.apache.camel.component.http4.helper.HttpHelper;
import org.apache.camel.impl.DefaultPollingEndpoint;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.spi.HeaderFilterStrategyAware;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
import org.apache.camel.util.ObjectHelper;
import org.apache.http.HttpHost;
import org.apache.http.client.CookieStore;
@@ -42,6 +44,7 @@ import org.slf4j.LoggerFactory;
*
* @version
*/
+@UriEndpoint(scheme = "http4", consumerClass = HttpConsumer.class)
public class HttpEndpoint extends DefaultPollingEndpoint implements HeaderFilterStrategyAware {
private static final Logger LOG = LoggerFactory.getLogger(HttpEndpoint.class);
@@ -54,16 +57,26 @@ public class HttpEndpoint extends DefaultPollingEndpoint implements HeaderFilter
private HttpClientConnectionManager clientConnectionManager;
private HttpClientBuilder clientBuilder;
private HttpClient httpClient;
+ @UriParam
private boolean throwExceptionOnFailure = true;
+ @UriParam
private boolean bridgeEndpoint;
+ @UriParam
private boolean matchOnUriPrefix;
+ @UriParam
private boolean chunked = true;
+ @UriParam
private boolean disableStreamCache;
+ @UriParam
private boolean transferException;
+ @UriParam
private boolean traceEnabled;
+ @UriParam
private boolean authenticationPreemptive;
+ @UriParam
private String httpMethodRestrict;
private UrlRewrite urlRewrite;
+ @UriParam
private boolean clearExpiredCookies = true;
private CookieStore cookieStore = new BasicCookieStore();
http://git-wip-us.apache.org/repos/asf/camel/blob/5d493f91/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpComponentConfigurationAndDocumentationTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..150bf95
--- /dev/null
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.http4;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class HttpComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testComponentConfiguration() throws Exception {
+ HttpComponent comp = context.getComponent("http4", HttpComponent.class);
+ EndpointConfiguration conf = comp.createConfiguration("http4://www.google.com?proxyAuthHost=myproxy&" +
+ "proxyAuthPort=1234&chunked=false");
+
+ assertEquals("myproxy", conf.getParameter("proxyAuthHost"));
+ assertEquals("false", conf.getParameter("chunked"));
+
+ ComponentConfiguration compConf = comp.createComponentConfiguration();
+ String json = compConf.createParameterJsonSchema();
+ assertNotNull(json);
+
+ assertTrue(json.contains("\"httpMethodRestrict\": { \"type\": \"java.lang.String\" }"));
+ assertTrue(json.contains("\"throwExceptionOnFailure\": { \"type\": \"boolean\" }"));
+ }
+
+ @Test
+ public void testComponentDocumentation() throws Exception {
+ CamelContext context = new DefaultCamelContext();
+ String html = context.getComponentDocumentation("http4");
+ assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+ }
+
+}
[3/3] git commit: Merge branch 'CAMEL-7537' of
https://github.com/kevinearls/camel
Posted by da...@apache.org.
Merge branch 'CAMEL-7537' of https://github.com/kevinearls/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c1fcdfbc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c1fcdfbc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c1fcdfbc
Branch: refs/heads/master
Commit: c1fcdfbc80c1c0056df3638b122f9ea16b1a2d05
Parents: 5d493f9 1024879
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jun 25 15:44:36 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 25 15:44:36 2014 +0200
----------------------------------------------------------------------
.../optaplanner/OptaPlannerComponent.java | 8 ++-
.../optaplanner/OptaPlannerEndpoint.java | 2 +
...ponentConfigurationAndDocumentationTest.java | 56 ++++++++++++++++++++
3 files changed, 64 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: Fix for CAMEL-7537 Expose the component options for
Camel OptaPlanner
Posted by da...@apache.org.
Fix for CAMEL-7537 Expose the component options for Camel OptaPlanner
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1024879d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1024879d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1024879d
Branch: refs/heads/master
Commit: 1024879df5c05a4bc79fa826a974aeb2ec18daf9
Parents: 8100a97
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Wed Jun 25 14:21:14 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Wed Jun 25 14:21:14 2014 +0200
----------------------------------------------------------------------
.../optaplanner/OptaPlannerComponent.java | 8 ++-
.../optaplanner/OptaPlannerEndpoint.java | 2 +
...ponentConfigurationAndDocumentationTest.java | 56 ++++++++++++++++++++
3 files changed, 64 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1024879d/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
index 307dba5..f19fe5f 100644
--- a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
+++ b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
@@ -19,14 +19,18 @@ package org.apache.camel.component.optaplanner;
import java.util.Map;
import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.UriEndpointComponent;
import org.optaplanner.core.api.solver.SolverFactory;
import org.optaplanner.core.config.solver.XmlSolverFactory;
/**
* OptaPlanner component for Camel
*/
-public class OptaPlannerComponent extends DefaultComponent {
+public class OptaPlannerComponent extends UriEndpointComponent {
+
+ public OptaPlannerComponent() {
+ super(OptaPlannerEndpoint.class);
+ }
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
SolverFactory solverFactory = new XmlSolverFactory(remaining);
http://git-wip-us.apache.org/repos/asf/camel/blob/1024879d/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
index fe4003b..c120fd0 100644
--- a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
+++ b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
@@ -20,6 +20,7 @@ import org.apache.camel.Component;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.component.ResourceEndpoint;
+import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.util.ObjectHelper;
import org.optaplanner.core.api.solver.Solver;
import org.optaplanner.core.api.solver.SolverFactory;
@@ -28,6 +29,7 @@ import org.optaplanner.core.impl.solution.Solution;
/**
* OptaPlanner endpoint for Camel
*/
+@UriEndpoint(scheme = "optaplanner")
public class OptaPlannerEndpoint extends ResourceEndpoint {
private SolverFactory solverFactory;
http://git-wip-us.apache.org/repos/asf/camel/blob/1024879d/components/camel-optaplanner/src/test/java/org/apache/camel/component/optaplanner/OptaPlannerComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-optaplanner/src/test/java/org/apache/camel/component/optaplanner/OptaPlannerComponentConfigurationAndDocumentationTest.java b/components/camel-optaplanner/src/test/java/org/apache/camel/component/optaplanner/OptaPlannerComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..f094e33
--- /dev/null
+++ b/components/camel-optaplanner/src/test/java/org/apache/camel/component/optaplanner/OptaPlannerComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,56 @@
+/**
+ * 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.optaplanner;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class OptaPlannerComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testComponentConfiguration() throws Exception {
+ OptaPlannerComponent component = context.getComponent("optaplanner", OptaPlannerComponent.class);
+ EndpointConfiguration configuration = component.createConfiguration("optaplanner:/org/apache/camel/component/optaplanner/solverConfig.xml?" +
+ "synchronous=false&contentCache=true");
+
+ assertEquals("true", configuration.getParameter("contentCache"));
+
+ ComponentConfiguration componentConfiguration = component.createComponentConfiguration();
+ String json = componentConfiguration.createParameterJsonSchema();
+ assertNotNull(json);
+
+ assertTrue(json.contains("\"resourceUri\": { \"type\": \"java.lang.String\" }"));
+ assertTrue(json.contains("\"synchronous\": { \"type\": \"boolean\" }"));
+ }
+
+ @Test
+ public void testComponentDocumentation() throws Exception {
+ CamelContext context = new DefaultCamelContext();
+ String html = context.getComponentDocumentation("optaplanner");
+ assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+ }
+
+}