camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] git commit: Fix for CAMEL-7534 Expose the component options for Camel HTTP4
Date Wed, 25 Jun 2014 13:45:28 GMT
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 <kevin@kevinearls.com>
Authored: Wed Jun 25 11:58:00 2014 +0200
Committer: Kevin Earls <kevin@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);
+    }
+
+}


Mime
View raw message