diff options
author | Artur Signell <artur@vaadin.com> | 2013-09-17 14:16:35 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-09-17 14:16:36 +0300 |
commit | 0f7bcffdb9f753148d1027ff380c9520bb78bfd8 (patch) | |
tree | a91e21f0060cd097bfa70b8eef91723047d49692 /uitest | |
parent | 70649ac21a40a2b819856da39ebcfb5394ae3280 (diff) | |
parent | 3a4351f9b777009d8e226d26125f758861ddcbb3 (diff) | |
download | vaadin-framework-0f7bcffdb9f753148d1027ff380c9520bb78bfd8.tar.gz vaadin-framework-0f7bcffdb9f753148d1027ff380c9520bb78bfd8.zip |
Merge changes from origin/7.1
de53191 Fix for #12279 (caret jumps when formatting in RTA).
fca0f7a Add <br> as empty representation for webkit (#12490)
6dcece8 Allow creating TextBox or SuggestionPopup when extending VFilterSelect (#12491)
22fcb44 Include unobfuscated file used by test in the war (#12468)
bc90a58 Unified xml files to end with new line
3d01d74 Reduce Ivy resolver spam to a minimum (#12510)
1e73ca8 Fix keystore path to correspond to the Vaadin 7 directory structure (#12520)
dcf9c61 Protect CurrentInstance instances from garbage collection (#12509)
24ffbc2 Allow storing and restoring null instances in CurrentInstance #12509
0d79a84 Added a comment that hopefully explains the NULL_OBJECT #12509
e4d99b3 Use non-obfuscated version of vaadinPush.js when not in production (#12527)
3a31dfe NullPointerException in TableQuery.fetchMetadata() (#11403)
4659797 fixed incorrect name for close-pressed.png for windows in black theme (#12563)
9b05257 Test for push with streaming based on Table
3cafce3 NullPointerException in DateToSqlDateConverter (#12284)
3a4351f Ensure PushConnection is properly cleaned up on disconnect (#12226, #12522)
Change-Id: I44f3d5f003e62e7ab86a22188b22933491226868
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/build.xml | 5 | ||||
-rw-r--r-- | uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java | 2 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.html | 52 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java | 93 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/push/EnableDisablePush.html | 97 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/push/EnableDisablePush.java | 119 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/push/TablePushStreaming.java | 126 | ||||
-rw-r--r-- | uitest/vaadin-server.xml | 2 |
8 files changed, 492 insertions, 4 deletions
diff --git a/uitest/build.xml b/uitest/build.xml index aaf891925e..bd0f49ae1e 100644 --- a/uitest/build.xml +++ b/uitest/build.xml @@ -19,7 +19,7 @@ <!-- This is copied from common.xml to be able to add server.test.source to the source path --> - <ivy:resolve resolveid="common" conf="build, build-provided" /> + <ivy:resolve log="download-only" resolveid="common" conf="build, build-provided" /> <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" /> </target> @@ -97,7 +97,7 @@ <property name="deps.dir" location="${result.dir}/deps" /> <property name="src" location="${result.dir}/../src" /> - <ivy:resolve resolveid="common" conf="build" /> + <ivy:resolve log="download-only" resolveid="common" conf="build" /> <ivy:cachepath pathid="classpath.runtime.dependencies" conf="build" /> <delete dir="${deps.dir}" /> @@ -120,6 +120,7 @@ <include name="statictestfiles/**" /> <include name="VAADIN/themes/tests-*/**" /> <include name="VAADIN/themes/reindeer-tests/**" /> + <include name="VAADIN/jquery.atmosphere.js" /> <include name="WEB-INF/*.xml" /> <include name="WEB-INF/web.xml.2.4" /> </fileset> diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java index 99f9707479..5ab2134cdb 100644 --- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -51,7 +51,7 @@ import com.vaadin.launcher.util.BrowserLauncher; */ public class DevelopmentServerLauncher { - private static final String KEYSTORE = "src/com/vaadin/launcher/keystore"; + private static final String KEYSTORE = "uitest/src/com/vaadin/launcher/keystore"; private final static int serverPort = 8888; /** diff --git a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.html b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.html new file mode 100644 index 0000000000..fe030f2ea7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.html @@ -0,0 +1,52 @@ +<?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="" /> +<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/com.vaadin.tests.components.ui.CurrentUiRetained?restartApplication</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>2000</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiCurrentUiRetained::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_3</td> + <td>1. Correct UI.getCurrent before GC: true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_2</td> + <td>2. Correct UI.getCurrent after GC: true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_1</td> + <td>3. GC probe available before GC: true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_0</td> + <td>4. GC probe available after GC: false</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java new file mode 100644 index 0000000000..b0127e3a75 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java @@ -0,0 +1,93 @@ +/* + * 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.components.ui; + +import java.util.ArrayList; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.UI; +import com.vaadin.util.CurrentInstance; + +public class CurrentUiRetained extends AbstractTestUIWithLog { + public static class GcProbe { + + } + + @Override + protected void setup(VaadinRequest request) { + final ArrayList<UI> uiLog = new ArrayList<UI>(); + final ArrayList<Boolean> probeLog = new ArrayList<Boolean>(); + + final Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + uiLog.add(UI.getCurrent()); + + GcProbe gcProbe = new GcProbe(); + CurrentInstance.set(GcProbe.class, gcProbe); + probeLog.add(CurrentInstance.get(GcProbe.class) != null); + gcProbe = null; + + Thread.sleep(500l); + System.gc(); + Thread.sleep(500l); + + probeLog.add(CurrentInstance.get(GcProbe.class) != null); + uiLog.add(UI.getCurrent()); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }); + thread.start(); + + addComponent(new Button("Show result", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + try { + thread.join(); + + log("Correct UI.getCurrent before GC: " + + (uiLog.get(0) == CurrentUiRetained.this)); + log("Correct UI.getCurrent after GC: " + + (uiLog.get(1) == CurrentUiRetained.this)); + + log("GC probe available before GC: " + probeLog.get(0)); + log("GC probe available after GC: " + probeLog.get(1)); + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + })); + } + + @Override + protected String getTestDescription() { + return "Tests that garbage collection removes stale CurrentInstance values while retaining values not collected."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(12509); + } + +} diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePush.html b/uitest/src/com/vaadin/tests/push/EnableDisablePush.html new file mode 100644 index 0000000000..87dfa8428f --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/EnableDisablePush.html @@ -0,0 +1,97 @@ +<?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="" /> +<title>EnableDisablePush</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">EnableDisablePush</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/EnableDisablePush?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>1. Push enabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>3. Push disabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>5. Poll enabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>7. Push enabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>9. Poll disabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>11. Push disabled, polling enabled</td> +</tr> +<tr> + <td>pause</td> + <td>3500</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>16. Polling disabled, push enabled</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runEnableDisablePush::PID_SLog_row_0</td> + <td>18. Push disabled</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePush.java b/uitest/src/com/vaadin/tests/push/EnableDisablePush.java new file mode 100644 index 0000000000..1911c66c2d --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/EnableDisablePush.java @@ -0,0 +1,119 @@ +package com.vaadin.tests.push; + +import java.util.Date; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.TimeUnit; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.communication.PushMode; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button; +import com.vaadin.ui.UIDetachedException; + +public class EnableDisablePush extends AbstractTestUI { + + private int c = 0; + + private Log log = new Log(15); + + private final Timer timer = new Timer(true); + + private final class CounterTask extends TimerTask { + + @Override + public void run() { + + try { + while (true) { + TimeUnit.MILLISECONDS.sleep(1000); + + access(new Runnable() { + @Override + public void run() { + log.log("Counter = " + c++); + if (c == 3) { + log.log("Disabling polling, enabling push"); + getPushConfiguration().setPushMode( + PushMode.AUTOMATIC); + setPollInterval(-1); + log.log("Polling disabled, push enabled"); + } + } + }); + } + } catch (InterruptedException e) { + } catch (UIDetachedException e) { + } + } + }; + + @Override + protected void setup(VaadinRequest request) { + + getPushConfiguration().setPushMode(PushMode.AUTOMATIC); + log.log("Push enabled"); + + addComponent(new Button("Disable push", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + log.log("Disabling push"); + getPushConfiguration().setPushMode(PushMode.DISABLED); + log.log("Push disabled"); + } + })); + + addComponent(new Button("Enable push", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + log.log("Enabling push"); + getPushConfiguration().setPushMode(PushMode.AUTOMATIC); + log.log("Push enabled"); + } + })); + + addComponent(new Button("Disable polling", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + log.log("Disabling poll"); + setPollInterval(-1); + log.log("Poll disabled"); + } + })); + + addComponent(new Button("Enable polling", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + log.log("Enabling poll"); + setPollInterval(1000); + log.log("Poll enabled"); + } + })); + + addComponent(new Button( + "Disable push, re-enable from background thread", + new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + log.log("Disabling push, enabling polling"); + getPushConfiguration().setPushMode(PushMode.DISABLED); + setPollInterval(1000); + timer.schedule(new CounterTask(), new Date()); + log.log("Push disabled, polling enabled"); + } + })); + + addComponent(log); + } + + @Override + protected String getTestDescription() { + return "Test dynamically enablind and disabling push"; + } + + @Override + protected Integer getTicketNumber() { + return 12226; + } +} diff --git a/uitest/src/com/vaadin/tests/push/TablePushStreaming.java b/uitest/src/com/vaadin/tests/push/TablePushStreaming.java new file mode 100644 index 0000000000..de824eef3a --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/TablePushStreaming.java @@ -0,0 +1,126 @@ +/* + * 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.data.Container; +import com.vaadin.data.Item; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.ui.Transport; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Table; + +/** + * + * @since + * @author Vaadin Ltd + */ +@Push(transport = Transport.STREAMING) +public class TablePushStreaming extends AbstractTestUI { + + private int iteration = 1; + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + final Table t = new Table("The table"); + t.setContainerDataSource(generateContainer(10, 10, iteration++)); + t.setSizeFull(); + Runnable r = new Runnable() { + + @Override + public void run() { + for (int i = 0; i < 99; i++) { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + access(new Runnable() { + + @Override + public void run() { + t.setContainerDataSource(generateContainer( + t.getVisibleColumns().length, t.size(), + iteration++)); + } + + }); + } + + } + }; + Thread tr = new Thread(r); + tr.start(); + + setContent(t); + } + + /** + * @param iter + * @since + * @return + */ + private Container generateContainer(int rows, int cols, int iter) { + IndexedContainer ic = new IndexedContainer(); + for (int col = 1; col <= cols; col++) { + ic.addContainerProperty("Property" + col, String.class, ""); + } + + for (int row = 0; row < rows; row++) { + Item item = ic.addItem("row" + row); + for (int col = 1; col <= cols; col++) { + item.getItemProperty("Property" + col).setValue( + "Row " + row + " col " + col + "(" + iter + ")"); + } + + } + + return ic; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Test that pushes Table data at a high pace to detect possible problems in the streaming protocol"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return null; + } + +} diff --git a/uitest/vaadin-server.xml b/uitest/vaadin-server.xml index f2c3c60959..4e84a6f238 100644 --- a/uitest/vaadin-server.xml +++ b/uitest/vaadin-server.xml @@ -6,7 +6,7 @@ <target name="deploy-and-start"> <fail unless="war.file" message="No war file given in 'war.file'" /> - <ivy:resolve file="${dir}/ivy.xml" /> + <ivy:resolve log="download-only" file="${dir}/ivy.xml" /> <ivy:cachepath pathid="classpath.jetty" conf="jetty-run" /> <java classname="org.mortbay.jetty.runner.Runner" fork="yes" output="${vaadin.basedir}/result/jetty.java.out" resultproperty="resultCode"> <arg value="--port" /> |