1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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 OutOfSync extends AbstractReindeerTestUI {
-
- @Override
- protected void setup(VaadinRequest request) {
- // Without this, there is an extra request from the UI that changes the
- // request sequence compared to what the test expects
- setImmediate(false);
-
- 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(OutOfSync.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;
- }
-
- }
|