]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove tracking of unregistered connectors (#8153)
authorAleksi Hietanen <aleksi@vaadin.com>
Wed, 11 Jan 2017 14:12:56 +0000 (16:12 +0200)
committerPekka Hyvönen <pekka@vaadin.com>
Wed, 11 Jan 2017 14:12:55 +0000 (16:12 +0200)
* Remove tracking of unregistered connectors

* Merge branch '7.7' into 8111-remove-unregistered-connector-tracking

* Merge branch '7.7' into 8111-remove-unregistered-connector-tracking

* Add tests that verify markAsDirty is called on old parent

* Merge branch '7.7' into 8111-remove-unregistered-connector-tracking

17 files changed:
client/src/main/java/com/vaadin/client/communication/MessageHandler.java
client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
server/src/main/java/com/vaadin/server/AbstractExtension.java
server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java
server/src/main/java/com/vaadin/ui/AbstractComponent.java
server/src/main/java/com/vaadin/ui/ConnectorTracker.java
server/src/main/java/com/vaadin/ui/UI.java
server/src/test/java/com/vaadin/tests/server/abstractextension/AbstractExtensionSetParentTest.java [new file with mode: 0644]
server/src/test/java/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentSetParentTest.java [new file with mode: 0644]
shared/src/main/java/com/vaadin/shared/ui/ui/UIServerRpc.java
uitest/src/main/java/com/vaadin/tests/application/ResynchronizeAfterAsyncRemoval.java
uitest/src/main/java/com/vaadin/tests/components/OutOfSync.java [deleted file]
uitest/src/main/java/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java
uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java [deleted file]
uitest/src/test/java/com/vaadin/tests/application/ResynchronizeAfterAsyncRemovalTest.java
uitest/src/test/java/com/vaadin/tests/components/OutOfSyncTest.java [deleted file]
uitest/src/test/java/com/vaadin/tests/push/PushRemoveConnectorsTest.java [deleted file]

index 714af23683632168272155bc90bd983319ccb9e4..38b9a783e569abd79ec1ecacf9c2fb756691d34a 100644 (file)
@@ -492,13 +492,9 @@ public class MessageHandler {
                             .handleServerResponse(json.getValueMap("dd"));
                 }
 
-                int removed = unregisterRemovedConnectors(
+                unregisterRemovedConnectors(
                         connectorHierarchyUpdateResult.detachedConnectorIds);
-                if (removed > 0 && !isResponse(json)) {
-                    // Must acknowledge the removal using an XHR or server
-                    // memory usage will keep growing
-                    getUIConnector().sendAck();
-                }
+
                 getLogger().info("handleUIDLMessage: "
                         + (Duration.currentTimeMillis() - processUidlStart)
                         + " ms");
@@ -808,15 +804,14 @@ public class MessageHandler {
                         "verifyConnectorHierarchy - this is only performed in debug mode");
             }
 
-            private int unregisterRemovedConnectors(
+            private void unregisterRemovedConnectors(
                     FastStringSet detachedConnectors) {
                 Profiler.enter("unregisterRemovedConnectors");
 
                 JsArrayString detachedArray = detachedConnectors.dump();
-                int nrDetached = detachedArray.length();
-                for (int i = 0; i < nrDetached; i++) {
-                    ServerConnector connector = getConnectorMap()
-                            .getConnector(detachedArray.get(i));
+                for (int i = 0; i < detachedArray.length(); i++) {
+                    ServerConnector connector = getConnectorMap().getConnector(
+                            detachedArray.get(i));
 
                     Profiler.enter(
                             "unregisterRemovedConnectors unregisterConnector");
@@ -831,10 +826,9 @@ public class MessageHandler {
                     verifyConnectorHierarchy();
                 }
 
-                getLogger()
-                        .info("* Unregistered " + nrDetached + " connectors");
+                getLogger().info("* Unregistered " + detachedArray.length()
+                        + " connectors");
                 Profiler.leave("unregisterRemovedConnectors");
-                return nrDetached;
             }
 
             private JsArrayString createConnectorsIfNeeded(ValueMap json) {
index c31fcb9ed6203fb5d6d6aef430b625b1d51cb5a4..aad3f4bcb6952a21045308004f78f415fead4217 100644 (file)
@@ -1133,14 +1133,4 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
     private static Logger getLogger() {
         return Logger.getLogger(UIConnector.class.getName());
     }
-
-    /**
-     * Send an acknowledgement RPC to the server. This allows the server to know
-     * which messages the client has received, even when the client is not
-     * sending any other traffic.
-     */
-    public void sendAck() {
-        getRpcProxy(UIServerRpc.class).acknowledge();
-
-    }
 }
index 513084c179a2f779f6ebc9a44f59e8f3332e2cff..da62638cef250b7f83ddfb05fb94d9194c36be6d 100644 (file)
@@ -109,6 +109,7 @@ public abstract class AbstractExtension extends AbstractClientConnector
      *            The parent to set
      */
     private void internalSetParent(ClientConnector parent) {
+        ClientConnector oldParent = getParent();
 
         // Send a detach event if the component is currently attached
         if (isAttached()) {
@@ -123,6 +124,9 @@ public abstract class AbstractExtension extends AbstractClientConnector
             attach();
         }
 
+        if (oldParent != null) {
+            oldParent.markAsDirty();
+        }
     }
 
     @Override
index dfdeed70ae39a9f09ccb7384982ce3257fd7ee82..d0be98332c58da1c8a2451d59fc06ff3af1e6541 100644 (file)
@@ -274,9 +274,6 @@ public class ServerRpcHandler implements Serializable {
                     rpcRequest.getRpcInvocationsData());
         }
 
-        ui.getConnectorTracker()
-                .cleanConcurrentlyRemovedConnectorIds(rpcRequest.getSyncId());
-
         if (rpcRequest.isResynchronize()) {
             ui.getSession().getCommunicationManager().repaintAll(ui);
         }
@@ -521,22 +518,6 @@ public class ServerRpcHandler implements Serializable {
         String interfaceName = invocationJson.getString(1);
         String methodName = invocationJson.getString(2);
 
-        if (connectorTracker.getConnector(connectorId) == null && !connectorId
-                .equals(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID)) {
-
-            if (!connectorTracker.connectorWasPresentAsRequestWasSent(
-                    connectorId, lastSyncIdSeenByClient)) {
-                getLogger().log(Level.WARNING, "RPC call to " + interfaceName
-                        + "." + methodName + " received for connector "
-                        + connectorId
-                        + " but no such connector could be found. Resynchronizing client.");
-                // This is likely an out of sync issue (client tries to update a
-                // connector which is not present). Force resync.
-                connectorTracker.markAllConnectorsDirty();
-            }
-            return null;
-        }
-
         JsonArray parametersJson = invocationJson.getArray(3);
 
         if (LegacyChangeVariablesInvocation
index f0d57737362147274acd96612556bcf00d9c3b60..24bb9f8f7923d7402e5612993714aaf50ae296bd 100644 (file)
@@ -42,6 +42,7 @@ import com.vaadin.event.ContextClickEvent.ContextClickNotifier;
 import com.vaadin.event.ShortcutListener;
 import com.vaadin.server.AbstractClientConnector;
 import com.vaadin.server.AbstractErrorMessage.ContentMode;
+import com.vaadin.server.ClientConnector;
 import com.vaadin.server.ComponentSizeValidator;
 import com.vaadin.server.ErrorMessage;
 import com.vaadin.server.ErrorMessage.ErrorLevel;
@@ -571,6 +572,8 @@ public abstract class AbstractComponent extends AbstractClientConnector
                     getClass().getName() + " already has a parent.");
         }
 
+        ClientConnector oldParent = getParent();
+
         // Send a detach event if the component is currently attached
         if (isAttached()) {
             detach();
@@ -583,6 +586,10 @@ public abstract class AbstractComponent extends AbstractClientConnector
         if (isAttached()) {
             attach();
         }
+
+        if (oldParent != null) {
+            oldParent.markAsDirty();
+        }
     }
 
     /**
index 3cf03a134d1e1e720b77fcd2e0ead8888123df7d..c3b1cfe98ffc76d8aceec6d01e67e45007878d73 100644 (file)
@@ -24,9 +24,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.NavigableMap;
 import java.util.Set;
-import java.util.TreeMap;
 import java.util.UUID;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -90,14 +88,6 @@ public class ConnectorTracker implements Serializable {
 
     private int currentSyncId = 0;
 
-    /**
-     * Map to track on which syncId each connector was removed.
-     *
-     * @see #getCurrentSyncId()
-     * @see #cleanConcurrentlyRemovedConnectorIds(long)
-     */
-    private TreeMap<Integer, Set<String>> syncIdToUnregisteredConnectorIds = new TreeMap<Integer, Set<String>>();
-
     /**
      * Gets a logger for this class
      *
@@ -182,15 +172,6 @@ public class ConnectorTracker implements Serializable {
                     + " is not the one that was registered for that id");
         }
 
-        Set<String> unregisteredConnectorIds = syncIdToUnregisteredConnectorIds
-                .get(currentSyncId);
-        if (unregisteredConnectorIds == null) {
-            unregisteredConnectorIds = new HashSet<String>();
-            syncIdToUnregisteredConnectorIds.put(currentSyncId,
-                    unregisteredConnectorIds);
-        }
-        unregisteredConnectorIds.add(connectorId);
-
         dirtyConnectors.remove(connector);
         if (unregisteredConnectors.add(connector)) {
             if (getLogger().isLoggable(Level.FINE)) {
@@ -846,48 +827,6 @@ public class ConnectorTracker implements Serializable {
         return streamVariableToSeckey.get(variable);
     }
 
-    /**
-     * Check whether a connector was present on the client when the it was
-     * creating this request, but was removed server-side before the request
-     * arrived.
-     *
-     * @since 7.2
-     * @param connectorId
-     *            The connector id to check for whether it was removed
-     *            concurrently or not.
-     * @param lastSyncIdSeenByClient
-     *            the most recent sync id the client has seen at the time the
-     *            request was sent, or -1 to ignore potential problems
-     * @return <code>true</code> if the connector was removed before the client
-     *         had a chance to react to it.
-     */
-    public boolean connectorWasPresentAsRequestWasSent(String connectorId,
-            long lastSyncIdSeenByClient) {
-        assert getConnector(connectorId) == null : "Connector " + connectorId
-                + " is still attached";
-
-        if (lastSyncIdSeenByClient == -1) {
-            // Ignore potential problems
-            return true;
-        }
-
-        /*
-         * Use non-inclusive tail map to find all connectors that were removed
-         * after the reported sync id was sent to the client.
-         */
-        NavigableMap<Integer, Set<String>> unregisteredAfter = syncIdToUnregisteredConnectorIds
-                .tailMap(Integer.valueOf((int) lastSyncIdSeenByClient), false);
-        for (Set<String> unregisteredIds : unregisteredAfter.values()) {
-            if (unregisteredIds.contains(connectorId)) {
-                // Removed with a higher sync id, so it was most likely present
-                // when this sync id was sent.
-                return true;
-            }
-        }
-
-        return false;
-    }
-
     /**
      * Gets the most recently generated server sync id.
      * <p>
@@ -910,45 +849,4 @@ public class ConnectorTracker implements Serializable {
     public int getCurrentSyncId() {
         return currentSyncId;
     }
-
-    /**
-     * Maintains the bookkeeping connector removal and concurrency by removing
-     * entries that have become too old.
-     * <p>
-     * <em>It is important to run this call for each transmission from the
-     * client</em> , otherwise the bookkeeping gets out of date and the results
-     * form {@link #connectorWasPresentAsRequestWasSent(String, long)} will
-     * become invalid (that is, even though the client knew the component was
-     * removed, the aforementioned method would start claiming otherwise).
-     * <p>
-     * Entries that both client and server agree upon are removed. Since
-     * argument is the last sync id that the client has seen from the server, we
-     * know that entries earlier than that cannot cause any problems anymore.
-     * <p>
-     * The sync id value <code>-1</code> is ignored to facilitate testing with
-     * pre-recorded requests.
-     *
-     * @see #connectorWasPresentAsRequestWasSent(String, long)
-     * @since 7.2
-     * @param lastSyncIdSeenByClient
-     *            the sync id the client has most recently received from the
-     *            server.
-     */
-    public void cleanConcurrentlyRemovedConnectorIds(
-            int lastSyncIdSeenByClient) {
-        if (lastSyncIdSeenByClient == -1) {
-            // Sync id checking is not in use, so we should just clear the
-            // entire map to avoid leaking memory
-            syncIdToUnregisteredConnectorIds.clear();
-            return;
-        }
-        /*
-         * We remove all entries _older_ than the one reported right now,
-         * because the remaining still contain components that might cause
-         * conflicts. In any case, it's better to clean up too little than too
-         * much, especially as the data will hardly grow into the kilobytes.
-         */
-        syncIdToUnregisteredConnectorIds.headMap(lastSyncIdSeenByClient, true)
-                .clear();
-    }
 }
index 24a53dfd9f775672f79e99ec5c4bfc5383834556..a132d0bb7c6cccd7ce85774f680fd7480a042b47 100644 (file)
@@ -179,11 +179,6 @@ public abstract class UI extends AbstractSingleComponentContainer
         public void poll() {
             fireEvent(new PollEvent(UI.this));
         }
-
-        @Override
-        public void acknowledge() {
-            // Nothing to do, just need the message to be sent and processed
-        }
     };
     private DebugWindowServerRpc debugRpc = new DebugWindowServerRpc() {
         @Override
diff --git a/server/src/test/java/com/vaadin/tests/server/abstractextension/AbstractExtensionSetParentTest.java b/server/src/test/java/com/vaadin/tests/server/abstractextension/AbstractExtensionSetParentTest.java
new file mode 100644 (file)
index 0000000..630004f
--- /dev/null
@@ -0,0 +1,23 @@
+package com.vaadin.tests.server.abstractextension;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.vaadin.server.AbstractExtension;
+import com.vaadin.server.ClientConnector;
+
+public class AbstractExtensionSetParentTest {
+
+    private static class TestExtension extends AbstractExtension {
+
+    }
+
+    @Test
+    public void setParent_marks_old_parent_as_dirty() {
+        ClientConnector connector = Mockito.mock(ClientConnector.class);
+        TestExtension extension = new TestExtension();
+        extension.setParent(connector);
+        extension.setParent(null);
+        Mockito.verify(connector, Mockito.times(1)).markAsDirty();
+    }
+}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentSetParentTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentSetParentTest.java
new file mode 100644 (file)
index 0000000..a29e101
--- /dev/null
@@ -0,0 +1,22 @@
+package com.vaadin.tests.server.component.abstractcomponent;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.HasComponents;
+
+public class AbstractComponentSetParentTest {
+
+    private static class TestComponent extends AbstractComponent {
+    }
+
+    @Test
+    public void setParent_marks_old_parent_as_dirty() {
+        HasComponents hasComponents = Mockito.mock(HasComponents.class);
+        TestComponent testComponent = new TestComponent();
+        testComponent.setParent(hasComponents);
+        testComponent.setParent(null);
+        Mockito.verify(hasComponents, Mockito.times(1)).markAsDirty();
+    }
+}
index 45077f909434de4f68e489fddc372aefbf9b8011..ad3fef554aeb5e1d245e7e21ea463a9245a3d400 100644 (file)
@@ -35,7 +35,4 @@ public interface UIServerRpc extends ClickRpc, ServerRpc {
      * should always be called to ensure the message is flushed right away.
      */
     public void poll();
-
-    @NoLoadingIndicator
-    public void acknowledge();
 }
index 8f73d24a6be66555c053b7d7f5158ae2956f8824..f05c3c2818a8cd0dee32f5333276dc188abeaa05 100644 (file)
@@ -1,14 +1,9 @@
 package com.vaadin.tests.application;
 
-import java.lang.reflect.Field;
-import java.util.Map;
-import java.util.Set;
-
 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.ConnectorTracker;
 import com.vaadin.ui.Window;
 
 public class ResynchronizeAfterAsyncRemoval extends AbstractTestUIWithLog {
@@ -42,36 +37,5 @@ public class ResynchronizeAfterAsyncRemoval extends AbstractTestUIWithLog {
                 log("Dirty: " + dirty);
             }
         }));
