activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cepo...@apache.org
Subject svn commit: r1508450 - in /activemq/activemq-apollo/trunk: apollo-cli/src/test/resources/example-broker/etc/ apollo-stomp/src/test/resources/ apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/
Date Tue, 30 Jul 2013 14:00:19 GMT
Author: ceposta
Date: Tue Jul 30 14:00:19 2013
New Revision: 1508450

URL: http://svn.apache.org/r1508450
Log:
added tests for APLO-325 for broker-side config of max_text_message_size

Added:
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgWebSocketTest.scala
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/WebSocketSupport.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties?rev=1508450&r1=1508449&r2=1508450&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties
Tue Jul 30 14:00:19 2013
@@ -18,7 +18,7 @@
 #
 # Setup the default logging levels
 #
-log4j.rootLogger=DEBUG, console, apollo
+log4j.rootLogger=INFO, console, apollo
 log4j.logger.org.apache.activemq.apollo=DEBUG
 
 
@@ -35,7 +35,7 @@ log4j.logger.org.apache.activemq.apollo=
 log4j.appender.console=org.apache.log4j.ConsoleAppender
 log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%-5p | %m%n
-log4j.appender.console.threshold=DEBUG
+log4j.appender.console.threshold=INFO
 
 # File Settings
 log4j.appender.apollo=org.apache.log4j.RollingFileAppender

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml?rev=1508450&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml
(added)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml
Tue Jul 30 14:00:19 2013
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+    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.
+-->
+<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
+  <notes>This broker configuration is what the unit tests in this module load up.</notes>
+
+  <virtual_host id="default">
+    <host_name>localhost</host_name>
+  </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?max_text_message_size=65535"/>
+  <connector id="wss" bind="wss://0.0.0.0:0?max_text_message_size=65535"/>
+
+</broker>
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala?rev=1508450&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala
Tue Jul 30 14:00:19 2013
@@ -0,0 +1,56 @@
+/**
+ * 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.activemq.apollo.stomp.test
+
+import org.openqa.selenium.By
+import java.util.concurrent.TimeUnit._
+/**
+ *
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+class LargeMsgSecureWebSocketTest extends WebSocketSupport with FirefoxWebDriverTrait {
+
+  override def broker_config_uri = "xml:classpath:apollo-stomp-websocket-large.xml"
+
+  // client sends broker large message..
+  test("websockets large text messages from client: wss") {
+    val protocol = "wss"
+    val url = "http://localhost:" + jetty_port + "/websocket-large.html"
+    val ws_port: Int = connector_port(protocol).get
+
+    println("url: " + url)
+    println("ws url: " + protocol + "://127.0.0.1:" + ws_port)
+
+    driver.get(url + "#" + protocol + "://127.0.0.1:" + ws_port);
+
+    val web_status = driver.findElement(By.id("status"));
+
+    while ("Message not sent" == web_status.getText) {
+      Thread.sleep(100)
+    }
+
+    if (web_status != "No WebSockets") {
+      connect("1.1")
+      subscribe("0", "/queue/websocket")
+
+      within(2, SECONDS) {
+        assert_received( """x.*""".r, "0")
+      }
+    }
+
+  }
+}

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgWebSocketTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgWebSocketTest.scala?rev=1508450&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgWebSocketTest.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgWebSocketTest.scala
Tue Jul 30 14:00:19 2013
@@ -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.activemq.apollo.stomp.test
+
+import org.openqa.selenium.By
+import java.util.concurrent.TimeUnit._
+
+/**
+ *
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+class LargeMsgWebSocketTest extends WebSocketSupport with FirefoxWebDriverTrait {
+
+  override def broker_config_uri = "xml:classpath:apollo-stomp-websocket-large.xml"
+
+
+  // client sends broker large message..
+  test("websockets large text messages from client: ws") {
+    val protocol = "ws"
+    val url = "http://localhost:" + jetty_port + "/websocket-large.html"
+    val ws_port: Int = connector_port(protocol).get
+
+    println("url: " + url)
+    println("ws url: " + protocol + "://127.0.0.1:" + ws_port)
+
+    driver.get(url + "#" + protocol + "://127.0.0.1:" + ws_port);
+
+    val web_status = driver.findElement(By.id("status"));
+
+    while ("Message not sent" == web_status.getText) {
+      Thread.sleep(100)
+    }
+
+    if (web_status != "No WebSockets") {
+      connect("1.1")
+      subscribe("0", "/queue/websocket")
+
+      within(2, SECONDS) {
+        assert_received( """x.*""".r, "0")
+      }
+    }
+
+  }
+}

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=1508450&r1=1508449&r2=1508450&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
Tue Jul 30 14:00:19 2013
@@ -16,15 +16,8 @@
  */
 package org.apache.activemq.apollo.stomp.test
 
-import org.openqa.selenium.{By, WebDriver}
-import org.apache.activemq.apollo.util.FileSupport._
+import org.openqa.selenium.By
 import java.util.concurrent.TimeUnit._
