camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/4] camel git commit: Fixed CS
Date Sun, 22 Nov 2015 10:37:15 GMT
Fixed CS


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

Branch: refs/heads/camel-2.16.x
Commit: 8e261f742f0381ad65a58d7fd6f2c6c51242f6b6
Parents: 2164aba
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Nov 22 11:36:08 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Nov 22 11:37:03 2015 +0100

----------------------------------------------------------------------
 .../component/websocket/WebsocketComponent.java | 12 ++--
 .../component/websocket/WebsocketProducer.java  | 10 ++--
 ...dividualAndBroadcastEndpointExampleTest.java | 60 ++++++++++----------
 ...ocketTwoRoutesToSameEndpointExampleTest.java | 58 +++++++++----------
 4 files changed, 69 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8e261f74/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
index 1251a53..dee57b0 100644
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
+++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
@@ -23,7 +23,6 @@ import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.management.MBeanServer;
 import javax.servlet.DispatcherType;
 
@@ -202,7 +201,7 @@ public class WebsocketComponent extends UriEndpointComponent {
                 enableSessionSupport(connectorRef.server, connectorKey);
             }
 
-            NodeSynchronization sync = new DefaultNodeSynchronization(connectorRef.memoryStore);
           
+            NodeSynchronization sync = new DefaultNodeSynchronization(connectorRef.memoryStore);
             WebsocketComponentServlet servlet = addServlet(sync, prodcon, endpoint.getResourceUri());
             if (prodcon instanceof WebsocketConsumer) {
                 WebsocketConsumer consumer = WebsocketConsumer.class.cast(prodcon);
@@ -213,11 +212,10 @@ public class WebsocketComponent extends UriEndpointComponent {
                 servlet.connect(consumer);
             }
             if (prodcon instanceof WebsocketProducer) {
-            	WebsocketProducer producer = WebsocketProducer.class.cast(prodcon);
-            	producer.setStore(connectorRef.memoryStore);
+                WebsocketProducer producer = WebsocketProducer.class.cast(prodcon);
+                producer.setStore(connectorRef.memoryStore);
             }
         }
