activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1487676 - in /activemq/activemq-apollo/trunk: apollo-broker/ apollo-stomp/ apollo-stomp/src/test/resources/org/apache/activemq/apollo/stomp/test/ apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/
Date Wed, 29 May 2013 23:19:04 GMT
Author: chirino
Date: Wed May 29 23:19:04 2013
New Revision: 1487676

URL: http://svn.apache.org/r1487676
Log:
Upgrade selenium version and test against Safari too.

Added:
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/SafariWebDriverTrait.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-broker/pom.xml
    activemq/activemq-apollo/trunk/apollo-stomp/pom.xml
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/org/apache/activemq/apollo/stomp/test/websocket.html
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/pom.xml?rev=1487676&r1=1487675&r2=1487676&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/pom.xml Wed May 29 23:19:04 2013
@@ -85,10 +85,12 @@
       <version>${snakeyaml-version}</version>
     </dependency>
 
+    <!-- for optional XML selectors -->
     <dependency>
       <groupId>xalan</groupId>
       <artifactId>xalan</artifactId>
       <version>2.6.0</version>
+      <optional>true</optional>
     </dependency>
 
     <!-- for optional web admin -->

Modified: activemq/activemq-apollo/trunk/apollo-stomp/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/pom.xml?rev=1487676&r1=1487675&r2=1487676&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/pom.xml Wed May 29 23:19:04 2013
@@ -139,6 +139,12 @@
       <version>${selenium-version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.seleniumhq.selenium</groupId>
+      <artifactId>selenium-safari-driver</artifactId>
+      <version>${selenium-version}</version>
+      <scope>test</scope>
+    </dependency>
 
   </dependencies>
 

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/org/apache/activemq/apollo/stomp/test/websocket.html
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/org/apache/activemq/apollo/stomp/test/websocket.html?rev=1487676&r1=1487675&r2=1487676&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/org/apache/activemq/apollo/stomp/test/websocket.html
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/org/apache/activemq/apollo/stomp/test/websocket.html
Wed May 29 23:19:04 2013
@@ -22,8 +22,8 @@
     <!--[if lt IE 9]>
       <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
     <![endif]-->
-    <script src='../../../../../../../../../apollo-website/src/scripts/jquery.js'></script>
-    <script src="../../../../../../../../../apollo-distro/src/main/release/examples/websocket/js/stomp.js"></script>
+    <script src='jquery.js'></script>
+    <script src='stomp.js'></script>
     <script>//<![CDATA[
     $(document).ready(function() {
       if(window.WebSocket) {

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/SafariWebDriverTrait.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/SafariWebDriverTrait.scala?rev=1487676&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/SafariWebDriverTrait.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/SafariWebDriverTrait.scala
Wed May 29 23:19:04 2013
@@ -0,0 +1,36 @@
+/**
+ * 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 java.io.File
+import org.apache.activemq.apollo.util.FileSupport._
+import org.openqa.selenium.chrome.{ChromeOptions, ChromeDriver}
+import org.openqa.selenium.safari.SafariDriver
+
+trait SafariWebDriverTrait extends WebDriverTrait {
+  def create_web_driver(profileDir: File) = {
+//        val f = new File("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
+//        if( f.exists() ) {
+//          System.setProperty("webdriver.chrome.driver", f.getCanonicalPath)
+//        }
+
+//    options.addArguments("--enable-udd-profiles", "--user-data-dir=" + file, "--allow-file-access-from-files")
+    //    val capabilities = new DesiredCapabilities
+    //    capabilities.setCapability("chrome.switches", Arrays.asList("--enable-udd-profiles",
"--user-data-dir="+file, "--allow-file-access-from-files"));
+    new SafariDriver()
+  }
+}
\ 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=1487676&r1=1487675&r2=1487676&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
Wed May 29 23:19:04 2013
@@ -19,6 +19,12 @@ package org.apache.activemq.apollo.stomp
 import org.openqa.selenium.{By, WebDriver}
 import org.apache.activemq.apollo.util.FileSupport._
 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>
@@ -30,6 +36,7 @@ object StompWebSocketTests {
 
   class ChromeStompWebSocketTest extends StompWebSocketTestBase with ChromeWebDriverTrait
   class FirefoxStompWebSocketTest extends StompWebSocketTestBase with FirefoxWebDriverTrait
+  class SafariStompWebSocketTest extends StompWebSocketTestBase with SafariWebDriverTrait
 
   abstract class StompWebSocketTestBase extends StompTestSupport with WebDriverTrait {
 
@@ -37,17 +44,54 @@ object StompWebSocketTests {
 
     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")
+      new File(file.getParentFile, "../../../../../../../../../apollo-website/src/scripts/jquery.js").getCanonicalFile.copy_to(test_data_dir/"jquery.js")
+      new File(file.getParentFile, "../../../../../../../../../apollo-distro/src/main/release/examples/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: Exception =>
+        case ignore: Throwable =>
           println("ignoring tests, could not create web driver: " + ignore)
       }
     }
 
     override def afterAll() = {
+      stop_jetty
       if (driver != null) {
         driver.quit()
         driver = null
@@ -65,7 +109,7 @@ object StompWebSocketTests {
     for( protocol <- Array("ws", "wss") ) {
       test("websocket "+protocol) {
 
-        val url = getClass.getResource("websocket.html")
+        val url = "http://localhost:"+jetty_port+"/websocket.html"
         val ws_port: Int = connector_port(protocol).get
 
         System.out.println("url: " + url)



Mime
View raw message