From 7782e5d52597f372cdf99cd181956045024aeb21 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sat, 22 Feb 2014 01:19:12 +0200 Subject: Rename to follow same scheme as other push tests Change-Id: I6ea0626ffb88182120f69e0ca988250248e365e1 --- .../tests/push/LongPollingReconnectTest.java | 25 ---- .../com/vaadin/tests/push/PushReconnectTest.java | 164 --------------------- .../tests/push/ReconnectLongPollingTest.java | 25 ++++ .../vaadin/tests/push/ReconnectStreamingTest.java | 25 ++++ .../src/com/vaadin/tests/push/ReconnectTest.java | 164 +++++++++++++++++++++ .../vaadin/tests/push/ReconnectWebsocketTest.java | 36 +++++ .../vaadin/tests/push/StreamingReconnectTest.java | 25 ---- .../vaadin/tests/push/WebsocketReconnectTest.java | 36 ----- 8 files changed, 250 insertions(+), 250 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/push/LongPollingReconnectTest.java delete mode 100644 uitest/src/com/vaadin/tests/push/PushReconnectTest.java create mode 100644 uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java create mode 100755 uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java create mode 100644 uitest/src/com/vaadin/tests/push/ReconnectTest.java create mode 100644 uitest/src/com/vaadin/tests/push/ReconnectWebsocketTest.java delete mode 100755 uitest/src/com/vaadin/tests/push/StreamingReconnectTest.java delete mode 100644 uitest/src/com/vaadin/tests/push/WebsocketReconnectTest.java diff --git a/uitest/src/com/vaadin/tests/push/LongPollingReconnectTest.java b/uitest/src/com/vaadin/tests/push/LongPollingReconnectTest.java deleted file mode 100644 index 81c974e1e5..0000000000 --- a/uitest/src/com/vaadin/tests/push/LongPollingReconnectTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -public class LongPollingReconnectTest extends PushReconnectTest { - - @Override - protected Class getUIClass() { - return BasicPushLongPolling.class; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/PushReconnectTest.java b/uitest/src/com/vaadin/tests/push/PushReconnectTest.java deleted file mode 100644 index 76a0b547da..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushReconnectTest.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.tests.tb3.MultiBrowserTestWithProxy; - -public abstract class PushReconnectTest extends MultiBrowserTestWithProxy { - - @Test - public void testShortDisconnect() throws Exception { - setDebug(true); - openTestURL(); - startTimer(); - waitUntilServerCounterChanges(); - disconnectProxy(); - Thread.sleep(1000); - connectProxy(); - waitUntilServerCounterChanges(); - } - - @Test - public void testUserActionWhileDisconnectedWithDelay() throws Exception { - setDebug(true); - openTestURL(); - startTimer(); - waitUntilServerCounterChanges(); - disconnectProxy(); - Assert.assertEquals(0, getClientCounter()); - getIncrementClientCounterButton().click(); - // No change while disconnected - Assert.assertEquals(0, getClientCounter()); - // Firefox sends extra onopen calls after a while, which breaks - // everything - Thread.sleep(10000); - connectProxy(); - waitUntilServerCounterChanges(); - // The change should have appeared when reconnected - Assert.assertEquals(1, getClientCounter()); - } - - @Test - public void testUserActionWhileDisconnected() throws Exception { - setDebug(true); - openTestURL(); - startTimer(); - waitUntilServerCounterChanges(); - disconnectProxy(); - Assert.assertEquals(0, getClientCounter()); - getIncrementClientCounterButton().click(); - // No change while disconnected - Assert.assertEquals(0, getClientCounter()); - Thread.sleep(1000); - connectProxy(); - waitUntilServerCounterChanges(); - // The change should have appeared when reconnected - Assert.assertEquals(1, getClientCounter()); - - // IE has problems with another reconnect - disconnectProxy(); - getIncrementClientCounterButton().click(); - Assert.assertEquals(1, getClientCounter()); - Thread.sleep(1000); - connectProxy(); - waitUntilServerCounterChanges(); - Assert.assertEquals(2, getClientCounter()); - } - - @Test - public void testLongDisconnect() throws Exception { - setDebug(true); - openTestURL(); - startTimer(); - waitUntilServerCounterChanges(); - disconnectProxy(); - Thread.sleep(12000); - connectProxy(); - waitUntilServerCounterChanges(); - } - - @Test - public void testReallyLongDisconnect() throws Exception { - setDebug(true); - openTestURL(); - startTimer(); - waitUntilServerCounterChanges(); - disconnectProxy(); - Thread.sleep(120000); - connectProxy(); - waitUntilServerCounterChanges(); - } - - @Test - public void testMultipleDisconnects() throws Exception { - setDebug(true); - openTestURL(); - startTimer(); - waitUntilServerCounterChanges(); - for (int i = 0; i < 5; i++) { - disconnectProxy(); - Thread.sleep(1000); - connectProxy(); - waitUntilServerCounterChanges(); - } - } - - @Test - public void testMultipleQuickReconnects() throws Exception { - setDebug(true); - openTestURL(); - startTimer(); - waitUntilServerCounterChanges(); - for (int i = 0; i < 50; i++) { - disconnectProxy(); - Thread.sleep(100); - connectProxy(); - Thread.sleep(100); - } - waitUntilServerCounterChanges(); - waitUntilServerCounterChanges(); - } - - private int getClientCounter() { - return BasicPushTest.getClientCounter(this); - } - - private WebElement getIncrementClientCounterButton() { - return BasicPushTest.getIncrementButton(this); - } - - private void waitUntilServerCounterChanges() { - final int counter = BasicPushTest.getServerCounter(this); - waitUntil(new ExpectedCondition() { - - @Override - public Boolean apply(WebDriver input) { - return BasicPushTest.getServerCounter(PushReconnectTest.this) > counter; - } - }, 30); - } - - private void startTimer() { - BasicPushTest.getServerCounterStartButton(this).click(); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java b/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java new file mode 100644 index 0000000000..6d0c0c53b0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed 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 com.vaadin.tests.push; + +public class ReconnectLongPollingTest extends ReconnectTest { + + @Override + protected Class getUIClass() { + return BasicPushLongPolling.class; + } + +} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java b/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java new file mode 100755 index 0000000000..ebacf5be37 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed 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 com.vaadin.tests.push; + +public class ReconnectStreamingTest extends ReconnectTest { + + @Override + protected Class getUIClass() { + return BasicPushStreaming.class; + } + +} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectTest.java b/uitest/src/com/vaadin/tests/push/ReconnectTest.java new file mode 100644 index 0000000000..69b2ccf22b --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/ReconnectTest.java @@ -0,0 +1,164 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed 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 com.vaadin.tests.push; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.tests.tb3.MultiBrowserTestWithProxy; + +public abstract class ReconnectTest extends MultiBrowserTestWithProxy { + + @Test + public void testShortDisconnect() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + } + + @Test + public void testUserActionWhileDisconnectedWithDelay() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Assert.assertEquals(0, getClientCounter()); + getIncrementClientCounterButton().click(); + // No change while disconnected + Assert.assertEquals(0, getClientCounter()); + // Firefox sends extra onopen calls after a while, which breaks + // everything + Thread.sleep(10000); + connectProxy(); + waitUntilServerCounterChanges(); + // The change should have appeared when reconnected + Assert.assertEquals(1, getClientCounter()); + } + + @Test + public void testUserActionWhileDisconnected() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Assert.assertEquals(0, getClientCounter()); + getIncrementClientCounterButton().click(); + // No change while disconnected + Assert.assertEquals(0, getClientCounter()); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + // The change should have appeared when reconnected + Assert.assertEquals(1, getClientCounter()); + + // IE has problems with another reconnect + disconnectProxy(); + getIncrementClientCounterButton().click(); + Assert.assertEquals(1, getClientCounter()); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + Assert.assertEquals(2, getClientCounter()); + } + + @Test + public void testLongDisconnect() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Thread.sleep(12000); + connectProxy(); + waitUntilServerCounterChanges(); + } + + @Test + public void testReallyLongDisconnect() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Thread.sleep(120000); + connectProxy(); + waitUntilServerCounterChanges(); + } + + @Test + public void testMultipleDisconnects() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + for (int i = 0; i < 5; i++) { + disconnectProxy(); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + } + } + + @Test + public void testMultipleQuickReconnects() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + for (int i = 0; i < 50; i++) { + disconnectProxy(); + Thread.sleep(100); + connectProxy(); + Thread.sleep(100); + } + waitUntilServerCounterChanges(); + waitUntilServerCounterChanges(); + } + + private int getClientCounter() { + return BasicPushTest.getClientCounter(this); + } + + private WebElement getIncrementClientCounterButton() { + return BasicPushTest.getIncrementButton(this); + } + + private void waitUntilServerCounterChanges() { + final int counter = BasicPushTest.getServerCounter(this); + waitUntil(new ExpectedCondition() { + + @Override + public Boolean apply(WebDriver input) { + return BasicPushTest.getServerCounter(ReconnectTest.this) > counter; + } + }, 30); + } + + private void startTimer() { + BasicPushTest.getServerCounterStartButton(this).click(); + } + +} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectWebsocketTest.java b/uitest/src/com/vaadin/tests/push/ReconnectWebsocketTest.java new file mode 100644 index 0000000000..57fe0a040d --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/ReconnectWebsocketTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed 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 com.vaadin.tests.push; + +import java.util.List; + +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.WebsocketTest; + +public class ReconnectWebsocketTest extends ReconnectTest { + + @Override + public List getBrowsersToTest() { + return WebsocketTest.getWebsocketBrowsers(); + } + + @Override + protected Class getUIClass() { + return BasicPushWebsocket.class; + } + +} diff --git a/uitest/src/com/vaadin/tests/push/StreamingReconnectTest.java b/uitest/src/com/vaadin/tests/push/StreamingReconnectTest.java deleted file mode 100755 index 24dfdd8ba1..0000000000 --- a/uitest/src/com/vaadin/tests/push/StreamingReconnectTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -public class StreamingReconnectTest extends PushReconnectTest { - - @Override - protected Class getUIClass() { - return BasicPushStreaming.class; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/WebsocketReconnectTest.java b/uitest/src/com/vaadin/tests/push/WebsocketReconnectTest.java deleted file mode 100644 index 075a18c0e7..0000000000 --- a/uitest/src/com/vaadin/tests/push/WebsocketReconnectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.List; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.tests.tb3.WebsocketTest; - -public class WebsocketReconnectTest extends PushReconnectTest { - - @Override - public List getBrowsersToTest() { - return WebsocketTest.getWebsocketBrowsers(); - } - - @Override - protected Class getUIClass() { - return BasicPushWebsocket.class; - } - -} -- cgit v1.2.3