aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-03-03 13:35:12 +0200
committerVaadin Code Review <review@vaadin.com>2014-03-03 13:33:21 +0000
commit06d0cf4daa414eca3c2a73df8171706ca7012213 (patch)
tree8b0037a32e21f2df7fcfd3b50ccb1415964229e0
parent6249518e8b84ce9d8809374a652610600f13f0a6 (diff)
downloadvaadin-framework-06d0cf4daa414eca3c2a73df8171706ca7012213.tar.gz
vaadin-framework-06d0cf4daa414eca3c2a73df8171706ca7012213.zip
Workaround Streaming Push unreliabilities (#13415)
Change-Id: I5e946b365e22e71a0c13606fcd159d1ce7c82925
-rw-r--r--client/src/com/vaadin/client/communication/AtmospherePushConnection.java1
-rw-r--r--uitest/src/com/vaadin/tests/push/PushConfigurationTest.java24
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeData.java8
3 files changed, 23 insertions, 10 deletions
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
index 95584412cd..f9bff8199e 100644
--- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -447,6 +447,7 @@ public class AtmospherePushConnection implements PushConnection {
/*-{
return {
transport: 'websocket',
+ maxStreamingLength: 1000000,
fallbackTransport: 'streaming',
contentType: 'application/json; charset=UTF-8',
reconnectInterval: 5000,
diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java
index 1f8c4c0e38..a8ea9d0010 100644
--- a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.tests.push;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
@@ -27,13 +29,11 @@ import com.vaadin.tests.tb3.WebsocketTest;
public class PushConfigurationTest extends WebsocketTest {
@Test
- public void testWebsocketAndStreaming() {
+ public void testWebsocketAndStreaming() throws InterruptedException {
setDebug(true);
openTestURL();
// Websocket
- int counter = getServerCounter();
- assertGreaterOrEqual("Counter should be >= 1. Was: " + counter,
- counter, 1);
+ verifyPushDisabled();
new Select(getTransportSelect()).selectByVisibleText("WEBSOCKET");
new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC");
Assert.assertTrue(vaadinElement(
@@ -41,7 +41,7 @@ public class PushConfigurationTest extends WebsocketTest {
.getText()
.matches(
"^[\\s\\S]*fallbackTransport: streaming[\\s\\S]*transport: websocket[\\s\\S]*$"));
- counter = getServerCounter();
+ int counter = getServerCounter();
final int waitCounter = counter + 2;
waitUntil(new ExpectedCondition<Boolean>() {
@@ -61,7 +61,7 @@ public class PushConfigurationTest extends WebsocketTest {
// Streaming
driver.get(getTestUrl());
- Assert.assertEquals(1, getServerCounter());
+ verifyPushDisabled();
new Select(getTransportSelect()).selectByVisibleText("STREAMING");
new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC");
@@ -93,6 +93,18 @@ public class PushConfigurationTest extends WebsocketTest {
}
+ /**
+ * Verifies that push is currently not enabled.
+ *
+ * @throws InterruptedException
+ */
+ private void verifyPushDisabled() throws InterruptedException {
+ int counter = getServerCounter();
+ sleep(2000);
+ assertEquals("Server count changed without push enabled", counter,
+ getServerCounter());
+ }
+
private WebElement getPushModeSelect() {
return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VNativeSelect[0]/domChild[0]");
}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeData.java b/uitest/src/com/vaadin/tests/push/PushLargeData.java
index 93925ffb9f..f43348b5eb 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeData.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeData.java
@@ -34,14 +34,14 @@ import com.vaadin.ui.UI;
public abstract class PushLargeData extends AbstractTestUIWithLog {
- // 250KB
- static final int DEFAULT_SIZE_BYTES = 250 * 1000;
+ // 200KB
+ static final int DEFAULT_SIZE_BYTES = 200 * 1000;
// Every other second
static final int DEFAULT_DELAY_MS = 2000;
- // 20 MB is enough for streaming to reconnect
- static final int DEFAULT_DATA_TO_PUSH = 20 * 1000 * 1000;
+ // 3 MB is enough for streaming to reconnect
+ static final int DEFAULT_DATA_TO_PUSH = 3 * 1000 * 1000;
static final int DEFAULT_DURATION_MS = DEFAULT_DATA_TO_PUSH
/ DEFAULT_SIZE_BYTES * DEFAULT_DELAY_MS;