camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1342568 - /camel/trunk/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java
Date Fri, 25 May 2012 10:50:45 GMT
Author: davsclaus
Date: Fri May 25 10:50:45 2012
New Revision: 1342568

URL: http://svn.apache.org/viewvc?rev=1342568&view=rev
Log:
Polished test

Modified:
    camel/trunk/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java

Modified: camel/trunk/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java?rev=1342568&r1=1342567&r2=1342568&view=diff
==============================================================================
--- camel/trunk/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java
(original)
+++ camel/trunk/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java
Fri May 25 10:50:45 2012
@@ -32,10 +32,13 @@ import java.util.concurrent.TimeUnit;
 public class WebsocketTwoRoutesExampleTest extends CamelTestSupport {
 
     private static List<String> received = new ArrayList<String>();
-    private static CountDownLatch latch = new CountDownLatch(1);
+    private static CountDownLatch latch;
 
     @Test
     public void testWSHttpCallEcho1() throws Exception {
+        received.clear();
+        latch = new CountDownLatch(1);
+
         AsyncHttpClient c = new AsyncHttpClient();
 
         WebSocket websocket = c.prepareGet("ws://127.0.0.1:9292/echo").execute(
@@ -78,9 +81,12 @@ public class WebsocketTwoRoutesExampleTe
 
     @Test
     public void testWSHttpCallEcho2() throws Exception {
+        received.clear();
+        latch = new CountDownLatch(1);
+
         AsyncHttpClient c = new AsyncHttpClient();
 
-        WebSocket websocket = c.prepareGet("ws://127.0.0.1:9393/echo").execute(
+        WebSocket websocket = c.prepareGet("ws://127.0.0.1:9292/bar").execute(
                 new WebSocketUpgradeHandler.Builder()
                         .addWebSocketListener(new WebSocketTextListener() {
                             @Override
@@ -108,11 +114,11 @@ public class WebsocketTwoRoutesExampleTe
                             }
                         }).build()).get();
 
-        websocket.sendTextMessage("Beer");
+        websocket.sendTextMessage("wine");
         assertTrue(latch.await(10, TimeUnit.SECONDS));
 
         assertEquals(1, received.size());
-        assertEquals("BeerBeer", received.get(0));
+        assertEquals("The bar has wine", received.get(0));
 
         websocket.close();
         c.close();
@@ -124,14 +130,14 @@ public class WebsocketTwoRoutesExampleTe
             public void configure() {
 
                 from("websocket://localhost:9292/echo")
-                    .log(">>> Message received from WebSocket Client : ${body}")
+                    .log(">>> Message received from ECHO WebSocket Client : ${body}")
                     .transform().simple("${body}${body}")
                     .to("websocket://localhost:9292/echo");
 
-                from("websocket://localhost:9393/echo")
-                        .log(">>> Message received from WebSocket Client : ${body}")
-                        .transform().simple("${body}${body}")
-                        .to("websocket://localhost:9393/echo");
+                from("websocket://localhost:9292/bar")
+                        .log(">>> Message received from BAR WebSocket Client : ${body}")
+                        .transform().simple("The bar has ${body}")
+                        .to("websocket://localhost:9292/bar");
             }
         };
     }



Mime
View raw message