summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-07-18 16:31:34 +0300
committerVaadin Code Review <review@vaadin.com>2014-07-22 11:47:30 +0000
commitd3266dfad77b07a00d46fdd5f4ef017203768a21 (patch)
treee773b95fd472d0a1871d13cfb7e602441587fd7a /uitest
parent7326935a82ac0ff8e5ec73c4863a47f4fb9ff682 (diff)
downloadvaadin-framework-d3266dfad77b07a00d46fdd5f4ef017203768a21.tar.gz
vaadin-framework-d3266dfad77b07a00d46fdd5f4ef017203768a21.zip
Fallback to finding disconnected UI based on AtmosphereResource (#14251)
Change-Id: Icdac51322a90c32c122a182bc692c4eff3d8285b
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java61
-rw-r--r--uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java44
2 files changed, 105 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java b/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java
new file mode 100644
index 0000000000..4d02c4e62e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2014 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.PreserveOnRefresh;
+import com.vaadin.annotations.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+
+@Push
+@PreserveOnRefresh
+public class RefreshCloseConnection extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ log("Init");
+ }
+
+ @Override
+ protected void refresh(VaadinRequest request) {
+ if (getPushConnection().isConnected()) {
+ log("Still connected");
+ }
+ log("Refresh");
+ new Thread() {
+ @Override
+ public void run() {
+ accessSynchronously(new Runnable() {
+ @Override
+ public void run() {
+ log("Push");
+ }
+ });
+ }
+ }.start();
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "A log row should get pushed after reloading the page";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(14251);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java b/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java
new file mode 100644
index 0000000000..c5c6064555
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2014 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.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.WebsocketTest;
+
+public class RefreshCloseConnectionTest extends MultiBrowserTest {
+ @Test
+ public void testSessionRefresh() {
+ openTestURL();
+
+ Assert.assertEquals("1. Init", getLogRow(0));
+
+ openTestURL();
+
+ Assert.assertEquals("2. Refresh", getLogRow(1));
+ Assert.assertEquals("3. Push", getLogRow(0));
+ }
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return WebsocketTest.getWebsocketBrowsers();
+ }
+}