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/07/03 13:18:21 UTC
[1/2] git commit: Fix for CAMEL-7574 Expose the component options for
Camel Atmosphere Websocket
Repository: camel
Updated Branches:
refs/heads/master 4f393f31c -> 527ce6c7b
Fix for CAMEL-7574 Expose the component options for Camel Atmosphere Websocket
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9e773d89
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9e773d89
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9e773d89
Branch: refs/heads/master
Commit: 9e773d8982210b70bda2aad83dd88aea068ca549
Parents: 75dfe61
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Thu Jul 3 12:25:33 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Thu Jul 3 12:25:33 2014 +0200
----------------------------------------------------------------------
.../apache/camel/impl/DefaultCamelContext.java | 2 +
.../websocket/WebsocketComponent.java | 1 +
.../atmosphere/websocket/WebsocketEndpoint.java | 5 ++
...ponentConfigurationAndDocumentationTest.java | 58 ++++++++++++++++++++
4 files changed, 66 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9e773d89/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 250ff4f..ad84012 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -1060,6 +1060,8 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
} else if ("gauth".equals(componentName) || "ghttp".equals(componentName) || "glogin".equals(componentName)
|| "gmail".equals(componentName) || "gtask".equals(componentName)) {
return "gae/" + componentName.substring(1);
+ } else if ("atmosphere-websocket".equals(componentName)) {
+ return "atmosphere/websocket";
}
return componentName.replaceAll("-", "");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/9e773d89/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java
index 7c34b1a..b9541ac 100644
--- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java
@@ -32,6 +32,7 @@ public class WebsocketComponent extends ServletComponent {
public WebsocketComponent() {
// override the default servlet name of ServletComponent
+ super(WebsocketEndpoint.class);
setServletName("CamelWsServlet");
this.stores = new HashMap<String, WebSocketStore>();
http://git-wip-us.apache.org/repos/asf/camel/blob/9e773d89/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java
index 9d06c1c..5183019 100644
--- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java
@@ -24,15 +24,20 @@ import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.component.http.HttpClientConfigurer;
import org.apache.camel.component.servlet.ServletEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
import org.apache.commons.httpclient.HttpConnectionManager;
import org.apache.commons.httpclient.params.HttpClientParams;
/**
*
*/
+@UriEndpoint(scheme = "atmosphere-websocket", consumerClass = WebsocketConsumer.class)
public class WebsocketEndpoint extends ServletEndpoint {
private WebSocketStore store;
+ @UriParam
private boolean sendToAll;
+ @UriParam
private boolean useStreaming;
public WebsocketEndpoint(String endPointURI, WebsocketComponent component, URI httpUri, HttpClientParams params, HttpConnectionManager httpConnectionManager,
http://git-wip-us.apache.org/repos/asf/camel/blob/9e773d89/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketComponentConfigurationAndDocumentationTest.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..f1e123b
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketComponentConfigurationAndDocumentationTest.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.wsservlet;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.component.atmosphere.websocket.WebsocketComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+import java.util.List;
+
+public class WebsocketComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testComponentConfiguration() throws Exception {
+ WebsocketComponent comp = context.getComponent("atmosphere-websocket", WebsocketComponent.class);
+ EndpointConfiguration conf = comp.createConfiguration("atmosphere-websocket://localhost:8088/hola?sendToAll=true&useStreaming=false");
+
+ assertEquals("true", conf.getParameter("sendToAll"));
+ assertEquals("false", conf.getParameter("useStreaming"));
+
+ ComponentConfiguration compConf = comp.createComponentConfiguration();
+ String json = compConf.createParameterJsonSchema();
+
+ assertTrue(json.contains("\"useStreaming\": { \"type\": \"boolean\" }"));
+ assertTrue(json.contains("\"sendToAll\": { \"type\": \"boolean\" }"));
+ }
+
+ @Test
+ public void testComponentDocumentation() throws Exception {
+ CamelContext context = new DefaultCamelContext();
+ String html = context.getComponentDocumentation("atmosphere-websocket");
+ assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+ }
+
+}
[2/2] git commit: Merge branch 'CAMEL-7574' of
https://github.com/kevinearls/camel
Posted by da...@apache.org.
Merge branch 'CAMEL-7574' 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/527ce6c7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/527ce6c7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/527ce6c7
Branch: refs/heads/master
Commit: 527ce6c7b68e85caae3fcbceffdcd49f7690ec29
Parents: 4f393f3 9e773d8
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jul 3 13:17:26 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jul 3 13:17:26 2014 +0200
----------------------------------------------------------------------
.../apache/camel/impl/DefaultCamelContext.java | 2 +
.../websocket/WebsocketComponent.java | 1 +
.../atmosphere/websocket/WebsocketEndpoint.java | 5 ++
...ponentConfigurationAndDocumentationTest.java | 58 ++++++++++++++++++++
4 files changed, 66 insertions(+)
----------------------------------------------------------------------