summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <legioth@gmail.com>2017-06-12 12:35:45 +0300
committerIlia Motornyi <elmot@vaadin.com>2017-06-12 12:35:45 +0300
commitf8f8cc0385acc3d205de16d3183dd1fc410524a1 (patch)
tree12208234aaea2552222eb1a8c791565071431de2 /uitest
parent8ff23ad10859132e5015f6372e623ed7ce8e05cc (diff)
downloadvaadin-framework-f8f8cc0385acc3d205de16d3183dd1fc410524a1.tar.gz
vaadin-framework-f8f8cc0385acc3d205de16d3183dd1fc410524a1.zip
Add pluggable connector id generator support
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/applicationservlet/ServiceInitListeners.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/applicationservlet/TestingServiceInitListener.java16
-rw-r--r--uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java1
3 files changed, 19 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/applicationservlet/ServiceInitListeners.java b/uitest/src/main/java/com/vaadin/tests/applicationservlet/ServiceInitListeners.java
index 16e4609267..5c649a26b3 100644
--- a/uitest/src/main/java/com/vaadin/tests/applicationservlet/ServiceInitListeners.java
+++ b/uitest/src/main/java/com/vaadin/tests/applicationservlet/ServiceInitListeners.java
@@ -24,5 +24,7 @@ public class ServiceInitListeners extends AbstractTestUIWithLog {
protected void setup(VaadinRequest request) {
log("Init count: " + TestingServiceInitListener.getInitCount());
log("Request count: " + TestingServiceInitListener.getRequestCount());
+ log("Connector id count: "
+ + TestingServiceInitListener.getConnectorIdCount());
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/applicationservlet/TestingServiceInitListener.java b/uitest/src/main/java/com/vaadin/tests/applicationservlet/TestingServiceInitListener.java
index d0685ad975..d100108c3c 100644
--- a/uitest/src/main/java/com/vaadin/tests/applicationservlet/TestingServiceInitListener.java
+++ b/uitest/src/main/java/com/vaadin/tests/applicationservlet/TestingServiceInitListener.java
@@ -18,6 +18,8 @@ package com.vaadin.tests.applicationservlet;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
+import com.vaadin.server.ConnectorIdGenerationEvent;
+import com.vaadin.server.ConnectorIdGenerator;
import com.vaadin.server.RequestHandler;
import com.vaadin.server.ServiceInitEvent;
import com.vaadin.server.VaadinRequest;
@@ -29,6 +31,7 @@ public class TestingServiceInitListener implements VaadinServiceInitListener {
private static AtomicInteger initCount = new AtomicInteger();
private static AtomicInteger requestCount = new AtomicInteger();
+ private static AtomicInteger connectorIdCount = new AtomicInteger();
@Override
public void serviceInit(ServiceInitEvent event) {
@@ -43,6 +46,15 @@ public class TestingServiceInitListener implements VaadinServiceInitListener {
return false;
}
});
+
+ event.addConnectorIdGenerator(new ConnectorIdGenerator() {
+ @Override
+ public String generateConnectorId(
+ ConnectorIdGenerationEvent event) {
+ connectorIdCount.incrementAndGet();
+ return ConnectorIdGenerator.generateDefaultConnectorId(event);
+ }
+ });
}
public static int getInitCount() {
@@ -53,4 +65,8 @@ public class TestingServiceInitListener implements VaadinServiceInitListener {
return requestCount.get();
}
+ public static int getConnectorIdCount() {
+ return connectorIdCount.get();
+ }
+
}
diff --git a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java
index d97f668967..a23a6f1a1f 100644
--- a/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/applicationservlet/ServiceInitListenersTest.java
@@ -28,6 +28,7 @@ public class ServiceInitListenersTest extends SingleBrowserTest {
Assert.assertNotEquals(getLogRow(0), 0, extractCount(getLogRow(0)));
Assert.assertNotEquals(getLogRow(1), 0, extractCount(getLogRow(1)));
+ Assert.assertNotEquals(getLogRow(2), 0, extractCount(getLogRow(2)));
}
private int extractCount(String logRow) {