From a4211dc5e92cc48ff06bac46615bf486c59f64ed Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 17 Oct 2013 15:21:09 +0300 Subject: [PATCH] Resolve concurrency issue in running TB3 tests Ensure nobody can update the static collections of browsers to run on but that sub classes can restrict which browsers to run on using super.getBrowersToTest().remove(something) Change-Id: Iad520840801fbeb719bae51050714c0e47148804 --- .../actions/ActionsOnInvisibleComponentsTest.java | 6 +++--- .../com/vaadin/tests/push/BasicPushWebsocketTest.java | 4 ++-- uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java | 6 +++--- uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java | 11 ++++++----- uitest/src/com/vaadin/tests/tb3/WebsocketTest.java | 9 ++++----- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java index bb2a7d0995..ca00c998a6 100644 --- a/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java +++ b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java @@ -1,6 +1,6 @@ package com.vaadin.tests.actions; -import java.util.Collection; +import java.util.List; import org.junit.Assert; import org.junit.Test; @@ -15,8 +15,8 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { // This method should be removed once #12785 is fixed @Override - public Collection getBrowsersToTest() { - Collection browsers = super.getBrowsersToTest(); + public List getBrowsersToTest() { + List browsers = super.getBrowsersToTest(); // sendKeys does nothing on these browsers browsers.remove(BrowserUtil.firefox(24)); browsers.remove(BrowserUtil.ie(8)); diff --git a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java b/uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java index ae4e64ad6b..dd0a147d99 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java +++ b/uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java @@ -15,7 +15,7 @@ */ package com.vaadin.tests.push; -import java.util.Collection; +import java.util.List; import org.openqa.selenium.remote.DesiredCapabilities; @@ -23,7 +23,7 @@ import com.vaadin.tests.tb3.WebsocketTest; public class BasicPushWebsocketTest extends BasicPushTest { @Override - public Collection getBrowsersToTest() { + public List getBrowsersToTest() { return WebsocketTest.getWebsocketBrowsers(); } } \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 7584f36e28..fbb04c2022 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -17,8 +17,8 @@ package com.vaadin.tests.tb3; import java.net.URL; -import java.util.Collection; import java.util.Collections; +import java.util.List; import java.util.logging.Logger; import org.junit.After; @@ -214,8 +214,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * * @return The browsers to run the test on */ - public Collection getBrowsersToTest() { - return Collections.singleton(BrowserUtil + public List getBrowsersToTest() { + return Collections.singletonList(BrowserUtil .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION)); } diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java index 4003539782..040d0156a3 100644 --- a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java +++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java @@ -17,7 +17,7 @@ package com.vaadin.tests.tb3; import java.util.ArrayList; -import java.util.Collection; +import java.util.Collections; import java.util.List; import org.openqa.selenium.remote.DesiredCapabilities; @@ -57,19 +57,20 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { // Re-enable this when it is possible to run on a modern Opera version // (15+) // allBrowsers.add(BrowserUtil.opera(15)); - } /** * @return all supported browsers which are actively tested */ public static List getAllBrowsers() { - return allBrowsers; + return Collections.unmodifiableList(allBrowsers); } @Override - public Collection getBrowsersToTest() { - return allBrowsers; + public List getBrowsersToTest() { + // Return a copy so sub classes can do + // super.getBrowseresToTest().remove(something) + return new ArrayList(getAllBrowsers()); } } diff --git a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java index 5c6ea329f5..26fef667cd 100644 --- a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java +++ b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java @@ -20,7 +20,6 @@ package com.vaadin.tests.tb3; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.List; @@ -44,8 +43,8 @@ public abstract class WebsocketTest extends PrivateTB3Configuration { * @return All supported browsers which are actively tested and support * websockets */ - public static Collection getWebsocketBrowsers() { - return Collections.unmodifiableCollection(websocketBrowsers); + public static List getWebsocketBrowsers() { + return Collections.unmodifiableList(websocketBrowsers); } /* @@ -54,7 +53,7 @@ public abstract class WebsocketTest extends PrivateTB3Configuration { * @see com.vaadin.tests.tb3.AbstractTB3Test#getBrowserToRunOn() */ @Override - public Collection getBrowsersToTest() { - return getWebsocketBrowsers(); + public List getBrowsersToTest() { + return new ArrayList(getWebsocketBrowsers()); } } -- 2.39.5