You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2020/02/04 14:14:20 UTC

[activemq] branch activemq-5.15.x updated: AMQ-7393 - Remove unused Selenium tests

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch activemq-5.15.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.15.x by this push:
     new b895955  AMQ-7393 - Remove unused Selenium tests
b895955 is described below

commit b8959559d6d7f757505b556cdc3d6e2cbd119be4
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Jan 28 14:36:15 2020 +0000

    AMQ-7393 - Remove unused Selenium tests
    
    (cherry picked from commit d49370e3634f2d48746e2755960eb927ebc9bfb0)
---
 activemq-http/pom.xml                              |  30 ------
 .../activemq/transport/ws/WSTransportTest.java     | 104 ---------------------
 2 files changed, 134 deletions(-)

diff --git a/activemq-http/pom.xml b/activemq-http/pom.xml
index 70e478c..027b465 100644
--- a/activemq-http/pom.xml
+++ b/activemq-http/pom.xml
@@ -101,36 +101,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.seleniumhq.selenium</groupId>
-      <artifactId>selenium-java</artifactId>
-      <version>2.25.0</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.json</groupId>
-          <artifactId>json</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.seleniumhq.selenium</groupId>
-      <artifactId>selenium-chrome-driver</artifactId>
-      <version>2.25.0</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.json</groupId>
-          <artifactId>json</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.seleniumhq.selenium</groupId>
-      <artifactId>selenium-firefox-driver</artifactId>
-      <version>2.25.0</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.eclipse.jetty.websocket</groupId>
       <artifactId>websocket-server</artifactId>
       <scope>provided</scope>
diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java
index 0b53e34..0500c86 100644
--- a/activemq-http/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java
+++ b/activemq-http/src/test/java/org/apache/activemq/transport/ws/WSTransportTest.java
@@ -20,7 +20,6 @@ package org.apache.activemq.transport.ws;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.io.File;
 import java.io.IOException;
 import java.net.Socket;
 import java.net.URI;
@@ -32,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.transport.SocketConnectorFactory;
 import org.apache.activemq.transport.stomp.StompConnection;
-import org.apache.activemq.util.Wait;
 import org.eclipse.jetty.client.HttpClient;
 import org.eclipse.jetty.client.api.Request;
 import org.eclipse.jetty.client.api.Result;
@@ -45,26 +43,15 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.chrome.ChromeOptions;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.firefox.FirefoxProfile;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class WSTransportTest extends WSTransportTestSupport {
 
     private static final Logger LOG = LoggerFactory.getLogger(WSTransportTest.class);
-    private static final int MESSAGE_COUNT = 1000;
 
     private Server server;
-    private WebDriver driver;
-    private File profileDir;
 
     private String stompUri;
     private StompConnection stompConnection = new StompConnection();
@@ -116,7 +103,6 @@ public class WSTransportTest extends WSTransportTestSupport {
     @Before
     public void setUp() throws Exception {
         super.setUp();
-        profileDir = new File("activemq-data/profiles");
         stompConnect();
         server = createWebServer();
     }
@@ -135,12 +121,6 @@ public class WSTransportTest extends WSTransportTestSupport {
                 LOG.warn("Error on super tearDown()");
             }
 
-            if (driver != null) {
-                try {
-                    driver.quit();
-                } catch (Exception e) {}
-                driver = null;
-            }
             if (server != null) {
                 try {
                     server.stop();
@@ -180,36 +160,6 @@ public class WSTransportTest extends WSTransportTestSupport {
         assertEquals(HttpStatus.OK_200, status.get());
     }
 
-    @Ignore
-    @Test
-    public void testFireFoxWebSockets() throws Exception {
-        driver = createFireFoxWebDriver();
-        doTestWebSockets(driver);
-    }
-
-    @Ignore
-    @Test
-    public void testChromeWebSockets() throws Exception {
-        driver = createChromeWebDriver();
-        doTestWebSockets(driver);
-    }
-
-    protected WebDriver createChromeWebDriver() throws Exception {
-        File profile = new File(profileDir, "chrome");
-        profile.mkdirs();
-        ChromeOptions options = new ChromeOptions();
-        options.addArguments("--enable-udd-profiles",
-                             "--user-data-dir=" + profile,
-                             "--allow-file-access-from-files");
-        return new ChromeDriver(options);
-    }
-
-    protected WebDriver createFireFoxWebDriver() throws Exception {
-        File profile = new File(profileDir, "firefox");
-        profile.mkdirs();
-        return new FirefoxDriver(new FirefoxProfile(profile));
-    }
-
     private void stompConnect() throws IOException, URISyntaxException, UnknownHostException {
         URI connectUri = new URI(stompUri);
         stompConnection.open(createSocket(connectUri));
@@ -231,58 +181,4 @@ public class WSTransportTest extends WSTransportTestSupport {
         return "http://localhost:" + port + "/websocket.html#" + wsConnectUri;
     }
 
-    public void doTestWebSockets(WebDriver driver) throws Exception {
-
-        driver.get(getTestURI());
-
-        final WebElement webStatus = driver.findElement(By.id("status"));
-        final WebElement webReceived = driver.findElement(By.id("received"));
-
-        while ("Loading" == webStatus.getText()) {
-            Thread.sleep(100);
-        }
-
-        // Skip test if browser does not support websockets..
-        if (webStatus.getText() != "No WebSockets") {
-
-            assertTrue("Should have connected", Wait.waitFor(new Wait.Condition() {
-
-                @Override
-                public boolean isSatisified() throws Exception {
-                    return webStatus.getText().equals("Connected");
-                }
-            }));
-
-            stompConnection.connect("system", "manager");
-
-            stompConnection.send("/queue/websocket", "Hello");
-            assertTrue("Should have received message by now.", Wait.waitFor(new Wait.Condition() {
-                @Override
-                public boolean isSatisified() throws Exception {
-                    return webReceived.getText().equals("Hello");
-                }
-            }));
-
-            for (int i = 1; i <= MESSAGE_COUNT; ++i) {
-                stompConnection.send("/queue/websocket", "messages #" + i);
-            }
-
-            assertTrue("Should have received messages by now.", Wait.waitFor(new Wait.Condition() {
-                @Override
-                public boolean isSatisified() throws Exception {
-                    return webReceived.getText().equals("messages #" + MESSAGE_COUNT);
-                }
-            }));
-
-            Thread.sleep(1000);
-
-            assertTrue("Should have disconnected", Wait.waitFor(new Wait.Condition() {
-
-                @Override
-                public boolean isSatisified() throws Exception {
-                    return webStatus.getText().equals("Disconnected");
-                }
-            }));
-        }
-    }
 }