camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject git commit: Fix for CAMEL-7535 Expose the component options for Camel Jetty
Date Tue, 01 Jul 2014 16:05:29 GMT
Repository: camel
Updated Branches:
  refs/heads/master 7f14a9535 -> 685ffd5d7


Fix for CAMEL-7535 Expose the component options for Camel Jetty


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/685ffd5d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/685ffd5d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/685ffd5d

Branch: refs/heads/master
Commit: 685ffd5d70ede0c8e9f053eb75942275aa961c91
Parents: 7f14a95
Author: Kevin Earls <kevin@kevinearls.com>
Authored: Tue Jul 1 14:57:11 2014 +0200
Committer: Kevin Earls <kevin@kevinearls.com>
Committed: Tue Jul 1 14:57:11 2014 +0200

----------------------------------------------------------------------
 .../camel/component/http/HttpComponent.java     |  4 ++
 .../component/jetty/JettyHttpComponent.java     |  4 ++
 .../component/jetty/JettyHttpEndpoint.java      | 12 ++++
 ...ponentConfigurationAndDocumentationTest.java | 58 ++++++++++++++++++++
 4 files changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/685ffd5d/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
index a7f0719..717c505 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
@@ -52,6 +52,10 @@ public class HttpComponent extends HeaderFilterStrategyComponent {
         super(HttpEndpoint.class);
     }
 
+    public HttpComponent(Class<? extends HttpEndpoint> endpointClass) {
+        super(endpointClass);
+    }
+
     /**
      * Connects the URL specified on the endpoint to the specified processor.
      *

http://git-wip-us.apache.org/repos/asf/camel/blob/685ffd5d/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
index 6d15b68..68dd70b 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -107,6 +107,10 @@ public class JettyHttpComponent extends HttpComponent {
     protected String proxyHost;
     private Integer proxyPort;
 
+    public JettyHttpComponent() {
+        super(JettyHttpEndpoint.class);
+    }
+
     class ConnectorRef {
         Server server;
         Connector connector;

http://git-wip-us.apache.org/repos/asf/camel/blob/685ffd5d/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
index a55e43d..483fc9a 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
@@ -30,6 +30,8 @@ import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.component.http.HttpConsumer;
 import org.apache.camel.component.http.HttpEndpoint;
 import org.apache.camel.impl.SynchronousDelegateProducer;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.jsse.SSLContextParameters;
 import org.eclipse.jetty.client.HttpClient;
@@ -38,21 +40,31 @@ import org.eclipse.jetty.server.Handler;
 /**
  * @version 
  */
+@UriEndpoint(scheme = "jetty")
 public class JettyHttpEndpoint extends HttpEndpoint {
 
+    @UriParam
     private boolean sessionSupport;
     private List<Handler> handlers;
     private HttpClient client;
+    @UriParam
     private Integer httpClientMinThreads;
+    @UriParam
     private Integer httpClientMaxThreads;
     private JettyHttpBinding jettyBinding;
+    @UriParam
     private boolean enableJmx;
+    @UriParam
     private boolean enableMultipartFilter;
+    @UriParam
     private boolean sendServerVersion = true;
+    @UriParam
     private boolean sendDateHeader;
     private Filter multipartFilter;
     private List<Filter> filters;
+    @UriParam
     private Long continuationTimeout;
+    @UriParam
     private Boolean useContinuation;
     private SSLContextParameters sslContextParameters;
     private Map<String, Object> httpClientParameters;

http://git-wip-us.apache.org/repos/asf/camel/blob/685ffd5d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..976700d
--- /dev/null
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.jetty;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.component.http.HttpComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class JettyHttpComponentConfigurationAndDocumentationTest extends CamelTestSupport
{
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        JettyHttpComponent comp = context.getComponent("jetty", JettyHttpComponent.class);
+        EndpointConfiguration conf = comp.createConfiguration("jetty://http://localhost:8080/myapp?"
+
+                "httpClientMinThreads=4&httpClientMaxThreads=8");
+
+        assertEquals("4", conf.getParameter("httpClientMinThreads"));
+        assertEquals("8", conf.getParameter("httpClientMaxThreads"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+
+        assertTrue(json.contains("\"httpClientMaxThreads\": { \"type\": \"java.lang.Integer\"
}"));
+        assertTrue(json.contains("\"sessionSupport\": { \"type\": \"boolean\" }"));
+    }
+
+    @Test
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("jetty");
+        assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+    }
+
+}


Mime
View raw message