-import org.eclipse.jetty.server.Server
-import org.eclipse.jetty.util.thread.ExecutorThreadPool
-import org.apache.activemq.apollo.broker.Broker
-import org.eclipse.jetty.server.nio.SelectChannelConnector
-import org.eclipse.jetty.webapp.WebAppContext
-import java.io.File
 
 /**
  * <p>
@@ -40,75 +33,9 @@ object StompWebSocketTests {
 
   class SafariStompWebSocketTest extends StompWebSocketTestBase with SafariWebDriverTrait
 
-  abstract class StompWebSocketTestBase extends StompTestSupport with WebDriverTrait {
+  abstract class StompWebSocketTestBase extends WebSocketSupport{
 
-    var driver: WebDriver = _
 
-    override def broker_config_uri = "xml:classpath:apollo-stomp-websocket.xml"
-
-    var jetty: Server = _
-    var jetty_port = 0
-
-    def start_jetty = {
-      jetty = new Server
-      val connector = new SelectChannelConnector
-      connector.setPort(0)
-
-      test_data_dir.mkdirs()
-
-      var file = new File(getClass.getResource("websocket.html").getPath)
-      file.copy_to(test_data_dir / "websocket.html")
-      file = new File(getClass.getResource("websocket-large.html").getPath)
-      file.copy_to(test_data_dir / "websocket-large.html")
-      new File(file.getParentFile, "../../../../../../../../../apollo-distro/src/main/release/examples/stomp/websocket/js/jquery-1.7.2.min.js").getCanonicalFile.copy_to(test_data_dir
/ "jquery.js")
-      new File(file.getParentFile, "../../../../../../../../../apollo-distro/src/main/release/examples/stomp/websocket/js/stomp.js").getCanonicalFile.copy_to(test_data_dir
/ "stomp.js")
-
-      var context = new WebAppContext
-      context.setContextPath("/")
-      context.setWar(test_data_dir.getCanonicalPath)
-      context.setClassLoader(Broker.class_loader)
-
-      jetty.setHandler(context)
-      jetty.setConnectors(Array(connector))
-      jetty.setThreadPool(new ExecutorThreadPool(Broker.BLOCKABLE_THREAD_POOL))
-      jetty.start
-
-      jetty_port = connector.getLocalPort
-    }
-
-    def stop_jetty = {
-      if (jetty != null) {
-        jetty.stop()
-        jetty = null
-      }
-    }
-
-    override def beforeAll() = {
-      try {
-        driver = create_web_driver(test_data_dir / "profile")
-        start_jetty
-        super.beforeAll()
-      } catch {
-        case ignore: Throwable =>
-          println("ignoring tests, could not create web driver: " + ignore)
-      }
-    }
-
-    override def afterAll() = {
-      stop_jetty
-      if (driver != null) {
-        driver.quit()
-        driver = null
-      }
-    }
-
-    override protected def test(testName: String, testTags: org.scalatest.Tag*)(testFun:
=> scala.Unit): Unit = {
-      super.test(testName, testTags: _*) {
-        if (driver != null) {
-          testFun
-        }
-      }
-    }
 
     for (protocol <- Array("ws", "wss")) {
       test("websocket " + protocol) {

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/WebSocketSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/WebSocketSupport.scala?rev=1508450&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/WebSocketSupport.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/WebSocketSupport.scala
Tue Jul 30 14:00:19 2013
@@ -0,0 +1,103 @@
+/**
+ * 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.activemq.apollo.stomp.test
+
+import org.openqa.selenium.WebDriver
+import org.eclipse.jetty.server.Server
+import org.eclipse.jetty.server.nio.SelectChannelConnector
+import java.io.File
+import org.eclipse.jetty.webapp.WebAppContext
+import org.apache.activemq.apollo.broker.Broker
+import scala.Array
+import org.eclipse.jetty.util.thread.ExecutorThreadPool
+import org.apache.activemq.apollo.util.FileSupport._
+
+
+/**
+ *
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+abstract class WebSocketSupport extends StompTestSupport with WebDriverTrait{
+
+  var driver: WebDriver = _
+
+  override def broker_config_uri = "xml:classpath:apollo-stomp-websocket.xml"
+
+  var jetty: Server = _
+  var jetty_port = 0
+
+  def start_jetty = {
+    jetty = new Server
+    val connector = new SelectChannelConnector
+    connector.setPort(0)
+
+    test_data_dir.mkdirs()
+
+    var file = new File(getClass.getResource("websocket.html").getPath)
+    file.copy_to(test_data_dir / "websocket.html")
+    file = new File(getClass.getResource("websocket-large.html").getPath)
+    file.copy_to(test_data_dir / "websocket-large.html")
+    new File(file.getParentFile, "../../../../../../../../../apollo-distro/src/main/release/examples/stomp/websocket/js/jquery-1.7.2.min.js").getCanonicalFile.copy_to(test_data_dir
/ "jquery.js")
+    new File(file.getParentFile, "../../../../../../../../../apollo-distro/src/main/release/examples/stomp/websocket/js/stomp.js").getCanonicalFile.copy_to(test_data_dir
/ "stomp.js")
+
+    var context = new WebAppContext
+    context.setContextPath("/")
+    context.setWar(test_data_dir.getCanonicalPath)
+    context.setClassLoader(Broker.class_loader)
+
+    jetty.setHandler(context)
+    jetty.setConnectors(Array(connector))
+    jetty.setThreadPool(new ExecutorThreadPool(Broker.BLOCKABLE_THREAD_POOL))
+    jetty.start
+
+    jetty_port = connector.getLocalPort
+  }
+
+  def stop_jetty = {
+    if (jetty != null) {
+      jetty.stop()
+      jetty = null
+    }
+  }
+
+  override def beforeAll() = {
+    try {
+      driver = create_web_driver(test_data_dir / "profile")
+      start_jetty
+      super.beforeAll()
+    } catch {
+      case ignore: Throwable =>
+        println("ignoring tests, could not create web driver: " + ignore)
+    }
+  }
+
+  override def afterAll() = {
+    stop_jetty
+    if (driver != null) {
+      driver.quit()
+      driver = null
+    }
+  }
+
+  override protected def test(testName: String, testTags: org.scalatest.Tag*)(testFun: =>
scala.Unit): Unit = {
+    super.test(testName, testTags: _*) {
+      if (driver != null) {
+        testFun
+      }
+    }
+  }
+}



Mime
View raw message