diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-02-13 08:09:23 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-02-13 08:09:23 +0000 |
commit | ca32fcd94fdae27722ed10d6617796a631f903c9 (patch) | |
tree | 56237ba2642d4dafa2f240362b91ceb58188fd20 /uitest | |
parent | 616d98c9719a3758f413d9ff43de612fc35d9881 (diff) | |
parent | c598a852c2565b67226533622b5f75a3b588acf3 (diff) | |
download | vaadin-framework-ca32fcd94fdae27722ed10d6617796a631f903c9.tar.gz vaadin-framework-ca32fcd94fdae27722ed10d6617796a631f903c9.zip |
Merge "Handle OutOfSync by resyncing automatically (#10780)" into 7.0
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/OutOfSyncTest.html | 38 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/OutOfSyncTest.java | 55 |
2 files changed, 93 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/OutOfSyncTest.html b/uitest/src/com/vaadin/tests/components/OutOfSyncTest.html new file mode 100644 index 0000000000..4828069e2a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/OutOfSyncTest.html @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/OutOfSyncTest?restartApplication</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runOutOfSyncTest::/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Out of sync occured -> the button should be removed--> +<tr> + <td>assertElementNotPresent</td> + <td>vaadin=runOutOfSyncTest::/VButton[0]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/OutOfSyncTest.java b/uitest/src/com/vaadin/tests/components/OutOfSyncTest.java new file mode 100644 index 0000000000..0efb519e8d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/OutOfSyncTest.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Notification; + +public class OutOfSyncTest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Button b = new Button("Click me after 1s to be out of sync"); + b.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + Notification.show("This code will never be reached"); + } + }); + setContent(b); + Thread t = new Thread(new Runnable() { + + @Override + public void run() { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + // Remove button but prevent repaint -> causes out of sync + // issues + getSession().lock(); + try { + setContent(null); + getConnectorTracker().markClean(OutOfSyncTest.this); + } finally { + getSession().unlock(); + } + } + }); + t.start(); + } + + @Override + protected String getTestDescription() { + return "Click the button after 1s when it has been removed server side (causing synchronization problems)"; + } + + @Override + protected Integer getTicketNumber() { + return 10780; + } + +} |