]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for PushLargeData test. (#8019)
authorDenis <denis@vaadin.com>
Fri, 16 Dec 2016 13:33:07 +0000 (15:33 +0200)
committerPekka Hyvönen <pekka@vaadin.com>
Fri, 16 Dec 2016 13:33:07 +0000 (15:33 +0200)
* Fix for PushLargeData test.

uitest/src/main/java/com/vaadin/tests/push/PushLargeData.java

index 2d4a1a0fc8f0de54dc03488b5927a2e0b5e992d1..8617d8f88dac03f7683493ecff785645b57ed37f 100644 (file)
@@ -84,8 +84,8 @@ public abstract class PushLargeData extends AbstractTestUIWithLog {
                 Integer pushSize = (Integer) dataSize.getConvertedValue();
                 Integer pushInterval = (Integer) interval.getConvertedValue();
                 Integer pushDuration = (Integer) duration.getConvertedValue();
-                PushRunnable r = new PushRunnable(pushSize, pushInterval,
-                        pushDuration);
+                PushRunnable r = new PushRunnable(getUI(), pushSize,
+                        pushInterval, pushDuration);
                 executor.execute(r);
                 log.log("Starting push, size: " + pushSize + ", interval: "
                         + pushInterval + "ms, duration: " + pushDuration
@@ -115,11 +115,14 @@ public abstract class PushLargeData extends AbstractTestUIWithLog {
         private Integer size;
         private Integer interval;
         private Integer duration;
+        private final UI ui;
 
-        public PushRunnable(Integer size, Integer interval, Integer duration) {
+        public PushRunnable(UI ui, Integer size, Integer interval,
+                Integer duration) {
             this.size = size;
             this.interval = interval;
             this.duration = duration;
+            this.ui = ui;
         }
 
         @Override
@@ -129,15 +132,15 @@ public abstract class PushLargeData extends AbstractTestUIWithLog {
             int packageIndex = 1;
             while (System.currentTimeMillis() < endTime) {
                 final int idx = packageIndex++;
-                UI.getCurrent().access(new Runnable() {
+                ui.access(new Runnable() {
                     @Override
                     public void run() {
-                        PushLargeData ui = (PushLargeData) UI.getCurrent();
+                        PushLargeData pushUi = (PushLargeData) ui;
                         // Using description as it is not rendered to the DOM
                         // immediately
-                        ui.getDataLabel().setDescription(
+                        pushUi.getDataLabel().setDescription(
                                 System.currentTimeMillis() + ": " + data);
-                        ui.log("Package " + idx + " pushed");
+                        pushUi.log("Package " + idx + " pushed");
                     }
                 });
                 try {
@@ -146,11 +149,11 @@ public abstract class PushLargeData extends AbstractTestUIWithLog {
                     return;
                 }
             }
-            UI.getCurrent().access(new Runnable() {
+            ui.access(new Runnable() {
                 @Override
                 public void run() {
-                    PushLargeData ui = (PushLargeData) UI.getCurrent();
-                    ui.log("Push complete");
+                    PushLargeData pushUi = (PushLargeData) ui;
+                    pushUi.log("Push complete");
                 }
             });