-
     }
 
     /**
@@ -256,7 +254,7 @@ public class WebsocketComponent extends UriEndpointComponent {
                     connectorRef.servlet.disconnect((WebsocketConsumer) prodcon);
                 }
                 if (prodcon instanceof WebsocketProducer) {
-                	((WebsocketProducer) prodcon).setStore(null);
+                    ((WebsocketProducer) prodcon).setStore(null);
                 }
             }
         }
@@ -805,7 +803,7 @@ public class WebsocketComponent extends UriEndpointComponent {
             // must add static resource server to CONNECTORS in case the websocket producers/consumers
             // uses the same port number, and therefore we must be part of this
             MemoryWebsocketStore memoryStore = new MemoryWebsocketStore();
-            ConnectorRef ref = new ConnectorRef(staticResourcesServer, connector, null,memoryStore);
+            ConnectorRef ref = new ConnectorRef(staticResourcesServer, connector, null, memoryStore);
             String key = "websocket:" + host + ":" + port;
             CONNECTORS.put(key, ref);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/8e261f74/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java
b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java
index 89b2932..91cfb5e 100644
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java
+++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java
@@ -104,15 +104,15 @@ public class WebsocketProducer extends DefaultProducer implements WebsocketProdu
         if (websocket != null && websocket.getConnection().isOpen()) {
             log.trace("Sending to websocket {} -> {}", websocket.getConnectionKey(), message);
             if (message instanceof String) {
-                websocket.getConnection().sendMessage((String)message);
+                websocket.getConnection().sendMessage((String) message);
             } else if (message instanceof byte[]) {
-                websocket.getConnection().sendMessage((byte[])message, 0, ((byte[])message).length);
+                websocket.getConnection().sendMessage((byte[]) message, 0, ((byte[]) message).length);
             }
         }
     }
 
     //Store is set/unset upon connect/disconnect of the producer
-	public void setStore(WebsocketStore store) {
-		this.store = store;
-	}
+    public void setStore(WebsocketStore store) {
+        this.store = store;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8e261f74/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java
b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java
index b2a3c9d..20b5b36 100644
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java
+++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java
@@ -52,28 +52,28 @@ public class WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest
exte
         AsyncHttpClient c = new AsyncHttpClient();
 
         WebSocket websocket = c.prepareGet("ws://localhost:" + port + "/bar").execute(
-            new WebSocketUpgradeHandler.Builder()
-                .addWebSocketListener(new WebSocketTextListener() {
-                    @Override
-                    public void onMessage(String message) {
-                        received.add(message);
-                        log.info("received --> " + message);
-                        latch.countDown();
-                    }
-
-                    @Override
-                    public void onOpen(WebSocket websocket) {
-                    }
-
-                    @Override
-                    public void onClose(WebSocket websocket) {
-                    }
-
-                    @Override
-                    public void onError(Throwable t) {
-                        t.printStackTrace();
-                    }
-                }).build()).get();
+                new WebSocketUpgradeHandler.Builder()
+                        .addWebSocketListener(new WebSocketTextListener() {
+                            @Override
+                            public void onMessage(String message) {
+                                received.add(message);
+                                log.info("received --> " + message);
+                                latch.countDown();
+                            }
+
+                            @Override
+                            public void onOpen(WebSocket websocket) {
+                            }
+
+                            @Override
+                            public void onClose(WebSocket websocket) {
+                            }
+
+                            @Override
+                            public void onError(Throwable t) {
+                                t.printStackTrace();
+                            }
+                        }).build()).get();
 
         websocket.sendMessage("Beer");
         assertTrue(latch.await(10, TimeUnit.SECONDS));
@@ -94,16 +94,16 @@ public class WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest
exte
             public void configure() {
 
                 from("websocket://localhost:" + port + "/bar")
-                    .log(">>> Message received from BAR WebSocket Client : ${body}")
-                    .transform().simple("The bar has ${body}")
-                    .to("websocket://localhost:" + port + "/bar");
+                        .log(">>> Message received from BAR WebSocket Client : ${body}")
+                        .transform().simple("The bar has ${body}")
+                        .to("websocket://localhost:" + port + "/bar");
 
                 from("timer://foo?fixedRate=true&period=12000")
-	        		//Use a period which is longer then the latch await time
-	        		.setBody(constant("Broadcasting to Bar"))
-	                .log(">>> Broadcasting message to Bar WebSocket Client")
-	                .setHeader(WebsocketConstants.SEND_TO_ALL,constant(true))
-	                .to("websocket://localhost:" + port + "/bar");
+                        //Use a period which is longer then the latch await time
+                        .setBody(constant("Broadcasting to Bar"))
+                        .log(">>> Broadcasting message to Bar WebSocket Client")
+                        .setHeader(WebsocketConstants.SEND_TO_ALL, constant(true))
+                        .to("websocket://localhost:" + port + "/bar");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/8e261f74/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java
b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java
index ec089bf..fd639a4 100644
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java
+++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java
@@ -52,28 +52,28 @@ public class WebsocketTwoRoutesToSameEndpointExampleTest extends CamelTestSuppor
         AsyncHttpClient c = new AsyncHttpClient();
 
         WebSocket websocket = c.prepareGet("ws://localhost:" + port + "/bar").execute(
-            new WebSocketUpgradeHandler.Builder()
-                .addWebSocketListener(new WebSocketTextListener() {
-                    @Override
-                    public void onMessage(String message) {
-                        received.add(message);
-                        log.info("received --> " + message);
-                        latch.countDown();
-                    }
-
-                    @Override
-                    public void onOpen(WebSocket websocket) {
-                    }
-
-                    @Override
-                    public void onClose(WebSocket websocket) {
-                    }
-
-                    @Override
-                    public void onError(Throwable t) {
-                        t.printStackTrace();
-                    }
-                }).build()).get();
+                new WebSocketUpgradeHandler.Builder()
+                        .addWebSocketListener(new WebSocketTextListener() {
+                            @Override
+                            public void onMessage(String message) {
+                                received.add(message);
+                                log.info("received --> " + message);
+                                latch.countDown();
+                            }
+
+                            @Override
+                            public void onOpen(WebSocket websocket) {
+                            }
+
+                            @Override
+                            public void onClose(WebSocket websocket) {
+                            }
+
+                            @Override
+                            public void onError(Throwable t) {
+                                t.printStackTrace();
+                            }
+                        }).build()).get();
 
         websocket.sendMessage("Beer");
         assertTrue(latch.await(10, TimeUnit.SECONDS));
@@ -94,15 +94,15 @@ public class WebsocketTwoRoutesToSameEndpointExampleTest extends CamelTestSuppor
             public void configure() {
 
                 from("websocket://localhost:" + port + "/bar")
-                    .log(">>> Message received from BAR WebSocket Client : ${body}")
-                    .transform().simple("The bar has ${body}")
-                    .to("websocket://localhost:" + port + "/bar");
+                        .log(">>> Message received from BAR WebSocket Client : ${body}")
+                        .transform().simple("The bar has ${body}")
+                        .to("websocket://localhost:" + port + "/bar");
 
                 from("timer://foo?fixedRate=true&period=12000")
-	        		//Use a period which is longer then the latch await time
-	        		.setBody(constant("Broadcasting to Bar"))
-	                .log(">>> Broadcasting message to Bar WebSocket Client")
-	                .to("websocket://localhost:" + port + "/bar?sendToAll=true");
+                        //Use a period which is longer then the latch await time
+                        .setBody(constant("Broadcasting to Bar"))
+                        .log(">>> Broadcasting message to Bar WebSocket Client")
+                        .to("websocket://localhost:" + port + "/bar?sendToAll=true");
             }
         };
     }


Mime
View raw message