-        addComponent(new Button("Log unregistered connector count",
-                new Button.ClickListener() {
-                    @Override
-                    public void buttonClick(ClickEvent event) {
-                        logUnregisteredConnectorCount();
-                    }
-                }));
-    }
-
-    private void logUnregisteredConnectorCount() {
-        int count = 0;
-
-        Map<Integer, Set<String>> unregisterIdMap = getUnregisterIdMap();
-        for (Set<String> set : unregisterIdMap.values()) {
-            count += set.size();
-        }
-        log("syncId: " + getConnectorTracker().getCurrentSyncId());
-        log("Unregistered connector count: " + count);
-    }
-
-    @SuppressWarnings("unchecked")
-    private Map<Integer, Set<String>> getUnregisterIdMap() {
-        try {
-            ConnectorTracker tracker = getConnectorTracker();
-            Field field = tracker.getClass()
-                    .getDeclaredField("syncIdToUnregisteredConnectorIds");
-            field.setAccessible(true);
-            return (Map<Integer, Set<String>>) field.get(tracker);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
     }
 }
\ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/tests/components/OutOfSync.java b/uitest/src/main/java/com/vaadin/tests/components/OutOfSync.java
deleted file mode 100644 (file)
index 8cefffc..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-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 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(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;
-    }
-
-}
index b475c998460e896cbf7a85cb517dbf00197caecf..f48a0003299491a8261fd422f8c1339681f9109e 100644 (file)
@@ -28,6 +28,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.ConnectorTracker;
 import com.vaadin.ui.Table;
