]> source.dussan.org Git - vaadin-framework.git/commitdiff
Search only remaining message for delimiter (#12404)
authorArtur Signell <artur@vaadin.com>
Mon, 19 Aug 2013 15:27:35 +0000 (18:27 +0300)
committerArtur Signell <artur@vaadin.com>
Tue, 20 Aug 2013 06:19:15 +0000 (09:19 +0300)
Change-Id: I0d61984aa795ec2b3bd384c2f93f6e3ee2a71be3

WebContent/VAADIN/jquery.atmosphere.js
uitest/src/com/vaadin/tests/push/BarInUIDL.html [new file with mode: 0644]
uitest/src/com/vaadin/tests/push/BarInUIDL.java [new file with mode: 0644]

index b2dd99f5d2bb276aff72437d763e5b7b1b4a39d1..b6f86d428abd5067c7127031fba652ee928f7a54 100644 (file)
@@ -1213,9 +1213,13 @@ jQuery.atmosphere = function() {
                         messageLength = jQuery.trim(message.substring(messageLength, messageStart));
                         message = message.substring(messageStart + request.messageDelimiter.length, message.length);
 
+                        // Stop search if there is not enough characters remaining (wait for next part to arrive)
                         if (message.length == 0 || message.length < messageLength) break;
 
-                        messageStart = message.indexOf(request.messageDelimiter);
+                        // Find start of a possibly existing subsequent message from the remaining data
+                        messageStart = message.substring(messageLength).indexOf(request.messageDelimiter);
+                        
+                        // Store the completely received message 
                         messages.push(message.substring(0, messageLength));
                     }
 
diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDL.html b/uitest/src/com/vaadin/tests/push/BarInUIDL.html
new file mode 100644 (file)
index 0000000..66f0315
--- /dev/null
@@ -0,0 +1,42 @@
+<?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-push/com.vaadin.tests.push.BarInUIDL?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td>
+       <td>Thank you for clicking | bar</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]</td>
+       <td>Thank you for clicking | bar</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDL.java b/uitest/src/com/vaadin/tests/push/BarInUIDL.java
new file mode 100644 (file)
index 0000000..7e414cc
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+
+public class BarInUIDL extends AbstractTestUI {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+     * VaadinRequest)
+     */
+    @Override
+    protected void setup(VaadinRequest request) {
+        Button button = new Button("Click Me");
+        button.addClickListener(new Button.ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                addComponent(new Label("Thank you for clicking | bar"));
+            }
+        });
+        addComponent(button);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+     */
+    @Override
+    protected String getTestDescription() {
+        return "Verify that there is no problem with messages containing | by clicking the button repeatedly";
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+     */
+    @Override
+    protected Integer getTicketNumber() {
+        return 12404;
+    }
+
+}