aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-11-29 19:10:19 +0200
committerVaadin Code Review <review@vaadin.com>2013-12-02 09:25:14 +0000
commit36fce654841a5bf82a6be765930db07892e374fb (patch)
tree3b8ff21be6f0f84be31c30fea9a1ced836bf6d3a
parentc171850a2c6fab38a81b2d0ab92d3433b2cf558c (diff)
downloadvaadin-framework-36fce654841a5bf82a6be765930db07892e374fb.tar.gz
vaadin-framework-36fce654841a5bf82a6be765930db07892e374fb.zip
Test for pushing for an extended period of time (24h)
Change-Id: I8e47ba926f41fdc103cfa72ba85ca2f9edbc57d0
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java50
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java33
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java21
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java67
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java34
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeData.java12
7 files changed, 245 insertions, 3 deletions
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java
new file mode 100644
index 0000000000..d90394d3b5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java
@@ -0,0 +1,50 @@
+/*
+ * 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 com.vaadin.server.VaadinRequest;
+
+public abstract class ExtremelyLongPushTime extends PushLargeData {
+
+ private static final int DURATION_MS = 48 * 60 * 60 * 1000; // 48 H
+ private static int INTERVAL_MS = 60 * 1000; // 1 minute
+ private static int PAYLOAD_SIZE = 100 * 1024; // 100 KB
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ super.setup(request);
+ duration.setConvertedValue(DURATION_MS);
+ interval.setConvertedValue(INTERVAL_MS);
+ dataSize.setConvertedValue(PAYLOAD_SIZE);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test which pushes data every minute for 48 hours";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java
new file mode 100644
index 0000000000..3e9582740d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java
@@ -0,0 +1,33 @@
+/*
+ * 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 com.vaadin.annotations.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ui.Transport;
+import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;
+
+@Push(transport = Transport.STREAMING)
+public class ExtremelyLongPushTimeStreaming extends ExtremelyLongPushTime {
+
+ @Override
+ public void init(VaadinRequest request) {
+ super.init(request);
+ // Don't use fallback so we can easier detect failures
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java
new file mode 100644
index 0000000000..17837cb2d3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java
@@ -0,0 +1,21 @@
+/*
+ * 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 ExtremelyLongPushTimeStreamingTest extends
+ ExtremelyLongPushTimeTest {
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java
new file mode 100644
index 0000000000..56eb8b6929
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import com.vaadin.tests.tb3.ExcludeFromSuite;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@ExcludeFromSuite
+public abstract class ExtremelyLongPushTimeTest extends MultiBrowserTest {
+
+ private static final int ONE_HOUR_IN_MS = 20 * 1000;
+
+ @Test
+ public void test24HourPush() {
+ openTestURL();
+
+ // Without this there is a large chance that we will wait for all pushes
+ // to complete before moving on
+ testBench(driver).disableWaitForVaadin();
+
+ // Wait for startButton to be present
+ waitForElementToBePresent(vaadinLocatorById("startButton"));
+
+ String logRow0Id = "Log_row_0";
+ By logRow0 = vaadinLocatorById(logRow0Id);
+
+ // Start the test
+ vaadinElementById("startButton").click();
+
+ // Wait for push to start. Should take 60s
+ waitUntil(ExpectedConditions.textToBePresentInElement(logRow0,
+ "Package "), 120);
+
+ // Check every hour that push is still going on
+ for (int i = 0; i < 24; i++) {
+ sleep(ONE_HOUR_IN_MS);
+ ensureStillPushing(logRow0);
+ }
+
+ }
+
+ private void ensureStillPushing(By logRow0) {
+ String logValue = getDriver().findElement(logRow0).getText();
+ // Wait for the log value to change. Should take max 60s
+ waitUntilNot(
+ ExpectedConditions.textToBePresentInElement(logRow0, logValue),
+ 120);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java
new file mode 100644
index 0000000000..8346d49234
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java
@@ -0,0 +1,34 @@
+/*
+ * 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 com.vaadin.annotations.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ui.Transport;
+import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;
+
+@Push(transport = Transport.WEBSOCKET)
+public class ExtremelyLongPushTimeWebsocket extends ExtremelyLongPushTime {
+
+ @Override
+ public void init(VaadinRequest request) {
+ super.init(request);
+ // Don't use fallback so we can easier detect if websocket fails
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java
new file mode 100644
index 0000000000..23d773c7da
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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 ExtremelyLongPushTimeWebsocketTest extends
+ ExtremelyLongPushTimeTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return WebsocketTest.getWebsocketBrowsers();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeData.java b/uitest/src/com/vaadin/tests/push/PushLargeData.java
index 3b72424b32..83f573ed2c 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeData.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeData.java
@@ -51,14 +51,20 @@ public abstract class PushLargeData extends AbstractTestUIWithLog {
private final ExecutorService executor = Executors
.newSingleThreadExecutor();
+ protected TextField dataSize;
+
+ protected TextField interval;
+
+ protected TextField duration;
+
@Override
protected void setup(VaadinRequest request) {
dataLabel.setSizeUndefined();
- final TextField dataSize = new TextField("Data size");
+ dataSize = new TextField("Data size");
dataSize.setConverter(Integer.class);
- final TextField interval = new TextField("Interval (ms)");
+ interval = new TextField("Interval (ms)");
interval.setConverter(Integer.class);
- final TextField duration = new TextField("Duration (ms)");
+ duration = new TextField("Duration (ms)");
duration.setConverter(Integer.class);
dataSize.setValue(DEFAULT_SIZE_BYTES + "");