aboutsummaryrefslogtreecommitdiffstats
path: root/server/tests/src
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2013-08-23 15:59:23 +0300
committerVaadin Code Review <review@vaadin.com>2013-09-10 10:32:28 +0000
commit53282726c5769bf763beb5d8576c71e0e7b5bef3 (patch)
tree8b414b0ed2c9db3345acb726abe130f4df952044 /server/tests/src
parentba76f5660bc74fc7a96b93944a79f95366c53b8d (diff)
downloadvaadin-framework-53282726c5769bf763beb5d8576c71e0e7b5bef3.tar.gz
vaadin-framework-53282726c5769bf763beb5d8576c71e0e7b5bef3.zip
Ignore RPC calls from components that are concurrently removed (#12337)
Change-Id: I8b97444d33b9535b9073fd705fed15a6cc2992e7
Diffstat (limited to 'server/tests/src')
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/table/TableRemovedQuicklySendsInvalidRpcCalls.java107
1 files changed, 107 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/table/TableRemovedQuicklySendsInvalidRpcCalls.java b/server/tests/src/com/vaadin/tests/server/component/table/TableRemovedQuicklySendsInvalidRpcCalls.java
new file mode 100644
index 0000000000..b539e42efe
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/table/TableRemovedQuicklySendsInvalidRpcCalls.java
@@ -0,0 +1,107 @@
+/*
+ * 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.server.component.table;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Table;
+
+@Push
+public class TableRemovedQuicklySendsInvalidRpcCalls extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new Button("Blink a table", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ blinkTable();
+ }
+ }));
+ }
+
+ private void blinkTable() {
+ final Table table = new Table();
+ table.setPageLength(5);
+ table.addContainerProperty(new Object(), String.class, null);
+
+ for (int i = 0; i < 50; i++) {
+ table.addItem(new Object[] { "Row" }, new Object());
+ }
+
+ table.addItemClickListener(new ItemClickListener() {
+ private int i;
+
+ @Override
+ public void itemClick(ItemClickEvent event) {
+ /*
+ * Ignore implementation. This is only an easy way to make the
+ * client-side update table's variables (by furiously clicking
+ * on the table row.
+ *
+ * This way, we get variable changes queued. The push call will
+ * then remove the Table, while the variable changes being still
+ * in the queue, leading to the issue as described in the
+ * ticket.
+ */
+ System.out.println("clicky " + (++i));
+ }
+ });
+
+ System.out.println("adding component");
+ addComponent(table);
+
+ new Thread() {
+ @Override
+ public void run() {
+ getSession().lock();
+ try {
+ Thread.sleep(500);
+ access(new Runnable() {
+ @Override
+ public void run() {
+ System.out.println("removing component");
+ removeComponent(table);
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
+ getSession().unlock();
+ }
+ };
+ }.start();
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Adding and subsequently quickly removing a table "
+ + "should not leave any pending RPC calls waiting "
+ + "in a Timer. Issue can be reproduced by "
+ + "1) pressing the button 2) clicking furiously "
+ + "on a row in the table.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12337;
+ }
+}