Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A73BE10783 for ; Wed, 28 May 2014 02:55:25 +0000 (UTC) Received: (qmail 41379 invoked by uid 500); 28 May 2014 02:55:25 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 41320 invoked by uid 500); 28 May 2014 02:55:25 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 41312 invoked by uid 99); 28 May 2014 02:55:25 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 May 2014 02:55:25 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 574E594B9D6; Wed, 28 May 2014 02:55:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Wed, 28 May 2014 02:55:25 -0000 Message-Id: <100191a9727a46c19be93f836f3b3d14@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] git commit: Fixed the CS errors of camel-atmosphere-websocket Repository: camel Updated Branches: refs/heads/master de56e0bdd -> ec85a040d Fixed the CS errors of 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/fbcbb247 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fbcbb247 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fbcbb247 Branch: refs/heads/master Commit: fbcbb247b2984f383285ea226c445ebb04222feb Parents: 571dd89 Author: Willem Jiang Authored: Wed May 28 10:09:53 2014 +0800 Committer: Willem Jiang Committed: Wed May 28 10:55:00 2014 +0800 ---------------------------------------------------------------------- .../websocket/CamelWebSocketServlet.java | 15 ++++++++++++- .../websocket/MemoryWebSocketStore.java | 15 ++++++++++++- .../atmosphere/websocket/WebSocketStore.java | 15 ++++++++++++- .../websocket/WebsocketConstants.java | 22 ++++++++++++++++++-- .../atmosphere/websocket/WebsocketConsumer.java | 15 ++++++++++++- .../atmosphere/websocket/WebsocketEndpoint.java | 15 ++++++++++++- .../atmosphere/websocket/WebsocketHandler.java | 16 ++++++++++++++ .../atmosphere/websocket/WebsocketProducer.java | 17 +++++++++++++-- .../websocket/WebsocketStreamHandler.java | 16 ++++++++++++++ .../wsservlet/MemoryWebSocketStoreTest.java | 19 +++++++++++++---- .../camel/component/wsservlet/TestClient.java | 16 +++++++------- .../WebsocketCamelRouterTestSupport.java | 3 ++- 12 files changed, 162 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java index 3ed2c37..a8e3414 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java @@ -1,5 +1,18 @@ /** - * + * 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.atmosphere.websocket; http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java index 3dfab01..899df2b 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java @@ -1,5 +1,18 @@ /** - * + * 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.atmosphere.websocket; http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java index c5b1eb3..17627b6 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java @@ -1,5 +1,18 @@ /** - * + * 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.atmosphere.websocket; http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java index b7f9f97..9b21354 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java @@ -1,12 +1,30 @@ /** - * + * 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.atmosphere.websocket; /** * */ -public class WebsocketConstants { +public final class WebsocketConstants { + public static final String CONNECTION_KEY = "websocket.connectionKey"; public static final String SEND_TO_ALL = "websocket.sendToAll"; + + private WebsocketConstants() { + //helper class + } } http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java index 3e69133..2680baa 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java @@ -1,5 +1,18 @@ /** - * + * 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.atmosphere.websocket; http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/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 257a66c..9d06c1c 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 @@ -1,5 +1,18 @@ /** - * + * 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.atmosphere.websocket; http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java index fbdac7a..f0f03fb 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java @@ -1,3 +1,19 @@ +/** + * 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.atmosphere.websocket; import java.util.List; http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java index abc726e..d3e02af 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java @@ -1,5 +1,18 @@ /** - * + * 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.atmosphere.websocket; @@ -62,7 +75,7 @@ public class WebsocketProducer extends DefaultProducer { log.debug("Sending to {}", message); if (getEndpoint().isSendToAll()) { log.debug("Sending to all -> {}", message); - //TODO consider using atmosphere's broadcast or a more configurable async send + //TODO consider using atmosphere's broadcast or a more configurable async send for (final WebSocket websocket : getEndpoint().getWebSocketStore().getAllWebSockets()) { final Object msg = message; executor.execute(new Runnable() { http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java index 9d54d36..cb6b5af 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java @@ -1,3 +1,19 @@ +/** + * 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.atmosphere.websocket; import java.io.InputStream; http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java index 9f69151..821bdef 100644 --- a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java +++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java @@ -1,5 +1,18 @@ /** - * + * 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; @@ -11,9 +24,7 @@ import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Test; -/** - * - */ + public class MemoryWebSocketStoreTest extends Assert { @Test http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java index 883e713..5dbd254 100644 --- a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java +++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java @@ -16,6 +16,13 @@ */ package org.apache.camel.component.wsservlet; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + import com.ning.http.client.AsyncHttpClient; import com.ning.http.client.AsyncHttpClientConfig; import com.ning.http.client.websocket.WebSocket; @@ -23,13 +30,6 @@ import com.ning.http.client.websocket.WebSocketByteListener; import com.ning.http.client.websocket.WebSocketTextListener; import com.ning.http.client.websocket.WebSocketUpgradeHandler; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,7 +65,7 @@ public class TestClient { public void connect() throws InterruptedException, ExecutionException, IOException { websocket = client.prepareGet(url).execute( new WebSocketUpgradeHandler.Builder() - .addWebSocketListener(new TestWebSocketListener()).build()).get(); + .addWebSocketListener(new TestWebSocketListener()).build()).get(); } public void sendTextMessage(String message) { http://git-wip-us.apache.org/repos/asf/camel/blob/fbcbb247/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java ---------------------------------------------------------------------- diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java index 42c752b..dbf9288 100644 --- a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java +++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java @@ -30,8 +30,9 @@ import org.junit.Before; public class WebsocketCamelRouterTestSupport extends CamelTestSupport { public static final String CONTEXT = "/mycontext"; public static final String CONTEXT_URL = "http://localhost/mycontext"; + protected static final int PORT = AvailablePortFinder.getNextAvailable(); protected boolean startCamelContext = true; - protected int PORT = AvailablePortFinder.getNextAvailable(); + protected Server server; @Before