+
 import elemental.json.JsonObject;
 
 @Push
@@ -172,25 +173,11 @@ public class TableRemovedQuicklySendsInvalidRpcCalls extends AbstractTestUI {
             return tracker.getSeckey(variable);
         }
 
-        @Override
-        public boolean connectorWasPresentAsRequestWasSent(String connectorId,
-                long lastSyncIdSeenByClient) {
-            return tracker.connectorWasPresentAsRequestWasSent(connectorId,
-                    lastSyncIdSeenByClient);
-        }
-
         @Override
         public int getCurrentSyncId() {
             return tracker.getCurrentSyncId();
         }
 
-        @Override
-        public void cleanConcurrentlyRemovedConnectorIds(
-                int lastSyncIdSeenByClient) {
-            tracker.cleanConcurrentlyRemovedConnectorIds(
-                    lastSyncIdSeenByClient);
-        }
-
         @Override
         public boolean equals(Object obj) {
             return tracker.equals(obj);
diff --git a/uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java b/uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java
deleted file mode 100644 (file)
index 528492c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.vaadin.tests.push;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.commons.lang.SerializationUtils;
-
-import com.vaadin.annotations.Push;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.ui.AbstractOrderedLayout;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-
-@Push
-public class PushRemoveConnectors extends AbstractTestUIWithLog {
-
-    private transient final ScheduledExecutorService threadPool = Executors
-            .newScheduledThreadPool(5);
-    static final String START = "start";
-    static final String STOP = "stop";
-    private AbstractOrderedLayout verticalLayout;
-    private transient ScheduledFuture<?> task = null;
-
-    @Override
-    protected void setup(VaadinRequest request) {
-        final CheckBox pollingEnabled = new CheckBox("Polling enabled");
-        pollingEnabled.addValueChangeListener(new ValueChangeListener() {
-            @Override
-            public void valueChange(ValueChangeEvent event) {
-                setPollInterval(pollingEnabled.getValue() ? 1000 : -1);
-            }
-        });
-
-        Button start = new Button("start");
-        start.setId(START);
-        start.addClickListener(new ClickListener() {
-
-            @Override
-            public void buttonClick(ClickEvent event) {
-                task = threadPool.scheduleAtFixedRate(new Runnable() {
-                    @Override
-                    public void run() {
-                        access(new Runnable() {
-                            public void run() {
-                                populate();
-                                log("Serialized session size: "
-                                        + getSessionSize());
-                            }
-                        });
-                    }
-                }, 1, 1, TimeUnit.SECONDS);
-            }
-        });
-        Button stop = new Button("stop");
-        stop.setId(STOP);
-        stop.addClickListener(new ClickListener() {
-            @Override
-            public void buttonClick(ClickEvent event) {
-                if (task != null) {
-                    task.cancel(true);
-                    task = null;
-                }
-
-            }
-        });
-        verticalLayout = new HorizontalLayout();
-        populate();
-        addComponents(pollingEnabled, start, stop, verticalLayout);
-    }
-
-    private void populate() {
-        verticalLayout.removeAllComponents();
-        for (int i = 0; i < 500; i++) {
-            Label l = new Label(".");
-            l.setSizeUndefined();
-            verticalLayout.addComponent(l);
-        }
-    }
-
-    private int getSessionSize() {
-        return SerializationUtils.serialize(getSession()).length;
-    }
-}
index b1be11d9332ae19fc9ed7316c41b5b88e4130a65..61dd5bc803e0c7ea966081043b600c8165643563 100644 (file)
@@ -34,19 +34,5 @@ public class ResynchronizeAfterAsyncRemovalTest extends SingleBrowserTest {
         Assert.assertEquals(
                 "Removing window should not cause button to be marked as dirty",
                 "2. Dirty: false", getLogRow(0));
-
-        ButtonElement logCountButton = $(ButtonElement.class).all().get(1);
-        logCountButton.click();
-
-        Assert.assertEquals("Sanity check", "3. syncId: 2", getLogRow(1));
-        Assert.assertEquals("Sanity check",
-                "4. Unregistered connector count: 1", getLogRow(0));
-
-        logCountButton.click();
-
-        Assert.assertEquals("Sanity check", "5. syncId: 3", getLogRow(1));
-        Assert.assertEquals(
-                "Unregistered connector map should have been cleared",
-                "6. Unregistered connector count: 0", getLogRow(0));
     }
 }
