You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2012/11/26 19:29:29 UTC

svn commit: r1413772 - in /activemq/activemq-apollo/trunk: apollo-stomp/src/test/resources/ apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/ apollo-web/src/test/scala/org/apache/activemq/apollo/web/

Author: chirino
Date: Mon Nov 26 18:29:28 2012
New Revision: 1413772

URL: http://svn.apache.org/viewvc?rev=1413772&view=rev
Log:
Also test the wss protocol.

Removed:
    activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket.xml
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket.xml?rev=1413772&r1=1413771&r2=1413772&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket.xml Mon Nov 26 18:29:28 2012
@@ -23,7 +23,9 @@
   </virtual_host>
 
   <!--<web_admin bind="http://0.0.0.0:61680"/>-->
+  <key_storage file="${basedir}/src/test/resources/apollo.ks" password="password" key_password="password"/>
   <connector id="tcp" bind="tcp://0.0.0.0:0"/>
   <connector id="ws" bind="ws://0.0.0.0:0"/>
+  <connector id="wss" bind="wss://0.0.0.0:0"/>
 
 </broker>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala?rev=1413772&r1=1413771&r2=1413772&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala Mon Nov 26 18:29:28 2012
@@ -37,8 +37,6 @@ object StompWebSocketTests {
 
     override def broker_config_uri = "xml:classpath:apollo-stomp-websocket.xml"
 
-    def ws_port: Int = connector_port("ws").get
-
     override def beforeAll() = {
       try {
         driver = create_web_driver(test_data_dir / "profile")
@@ -64,49 +62,53 @@ object StompWebSocketTests {
       }
     }
 
-    test("websocket") {
-      val url = getClass.getResource("websocket.html")
-
-      System.out.println("url: " + url)
-      driver.get(url + "#ws://127.0.0.1:" + ws_port);
-      val web_status = driver.findElement(By.id("status"));
-      val web_received = driver.findElement(By.id("received"));
+    for( protocol <- Array("ws", "wss") ) {
+      test("websocket "+protocol) {
 
-      while ("Loading" == web_status.getText) {
-        Thread.sleep(100)
-      }
+        val url = getClass.getResource("websocket.html")
+        val ws_port: Int = connector_port(protocol).get
 
-      // Skip test if browser does not support websockets..
-      if (web_status.getText != "No WebSockets") {
+        System.out.println("url: " + url)
+        driver.get(url + "#"+protocol+"://127.0.0.1:" + ws_port);
+        val web_status = driver.findElement(By.id("status"));
+        val web_received = driver.findElement(By.id("received"));
 
-        // Wait for it to get connected..
-        within(2, SECONDS) {
-          web_status.getText should be("Connected")
+        while ("Loading" == web_status.getText) {
+          Thread.sleep(100)
         }
 
-        // Send a message via normal TCP stomp..
-        connect("1.1")
-        async_send("/queue/websocket", "Hello")
-        within(2, SECONDS) {
-          // it should get received by the websocket client.
-          web_received.getText should be("Hello")
-        }
+        // Skip test if browser does not support websockets..
+        if (web_status.getText != "No WebSockets") {
 
-        // Send a bunch of messages..
-        val send_count = 100000
-        for (i <- 1 to send_count) {
-          async_send("/queue/websocket", "messages #" + i)
-        }
+          // Wait for it to get connected..
+          within(2, SECONDS) {
+            web_status.getText should be("Connected")
+          }
+
+          // Send a message via normal TCP stomp..
+          connect("1.1")
+          async_send("/queue/websocket", "Hello")
+          within(2, SECONDS) {
+            // it should get received by the websocket client.
+            web_received.getText should be("Hello")
+          }
+
+          // Send a bunch of messages..
+          val send_count = 100000
+          for (i <- 1 to send_count) {
+            async_send("/queue/websocket", "messages #" + i)
+          }
+
+          within(10, SECONDS) {
+            // it should get received by the websocket client.
+            web_received.getText should be("messages #" + send_count)
+          }
 
-        within(10, SECONDS) {
-          // it should get received by the websocket client.
-          web_received.getText should be("messages #" + send_count)
         }
 
       }
-
     }
-  }
+    }
 
 }