diff --git a/uitest/src/test/java/com/vaadin/tests/components/OutOfSyncTest.java b/uitest/src/test/java/com/vaadin/tests/components/OutOfSyncTest.java
deleted file mode 100644 (file)
index e2b49ae..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.components;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class OutOfSyncTest extends MultiBrowserTest {
-
-    @Test
-    public void testClientResync() throws InterruptedException {
-        openTestURL();
-
-        // Wait for server to get rid of the Button
-        sleep(1000);
-
-        // On the first round-trip after the component has been removed, the
-        // server assumes the client will remove the button. How ever (to force
-        // it to be out of sync) the test UI calls markClean() on the Button to
-        // make it not update with the response.
-        $(ButtonElement.class).first().click();
-        Assert.assertTrue(
-                "Button should not have disappeared on the first click.",
-                $(ButtonElement.class).exists());
-
-        // Truly out of sync, full resync is forced.
-        $(ButtonElement.class).first().click();
-        Assert.assertFalse("Button should disappear with the second click.",
-                $(ButtonElement.class).exists());
-    }
-
-}
diff --git a/uitest/src/test/java/com/vaadin/tests/push/PushRemoveConnectorsTest.java b/uitest/src/test/java/com/vaadin/tests/push/PushRemoveConnectorsTest.java
deleted file mode 100644 (file)
index 3070d1e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.vaadin.tests.push;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.tests.tb3.SingleBrowserTest;
-
-public class PushRemoveConnectorsTest extends SingleBrowserTest {
-
-    @Test
-    public void testNoMemoryLeak() throws InterruptedException {
-        openTestURL();
-        $(ButtonElement.class).id(PushRemoveConnectors.START).click();
-        Thread.sleep(5000);
-        int last = getMemoryUsage();
-        int i = 0;
-        while (i++ < 10) {
-            Thread.sleep(5000);
-            int now = getMemoryUsage();
-            System.out.println("Memory usage: " + now);
-            if (last == now)
-                break;
-
-            last = now;
-        }
-        $(ButtonElement.class).id(PushRemoveConnectors.STOP).click();
-
-        Assert.assertNotEquals(10, i);
-    }
-
-    private int getMemoryUsage() {
-        return Integer.parseInt(
-                getLogRow(0).replaceFirst(".*Serialized session size: ", ""));
-    }
-}