Browse Source

Introduce servlet container tests from Vaadin 8 (#11128)

tags/7.7.15
Teemu Suo-Anttila 5 years ago
parent
commit
38aedc9222
No account linked to committer's email address
70 changed files with 3718 additions and 46 deletions
  1. 1
    1
      .gitignore
  2. 0
    1
      test/addon-using-init-param-widget-set/pom.xml
  3. 86
    9
      test/pom.xml
  4. 33
    0
      test/servlet-containers/generic-tests/pom.xml
  5. 146
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractIntegrationTest.java
  6. 30
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractServletIntegrationTest.java
  7. 26
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationDefaultPushIT.java
  8. 25
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationIT.java
  9. 26
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationLongPollingIT.java
  10. 26
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationStreamingIT.java
  11. 57
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationTests.java
  12. 125
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/push/LongPollingProxyServerIT.java
  13. 79
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/ServletIntegrationWebsocketIT.java
  14. 47
    0
      test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/jsr356/ServletIntegrationJSR356WebsocketIT.java
  15. 27
    0
      test/servlet-containers/generic-ui/pom.xml
  16. 58
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/IntegrationTestUIProvider.java
  17. 18
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/JSR356Servlet.java
  18. 14
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/ServerIntegrationTestServlet.java
  19. 29
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationDefaultPushUI.java
  20. 30
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationLongPollingUI.java
  21. 30
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationStreamingUI.java
  22. 83
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationUI.java
  23. 48
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationWebsocketUI.java
  24. 226
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/AbstractTestUI.java
  25. 146
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPush.java
  26. 34
    0
      test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPushLongPolling.java
  27. BIN
      test/servlet-containers/generic-ui/src/main/resources/VAADIN/themes/valo/fi.gif
  28. BIN
      test/servlet-containers/generic-ui/src/main/resources/VAADIN/themes/valo/se.gif
  29. 1
    0
      test/servlet-containers/generic-ui/src/main/resources/com/vaadin/tests/integration/LabelFromDesign.html
  30. 1
    0
      test/servlet-containers/generic/.gitignore
  31. 8
    0
      test/servlet-containers/generic/build.properties
  32. 52
    0
      test/servlet-containers/generic/build.xml
  33. 18
    0
      test/servlet-containers/generic/common.xml
  34. 144
    0
      test/servlet-containers/generic/integration_base_files/base.xml
  35. 26
    0
      test/servlet-containers/generic/integration_base_files/cleanup.sh
  36. 21
    0
      test/servlet-containers/generic/integration_base_files/lock_age.sh
  37. 339
    0
      test/servlet-containers/generic/integration_tests.xml
  38. 24
    0
      test/servlet-containers/generic/ivy-taskdefs.xml
  39. 130
    0
      test/servlet-containers/generic/ivy.xml
  40. 75
    0
      test/servlet-containers/generic/ivysettings.xml
  41. 97
    0
      test/servlet-containers/generic/pom.xml
  42. BIN
      test/servlet-containers/generic/reference-screenshots/finland-phantomjs.png
  43. BIN
      test/servlet-containers/generic/reference-screenshots/initial-phantomjs.png
  44. 7
    0
      test/servlet-containers/generic/src/main/jboss-6/WEB-INF/jboss-web.xml
  45. 64
    0
      test/servlet-containers/glassfish/pom.xml
  46. 73
    0
      test/servlet-containers/jetty8/pom.xml
  47. 43
    0
      test/servlet-containers/jetty9/pom.xml
  48. 27
    0
      test/servlet-containers/jsp-integration/pom.xml
  49. 28
    0
      test/servlet-containers/jsp-integration/src/main/java/com/vaadin/tests/integration/AnotherTrivialUI.java
  50. 28
    0
      test/servlet-containers/jsp-integration/src/main/java/com/vaadin/tests/integration/TrivialUI.java
  51. 57
    0
      test/servlet-containers/jsp-integration/src/main/webapp/WEB-INF/web.xml
  52. 54
    0
      test/servlet-containers/jsp-integration/src/main/webapp/staticfiles/vaadinsessions.jsp
  53. 90
    0
      test/servlet-containers/jsp-integration/src/test/java/com/vaadin/tests/integration/JSPIntegrationIT.java
  54. 54
    0
      test/servlet-containers/liberty-javaee/pom.xml
  55. 54
    0
      test/servlet-containers/liberty-webprofile/pom.xml
  56. 277
    0
      test/servlet-containers/pom.xml
  57. BIN
      test/servlet-containers/screenshots/finland-phantomjs.png
  58. BIN
      test/servlet-containers/screenshots/initial-phantomjs.png
  59. 53
    0
      test/servlet-containers/tomcat7/pom.xml
  60. 53
    0
      test/servlet-containers/tomcat80/pom.xml
  61. 53
    0
      test/servlet-containers/tomcat85/pom.xml
  62. 53
    0
      test/servlet-containers/tomcat9/pom.xml
  63. 43
    0
      test/servlet-containers/wildfly10/pom.xml
  64. 43
    0
      test/servlet-containers/wildfly11/pom.xml
  65. 43
    0
      test/servlet-containers/wildfly12/pom.xml
  66. 43
    0
      test/servlet-containers/wildfly13/pom.xml
  67. 43
    0
      test/servlet-containers/wildfly8/pom.xml
  68. 43
    0
      test/servlet-containers/wildfly9/pom.xml
  69. 6
    1
      test/widget-set-testutil/src/test/java/com/vaadin/test/defaultwidgetset/AbstractWidgetSetIT.java
  70. 0
    34
      uitest/vaadin-server.xml

+ 1
- 1
.gitignore View File

@@ -61,4 +61,4 @@ phantomjsdriver.log
.idea

*/.checkstyle
error-screenshots

+ 0
- 1
test/addon-using-init-param-widget-set/pom.xml View File

@@ -32,7 +32,6 @@
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${project.version}</version>
</dependency>

</dependencies>

+ 86
- 9
test/pom.xml View File

@@ -2,16 +2,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-root</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test</artifactId>
<version>7.7-SNAPSHOT</version>
<name>vaadin-test</name>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jetty.version>9.3.7.v20160115</jetty.version>
<phantomjs.version>2.1.1</phantomjs.version>
<testbench.version>4.2.2</testbench.version>
<testbench.api.version>7.7.14</testbench.api.version>
<vaadin.version>${project.version}</vaadin.version>
<vaadin.maven.version>${vaadin.version}</vaadin.maven.version>
</properties>

<repositories>
@@ -19,8 +24,61 @@
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench-api</artifactId>
<version>${testbench.api.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>

<!-- API DEPENDENCIES -->
@@ -28,12 +86,10 @@
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Servlet 3.0 API -->
@@ -49,7 +105,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -61,7 +116,7 @@
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench</artifactId>
<version>4.0.3</version>
<version>${testbench.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -75,9 +130,24 @@
<module>addon-using-init-param-widget-set</module>
<module>space in directory</module>
<module>vaadinservletconfiguration-widget-set</module>
<module>servlet-containers</module>
</modules>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.maven.version}</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
@@ -111,6 +181,7 @@
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>0.7</version>
<executions>
<execution>
<goals>
@@ -125,9 +196,11 @@

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<executions>
<execution>
<goals>
@@ -139,7 +212,11 @@
<configuration>
<systemPropertyVariables>
<phantomjs.binary.path>${phantomjs.binary}</phantomjs.binary.path>
<server-name>${server.name}</server-name>
<com.vaadin.testbench.Parameters.screenshotReferenceDirectory>${reference.directory}</com.vaadin.testbench.Parameters.screenshotReferenceDirectory>
<com.vaadin.testbench.Parameters.screenshotErrorDirectory>target/error-screenshots</com.vaadin.testbench.Parameters.screenshotErrorDirectory>
</systemPropertyVariables>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>

+ 33
- 0
test/servlet-containers/generic-tests/pom.xml View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-server-tests</artifactId>
<name>vaadin-test-server-tests</name>
<packaging>jar</packaging>
<properties>
<jetty.skip>true</jetty.skip>
</properties>

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
</project>

+ 146
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractIntegrationTest.java View File

@@ -0,0 +1,146 @@
package com.vaadin.tests.integration;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.logging.Logger;

import javax.imageio.ImageIO;

import com.google.common.base.Predicate;
import com.vaadin.testbench.By;
import org.junit.After;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;

import com.vaadin.testbench.annotations.RunLocally;
import com.vaadin.testbench.elements.UIElement;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.testbench.parallel.ParallelRunner;
import com.vaadin.testbench.parallel.ParallelTest;
import com.vaadin.testbench.parallel.TestNameSuffix;
import com.vaadin.testbench.screenshot.ImageFileUtil;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

@RunLocally(Browser.PHANTOMJS)
@RunWith(ParallelRunner.class)
@TestNameSuffix(property = "server-name")
public abstract class AbstractIntegrationTest extends ParallelTest {

/**
* Height of the screenshots we want to capture
*/
private static final int SCREENSHOT_HEIGHT = 850;

/**
* Width of the screenshots we want to capture
*/
private static final int SCREENSHOT_WIDTH = 1500;

private boolean screenshotErrors;

@Override
public void setup() throws Exception {
super.setup();

testBench().resizeViewPortTo(SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);

openTestURL(getParameters());
}

protected void openTestURL(String[] parameters) {
StringBuilder builder = new StringBuilder();
builder.append(getDeploymentURL()).append(getContextPath()).append(getTestPath());
builder.append("?");
for (int i = 0; i < parameters.length; ++i) {
builder.append(parameters[i]);
if (i < parameters.length - 1) {
builder.append("&");
}
}

driver.get(builder.toString());

if (!isElementPresent(UIElement.class)) {
waitUntil(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver webDriver) {
return isElementPresent(UIElement.class);
}
});
}
}

protected String[] getParameters() {
return new String[]{ "restartApplication" };
}

/**
* Returns a path where the test UI is found.
*
* @return path for test
*/
protected abstract String getTestPath();

private String getDeploymentURL() {
String deploymentUrl = System.getProperty("deployment.url");
if (deploymentUrl == null || deploymentUrl.isEmpty()) {
// Default to http://localhost:8080
return "http://localhost:8080";
}
return deploymentUrl;
}

protected void compareScreen(String identifier) throws IOException {
String refFileName = identifier + "-"
+ getDesiredCapabilities().getBrowserName().toLowerCase(Locale.ROOT)
+ ".png";
String errorFileName = identifier + "-"
+ getDesiredCapabilities().getBrowserName().toLowerCase(Locale.ROOT) + "-"
+ System.getProperty("server-name") + "["
+ getClass().getSimpleName() + "].png";
File referenceFile = ImageFileUtil
.getReferenceScreenshotFile(refFileName);
try {
BufferedImage reference = ImageIO.read(referenceFile);
if (testBench().compareScreen(reference, errorFileName)) {
return;
}
} catch (IOException e) {
Logger.getLogger(getClass().getName()).warning(
"Missing screenshot reference: " + referenceFile.getPath());
}
screenshotErrors = true;
}

@After
public void teardown() {
if (screenshotErrors) {
throw new RuntimeException("Screenshots failed.");
}
}

/**
* Returns the deployment context path with a leading slash. If not provided
* through {@code deployment.context.path} system property, will default to
* {@code /demo}.
*
* @return deployment context path
*/
protected String getContextPath() {
String contextPath = System.getProperty("deployment.context.path");
if (contextPath == null || contextPath.isEmpty()) {
// Default to /demo
return "/demo";
}
return contextPath;
}

protected void waitUntil(ExpectedCondition<Boolean> condition) {
new WebDriverWait(driver, 10).until(condition);
}
}

+ 30
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/AbstractServletIntegrationTest.java View File

@@ -0,0 +1,30 @@
package com.vaadin.tests.integration;

import org.junit.Assert;
import org.junit.Test;

import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.LabelElement;

public abstract class AbstractServletIntegrationTest
extends AbstractIntegrationTest {

@Test
public void runTest() throws Exception {
// Test initial state
GridElement grid = $(GridElement.class).first();
Assert.assertFalse("Row should not be initially selected",
grid.getRow(0).isSelected());
compareScreen("initial");

// Test selection and side effects
grid.getCell(0, 1).click();
Assert.assertTrue("Row should be selected on click",
grid.getRow(0).isSelected());
Assert.assertEquals("Text label should contain 'FI'", "FI",
$(LabelElement.class).first().getText());
compareScreen("finland");

}

}

+ 26
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationDefaultPushIT.java View File

@@ -0,0 +1,26 @@
/*
* Copyright 2000-2018 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.integration;

public class ServletIntegrationDefaultPushIT
extends AbstractServletIntegrationTest {
// Uses the test method declared in the super class

@Override
protected String getTestPath() {
return "/run/ServletIntegrationDefaultPushUI";
}
}

+ 25
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationIT.java View File

@@ -0,0 +1,25 @@
/*
* Copyright 2000-2018 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.integration;

public class ServletIntegrationIT extends AbstractServletIntegrationTest {
// Uses the test method declared in the super class

@Override
protected String getTestPath() {
return "/run/ServletIntegrationUI";
}
}

+ 26
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationLongPollingIT.java View File

@@ -0,0 +1,26 @@
/*
* Copyright 2000-2018 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.integration;

public class ServletIntegrationLongPollingIT
extends AbstractServletIntegrationTest {
// Uses the test method declared in the super class

@Override
protected String getTestPath() {
return "/run/ServletIntegrationLongPollingUI";
}
}

+ 26
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationStreamingIT.java View File

@@ -0,0 +1,26 @@
/*
* Copyright 2000-2018 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.integration;

public class ServletIntegrationStreamingIT
extends AbstractServletIntegrationTest {
// Uses the test method declared in the super class

@Override
protected String getTestPath() {
return "/run/ServletIntegrationStreamingUI";
}
}

+ 57
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/ServletIntegrationTests.java View File

@@ -0,0 +1,57 @@
package com.vaadin.tests.integration;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.junit.runner.RunWith;
import org.junit.runners.model.InitializationError;

import com.vaadin.testbench.parallel.ParallelTestSuite;
import com.vaadin.tests.integration.ServletIntegrationTests.ServletIntegrationTestSuite;

@RunWith(ServletIntegrationTestSuite.class)
public class ServletIntegrationTests {

public static Set<String> notJSR356Compatible = new HashSet<String>();
public static Set<String> notWebsocketCompatible = new HashSet<String>();

static {
notWebsocketCompatible.add("tomcat7apacheproxy");
notWebsocketCompatible.add("weblogic10");
notWebsocketCompatible.add("wildfly9-nginx");

notJSR356Compatible.add("jetty8");
notJSR356Compatible.add("tomcat7");
}

public static class ServletIntegrationTestSuite extends ParallelTestSuite {

public ServletIntegrationTestSuite(Class<?> klass)
throws InitializationError, IOException {
super(klass, AbstractIntegrationTest.class,
"com.vaadin.tests.integration", getIgnoredPackages());
}

private static String[] getIgnoredPackages() {
List<String> ignoredPackages = new ArrayList<String>();
String serverName = System.getProperty("server-name");
if (serverName == null) {
serverName = "";
}
if (!serverName.equals("widfly9-nginx")) {
ignoredPackages.add("com.vaadin.tests.integration.push");
}
if (notWebsocketCompatible.contains(serverName)) {
ignoredPackages.add("com.vaadin.tests.integration.websocket");
} else if (notJSR356Compatible.contains(serverName)) {
ignoredPackages
.add("com.vaadin.tests.integration.websocket.jsr356");
}

return ignoredPackages.toArray(new String[ignoredPackages.size()]);
}
}
}

+ 125
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/push/LongPollingProxyServerIT.java View File

@@ -0,0 +1,125 @@
/*
* Copyright 2000-2018 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.integration.push;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.List;

import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import com.vaadin.tests.integration.AbstractIntegrationTest;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

@RunWith(Parameterized.class)
public class LongPollingProxyServerIT extends AbstractIntegrationTest {

@Parameters(name = "{0}")
public static List<String[]> getTestParameters() {
List<String[]> parameters = new ArrayList<String[]>();
addTestParams(parameters, "Buffering+Timeout", "buffering-timeout");
addTestParams(parameters, "NonBuffering+Timeout",
"nonbuffering-timeout");
addTestParams(parameters, "Buffering", "buffering");
addTestParams(parameters, "NonBuffering", "nonbuffering");
return parameters;
}

private static void addTestParams(List<String[]> parameters,
String... pair) {
parameters.add(pair);
}

@Parameter(0)
public String name;

@Parameter(1)
public String path;

@Override
@Before
public void setup() throws Exception {
Assume.assumeTrue(
"wildfly9-nginx".equals(System.getProperty("server-name")));

super.setup();
}

@Test
public void actionAfterFirstTimeout() throws Exception {
// The wildfly9-nginx server has a configured timeout of 10s for
// *-timeout urls
Thread.sleep(15000);
assertEquals(0, getClientCounter());
getIncrementButton().click();
assertEquals(1, getClientCounter());
}

@Test
public void basicPush() {
assertEquals(0, getServerCounter());
getServerCounterStartButton().click();
waitUntil(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver webDriver) {
return getServerCounter() > 1;
}
});
}

@Override
protected String getContextPath() {
// Prefix with the context path with the parameter
return "/" + path + super.getContextPath();
}

@Override
protected String getTestPath() {
return "/";
}

private int getClientCounter() {
WebElement clientCounterElem = findElement(
By.id(BasicPush.CLIENT_COUNTER_ID));
return Integer.parseInt(clientCounterElem.getText());
}

private int getServerCounter() {
WebElement serverCounterElem = findElement(
By.id(BasicPush.SERVER_COUNTER_ID));
return Integer.parseInt(serverCounterElem.getText());
}

private WebElement getServerCounterStartButton() {
return findElement(By.id(BasicPush.START_TIMER_ID));
}

private WebElement getIncrementButton() {
return findElement(By.id(BasicPush.INCREMENT_BUTTON_ID));
}
}

+ 79
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/ServletIntegrationWebsocketIT.java View File

@@ -0,0 +1,79 @@
/*
* Copyright 2000-2018 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.integration.websocket;

import static org.junit.Assert.assertEquals;

import java.util.*;

import org.junit.Assume;
import org.junit.Test;
import org.openqa.selenium.WebElement;

import com.vaadin.testbench.By;
import com.vaadin.tests.integration.AbstractServletIntegrationTest;

public class ServletIntegrationWebsocketIT
extends AbstractServletIntegrationTest {
// Uses the test method declared in the super class

private static final Set<String> nonWebsocketServers = new HashSet<String>();

static {
nonWebsocketServers.add("liberty-microprofile");
}

@Override
public void setup() throws Exception {
Assume.assumeFalse("This server does not support Websockets",
nonWebsocketServers
.contains(System.getProperty("server-name")));

super.setup();
}

@Override
protected String getTestPath() {
return "/run/ServletIntegrationWebsocketUI";
}

@Test
public void testWebsockedUsed() {
List<String> params = new ArrayList<String>();
for (String param : getParameters()) {
params.add(param);
}
params.add("debug");

// Reopen the page with debug window
openTestURL(params.toArray(new String[params.size()]));

// Make sure the correct debug window tab is open.
findElements(By.className("v-debugwindow-tab")).get(1).click();

try {
// Wait to make sure correct tab is shown.
Thread.sleep(1000);
} catch (InterruptedException e) {
}

WebElement row = findElements(By.className("v-debugwindow-row")).get(7);
assertEquals("Communication method",
row.findElement(By.className("caption")).getAttribute("innerText"));
assertEquals("Client to server: websocket, server to client: websocket",
row.findElement(By.className("value")).getAttribute("innerText"));
}
}

+ 47
- 0
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/jsr356/ServletIntegrationJSR356WebsocketIT.java View File

@@ -0,0 +1,47 @@
/*
* Copyright 2000-2018 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.integration.websocket.jsr356;

import java.util.HashSet;
import java.util.Set;

import org.junit.Assume;

import com.vaadin.tests.integration.websocket.ServletIntegrationWebsocketIT;

public class ServletIntegrationJSR356WebsocketIT
extends ServletIntegrationWebsocketIT {
// Uses the test method declared in the super class

private static final Set<String> nonJSR356Servers = new HashSet<String>();

static {
nonJSR356Servers.add("jetty8");
}

@Override
public void setup() throws Exception {
Assume.assumeFalse("This server does not support JSR356",
nonJSR356Servers.contains(System.getProperty("server-name")));

super.setup();
}

@Override
protected String getTestPath() {
return super.getTestPath().replace("/run/", "/run-jsr356/");
}
}

+ 27
- 0
test/servlet-containers/generic-ui/pom.xml View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-server-ui</artifactId>
<name>vaadin-test-server-ui</name>
<packaging>jar</packaging>
<properties>
<jetty.skip>true</jetty.skip>
</properties>

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
</dependencies>
</project>

+ 58
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/IntegrationTestUIProvider.java View File

@@ -0,0 +1,58 @@
package com.vaadin.tests;

import com.vaadin.server.UIClassSelectionEvent;
import com.vaadin.server.UIProvider;
import com.vaadin.tests.integration.push.BasicPush;
import com.vaadin.ui.UI;

public class IntegrationTestUIProvider extends UIProvider {

public static final String[] defaultPackages = {
"com.vaadin.tests.integration",
"com.vaadin.tests.integration.push" };

@Override
public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {
Class<? extends UI> uiClass = findUIClassFromPath(event);
return uiClass != null ? uiClass : BasicPush.class;
}

private Class<? extends UI> findUIClassFromPath(
UIClassSelectionEvent event) {
String pathInfo = event.getRequest().getPathInfo();
if (pathInfo != null) {
String className = pathInfo.substring(1);
if (className.startsWith("run/")) {
className = className.substring(4);
}

if (className.contains(".")) {
return getUIClass(className);
} else {
return getUIClassFromDefaultPackage(className);
}
}
return null;
}

private Class<? extends UI> getUIClassFromDefaultPackage(String className) {
for (String pkgName : defaultPackages) {
Class<? extends UI> uiClass = getUIClass(pkgName + "." + className);
if (uiClass != null) {
return uiClass;
}
}
return null;
}

private Class<? extends UI> getUIClass(String className) {
try {
Class<?> loadClass = getClass().getClassLoader()
.loadClass(className.replace("/", "."));
return (Class<? extends UI>) loadClass;
} catch (ClassNotFoundException e) {
return null;
}
}

}

+ 18
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/JSR356Servlet.java View File

@@ -0,0 +1,18 @@
package com.vaadin.tests;

import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinServlet;
import com.vaadin.tests.integration.ServletIntegrationWebsocketUI;

import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;

/**
* Created by elmot on 06-02-2017.
*/
@WebServlet(urlPatterns = "/run-jsr356/*", name = "IntegrationUIProvider-Jsr356", asyncSupported = false, initParams = {
@WebInitParam(name = "org.atmosphere.cpr.asyncSupport", value = "org.atmosphere.container.JSR356AsyncSupport")})
@VaadinServletConfiguration(ui = ServletIntegrationWebsocketUI.class, productionMode = false)
public class JSR356Servlet extends VaadinServlet {

}

+ 14
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/ServerIntegrationTestServlet.java View File

@@ -0,0 +1,14 @@
package com.vaadin.tests;

import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinServlet;
import com.vaadin.tests.integration.ServletIntegrationUI;

import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;

@WebServlet(urlPatterns = "/*" ,name = "IntegrationTestUIProvider", asyncSupported = true, initParams = {
@WebInitParam(name = "UIProvider", value = "com.vaadin.tests.IntegrationTestUIProvider")})
@VaadinServletConfiguration(ui = ServletIntegrationUI.class, productionMode = false)
public class ServerIntegrationTestServlet extends VaadinServlet {
}

+ 29
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationDefaultPushUI.java View File

@@ -0,0 +1,29 @@
/*
* Copyright 2000-2018 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.integration;

import com.vaadin.annotations.Push;

/**
* Server test which uses the default push mechanisms
*
* @since 7.1.12
* @author Vaadin Ltd
*/
@Push
public class ServletIntegrationDefaultPushUI extends ServletIntegrationUI {

}

+ 30
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationLongPollingUI.java View File

@@ -0,0 +1,30 @@
/*
* Copyright 2000-2018 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.integration;

import com.vaadin.annotations.Push;
import com.vaadin.shared.ui.ui.Transport;

/**
* Server test which uses long polling
*
* @since 7.1
* @author Vaadin Ltd
*/
@Push(transport = Transport.LONG_POLLING)
public class ServletIntegrationLongPollingUI extends ServletIntegrationUI {

}

+ 30
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationStreamingUI.java View File

@@ -0,0 +1,30 @@
/*
* Copyright 2000-2018 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.integration;

import com.vaadin.annotations.Push;
import com.vaadin.shared.ui.ui.Transport;

/**
* Server test which uses streaming
*
* @since 7.1
* @author Vaadin Ltd
*/
@Push(transport = Transport.STREAMING)
public class ServletIntegrationStreamingUI extends ServletIntegrationUI {

}

+ 83
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationUI.java View File

@@ -0,0 +1,83 @@
package com.vaadin.tests.integration;

import com.vaadin.annotations.DesignRoot;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Widgetset;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.event.SelectionEvent;
import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import com.vaadin.ui.declarative.Design;
import com.vaadin.ui.renderers.ImageRenderer;

import java.util.Iterator;

@Widgetset("com.vaadin.DefaultWidgetSet")
@Theme("valo")
public class ServletIntegrationUI extends UI {

public static class Country {
private final String name;
private final String id;
private final Resource icon;

public Country(String name, String id, Resource icon) {
this.name = name;
this.id = id;
this.icon = icon;
}

public String getName() {
return name;
}

public String getId() {
return id;
}

public Resource getIcon() {
return icon;
}
}

@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);

final BeanItemContainer<Country> container = new BeanItemContainer<Country>(Country.class);
final Grid grid = new Grid(container);
// TODO ImageRenderer does not support ClassResource
grid.getColumn("icon").setWidth(50).setHeaderCaption("").setRenderer(new ImageRenderer());
grid.getColumn("name").setWidth(100).setHeaderCaption("Country");
grid.setColumns("icon", "name");
container.addBean(new Country("Finland", "FI", new ThemeResource("fi.gif")));
container.addBean(new Country("Sweden", "SE", new ThemeResource("se.gif")));
grid.setHeight("200px");
grid.setWidth("200px");
layout.addComponent(grid);

final Label selectedLabel = new LabelFromDesign();
grid.addSelectionListener(new SelectionEvent.SelectionListener() {
public void select(SelectionEvent selectionEvent) {
Iterator<Object> iterator = selectionEvent.getSelected().iterator();
if (iterator.hasNext()) {
selectedLabel.setValue(container.getItem(iterator.next()).getBean().getId());
} else {
selectedLabel.setValue("");
}
}
});
layout.addComponent(selectedLabel);
}

@DesignRoot
public static class LabelFromDesign extends Label {
public LabelFromDesign() {
Design.read(this);
}
}
}

+ 48
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/ServletIntegrationWebsocketUI.java View File

@@ -0,0 +1,48 @@
/*
* Copyright 2000-2018 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.integration;

import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.Transport;
import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;

/**
* Server test which uses websockets
*
* @since 7.1
* @author Vaadin Ltd
*/
@Push(transport = Transport.WEBSOCKET)
public class ServletIntegrationWebsocketUI extends ServletIntegrationUI {

/*
* (non-Javadoc)
*
* @see
* com.vaadin.tests.integration.IntegrationTestUI#init(com.vaadin.server
* .VaadinRequest)
*/
@Override
protected void init(VaadinRequest request) {
super.init(request);
// Ensure no fallback is used
getPushConfiguration().setParameter(
PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");

}

}

+ 226
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/AbstractTestUI.java View File

@@ -0,0 +1,226 @@
package com.vaadin.tests.integration.push;

import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.server.WebBrowser;
import com.vaadin.shared.communication.PushMode;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.shared.ui.ui.Transport;
import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.PushConfiguration;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

import java.io.File;

public abstract class AbstractTestUI extends UI {

@Override
public void init(VaadinRequest request) {
getPage().setTitle(getClass().getName());

Label label = new Label(getTestDescription(), ContentMode.HTML);
label.setWidth("100%");

VerticalLayout rootLayout = new VerticalLayout();
rootLayout.setSpacing(false);
setContent(rootLayout);

layout = new VerticalLayout();
layout.setSpacing(false);
layout.setMargin(false);

rootLayout.addComponent(label);
rootLayout.addComponent(layout);
((VerticalLayout) getContent()).setExpandRatio(layout, 1);

warnIfWidgetsetMaybeNotCompiled();

setTransport(request);

setup(request);
}

protected void warnIfWidgetsetMaybeNotCompiled() {
// Can't check location if sendUrlAsParameters is disabled
if (!getSession().getConfiguration().isSendUrlsAsParameters()) {
return;
}

// Ignore if using debug mode
String query = getPage().getLocation().getQuery();
if (query != null && query.matches(".*[&?]gwt\\.codesvr.*")) {
return;
}

// Find out the widgetset of this UI based on @Widgetset annotation
Class<?> currentType = getClass();
String usedWidgetset = VaadinServlet.DEFAULT_WIDGETSET;
while (currentType != Object.class) {
Widgetset annotation = currentType.getAnnotation(Widgetset.class);
if (annotation != null) {
usedWidgetset = annotation.value();
break;
} else {
currentType = currentType.getSuperclass();
}
}

// Assuming the same folder structure as in git repo
// Assuming project root is the working dir of this process
File widgetsetsFolder = new File("WebContent/VAADIN/widgetsets");
if (!widgetsetsFolder.isDirectory()) {
return;
}

// Find the most newly compiled widgetset
long newestWidgetsetTimestamp = -1;
String newestWidgetsetName = null;
File[] children = widgetsetsFolder.listFiles();
for (File child : children) {
if (!child.isDirectory() || child.getName().equals("WEB-INF")) {
continue;
}
long lastModified = child.lastModified();
if (lastModified > newestWidgetsetTimestamp) {
newestWidgetsetTimestamp = lastModified;
newestWidgetsetName = child.getName();
}
}

// Compare to currently used widgetset, with a 30 minute grace period
File currentWidgetsetFolder = new File(widgetsetsFolder, usedWidgetset);
long currentWidgetsetTimestamp = currentWidgetsetFolder.lastModified();
int halfHour = 30 * 60 * 1000;
if (currentWidgetsetTimestamp + halfHour < newestWidgetsetTimestamp) {
Notification.show(
"The currently used widgetset (" + usedWidgetset
+ ") was compiled long before the most recently compiled one ("
+ newestWidgetsetName
+ "). Are you sure you have compiled the right widgetset?",
Type.WARNING_MESSAGE);
}
}

/**
* Sets the push transport according to the transport= URL parameter if such
* is given. Supports transport=xhr (disables push), transport=websocket
* (forces websocket into use), transport=streaming (forces streaming into
* use). Using ?transport=xyz disables the fallback transport.
*
* @param request
* The UI init request
*/
protected void setTransport(VaadinRequest request) {
String transport = request.getParameter("transport");
PushConfiguration config = getPushConfiguration();

if ("xhr".equals(transport)) {
config.setPushMode(PushMode.DISABLED);
} else if ("websocket".equals(transport)) {
enablePush(Transport.WEBSOCKET);
} else if ("websocket-xhr".equals(transport)) {
enablePush(Transport.WEBSOCKET_XHR);
} else if ("streaming".equals(transport)) {
enablePush(Transport.STREAMING);
} else if ("long-polling".equals(transport)) {
enablePush(Transport.LONG_POLLING);
} else if (transport != null) {
throw new IllegalArgumentException("Unknown transport value '"
+ transport
+ "'. Supported are xhr,websocket,streaming,long-polling");
}
}

protected void enablePush(Transport transport) {
PushConfiguration config = getPushConfiguration();
if (!config.getPushMode().isEnabled()) {
config.setPushMode(PushMode.AUTOMATIC);
}
config.setTransport(transport);
// Ensure no fallback is used
getPushConfiguration().setParameter(
PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
}

/**
* This method is inherited from the super class, but it should generally
* not be used. If you want to just add components to your test, use e.g.
* {@link #addComponent(Component)} instead to add the component to the
* layout used by this UI. If you don't want to use the top-level layout
* used by this class, you instead inherit directly from UI.
*
* @deprecated Use {@link #addComponent(Component)} or inherit from UI
* instead.
*/
@Override
@Deprecated
public void setContent(Component content) {
// Overridden just to deprecate
super.setContent(content);
}

private VerticalLayout layout;

protected VerticalLayout getLayout() {
return layout;
}

protected abstract void setup(VaadinRequest request);

public void addComponent(Component c) {
getLayout().addComponent(c);
}

public void addComponents(Component... c) {
getLayout().addComponents(c);
}

public void removeComponent(Component c) {
getLayout().removeComponent(c);
}

public void replaceComponent(Component oldComponent,
Component newComponent) {
getLayout().replaceComponent(oldComponent, newComponent);
}

protected void addButton(String caption, Button.ClickListener listener) {
Button button = new Button(caption);
button.addClickListener(listener);
addComponent(button);
}

protected String getTestDescription() {
return null;
};

protected Integer getTicketNumber() {
return null;
};

protected WebBrowser getBrowser() {
return getSession().getBrowser();
}

/**
* Execute the provided runnable on the UI thread as soon as the current
* request has been sent.
*/
protected void runAfterResponse(final Runnable runnable) {
// Immediately start a thread that will start waiting for the session to
// get unlocked.
new Thread() {
@Override
public void run() {
accessSynchronously(runnable);
}
}.start();
}
}

+ 146
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPush.java View File

@@ -0,0 +1,146 @@
/*
* Copyright 2000-2018 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.integration.push;

import java.util.Timer;
import java.util.TimerTask;

import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;

@Push
public class BasicPush extends AbstractTestUI {

public static final String CLIENT_COUNTER_ID = "clientCounter";

public static final String STOP_TIMER_ID = "stopTimer";

public static final String START_TIMER_ID = "startTimer";

public static final String SERVER_COUNTER_ID = "serverCounter";

public static final String INCREMENT_BUTTON_ID = "incrementCounter";

private int clientCounter = 0;
private int serverCounter = 0;
private final Timer timer = new Timer(true);

private TimerTask task;

@Override
protected void setup(VaadinRequest request) {
getReconnectDialogConfiguration().setDialogModal(false);
spacer();

/*
* Client initiated push.
*/
final Label lbl = new Label("0");
lbl.setCaption("Client counter (click 'increment' to update):");
lbl.setId(CLIENT_COUNTER_ID);
addComponent(lbl);

Button incrementButton = new Button("Increment",
new Button.ClickListener() {
public void buttonClick(Button.ClickEvent clickEvent) {
clientCounter++;
lbl.setValue(String.valueOf(clientCounter));
}
});
incrementButton.setId(INCREMENT_BUTTON_ID);
addComponent(incrementButton);

spacer();

/*
* Server initiated push.
*/
final Label serverCounterLabel = new Label("0");
serverCounterLabel.setCaption(
"Server counter (updates each 3s by server thread) :");
serverCounterLabel.setId(SERVER_COUNTER_ID);
addComponent(serverCounterLabel);

Button startTimer = new Button("Start timer", new Button.ClickListener() {

public void buttonClick(Button.ClickEvent clickEvent) {
serverCounter = 0;
serverCounterLabel.setValue(String.valueOf(serverCounter));
if (task != null) {
task.cancel();
}
task = new TimerTask() {

@Override
public void run() {
access(new Runnable() {
public void run() {
serverCounter++;
serverCounterLabel
.setValue(String.valueOf(serverCounter));
}
});
}
};
timer.scheduleAtFixedRate(task, 3000, 3000);
}
});
startTimer.setId(START_TIMER_ID);
addComponent(startTimer);

Button stopTimer = new Button("Stop timer", new Button.ClickListener() {
public void buttonClick(Button.ClickEvent clickEvent) {
if (task != null) {
task.cancel();
task = null;
}
}
});
stopTimer.setId(STOP_TIMER_ID);
addComponent(stopTimer);
}

@Override
protected String getTestDescription() {
return "This test tests the very basic operations of push. "
+ "It tests that client initiated changes are "
+ "recieved back to the client as well as server "
+ "initiated changes are correctly updated to the client.";
}

@Override
protected Integer getTicketNumber() {
return 11494;
}

private void spacer() {
addComponent(new Label("<hr/>", ContentMode.HTML));
}

@Override
public void attach() {
super.attach();
}

@Override
public void detach() {
super.detach();
timer.cancel();
}
}

+ 34
- 0
test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPushLongPolling.java View File

@@ -0,0 +1,34 @@
/*
* Copyright 2000-2018 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.integration.push;

import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.Transport;
import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;

@Push(transport = Transport.LONG_POLLING)
public class BasicPushLongPolling extends BasicPush {

@Override
public void init(VaadinRequest request) {
super.init(request);
// Don't use fallback so we can easier detect if long polling fails
getPushConfiguration().setParameter(
PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
}

}

BIN
test/servlet-containers/generic-ui/src/main/resources/VAADIN/themes/valo/fi.gif View File


BIN
test/servlet-containers/generic-ui/src/main/resources/VAADIN/themes/valo/se.gif View File


+ 1
- 0
test/servlet-containers/generic-ui/src/main/resources/com/vaadin/tests/integration/LabelFromDesign.html View File

@@ -0,0 +1 @@
<vaadin-label />

+ 1
- 0
test/servlet-containers/generic/.gitignore View File

@@ -0,0 +1 @@
result

+ 8
- 0
test/servlet-containers/generic/build.properties View File

@@ -0,0 +1,8 @@
ivy.organisation=com.vaadin
vaadin.vendor=Vaadin Ltd
vaadin.url=http://vaadin.com
vaadin.java.version=1.6
vaadin.version=8.2-SNAPSHOT
vaadin.sass.version=0.9.13
gwt.version=2.7.0.vaadin3
commons-io.version=2.4

+ 52
- 0
test/servlet-containers/generic/build.xml View File

@@ -0,0 +1,52 @@
<?xml version="1.0"?>

<project name="vaadin-uitest" basedir="." default="test-server"
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Provides a uitest WAR containing Vaadin UI tests
</description>
<include file="./common.xml" as="common" />

<!-- global properties -->
<property name="module.name" value="vaadin-test-generic-integration" />
<property name="uitest.dir" location="${common.basedir}" /><!-- todo rename-->
<property name="result.dir" value="result" />
<property name="result.war"
location="${uitest.dir}/target/${module.name}-${vaadin.version}.war" />
<!--todo automate version number -->
<property name="result.jboss6.war"
location="${uitest.dir}/target/${module.name}-8.2-SNAPSHOT-jboss6.war" />

<!-- Need to give a default value to keep Ivy happy -->
<property name="vaadin.build.repository" value="http://maven.vaadin.com/vaadin-prereleases"/>

<target name="clean">
<fail unless="result.dir" message="No result.dir parameter given" />
<delete dir="${result.dir}" />
</target>

<target name="test-server" depends="clean-testbench-errors">
<mkdir dir="${vaadin.basedir}/result" />
<ant antfile="integration_tests.xml"
target="integration-test-all" inheritall="false"
inheritrefs="false">
<property name="demo.war" value="${result.war}" />
<property name="demo.jboss6.war" value="${result.jboss6.war}" />
</ant>
</target>


<target name="clean-testbench-errors"><!--todo remove when have got rid of screenshots-->
<fail unless="com.vaadin.testbench.screenshot.directory"
message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
<mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
<delete>
<fileset
dir="${com.vaadin.testbench.screenshot.directory}/errors">
<include name="*" />
</fileset>
</delete>
</target>


</project>

+ 18
- 0
test/servlet-containers/generic/common.xml View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="common" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">

<tstamp>
<format property="build.date" pattern="yyyy-MM-dd" />
</tstamp>

<dirname property="vaadin.basedir" file="${ant.file.common}/../../../" />
<dirname property="common.basedir" file="${ant.file.common}" />
<property file="${common.basedir}/build.properties" />

<ivy:settings file="${common.basedir}/ivysettings.xml" />
<ivy:settings file="${common.basedir}/ivysettings.xml" id="ivysettings" />
<ivy:resolve log="download-only" file="${common.basedir}/ivy-taskdefs.xml" conf="taskdefs" />
<ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" />
<taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpathref="taskdefs.classpath" />

</project>

+ 144
- 0
test/servlet-containers/generic/integration_base_files/base.xml View File

@@ -0,0 +1,144 @@
<?xml version="1.0"?>
<project name="test" basedir=".">
<property file="deploy.properties" />
<property name="vaadin.major.7" value="1" />
<property name="lock" value="deploy/lock.file" />
<property name="deployDir" value="deploy/${server}" />
<property name="serverPort" value="8080" />
<property name="war" value="demo.war" />
<property name="startupSpawn" value="false" />
<property name="JAVA_HOME" value="/usr/lib/jvm/default-java" />
<property name="waitMinutes" value="3" />
<property name="waitUrl"
value="http://localhost:${serverPort}/demo/VAADIN/themes/valo/styles.css" />
<property name="shutdownWait" value="10" />


<target name="afterDeploy">
<!-- Empty default -->
</target>

<target name="beforeDeploy">
<!-- Empty default -->
</target>

<target name="deploy">
<antcall target="beforeDeploy" />
<echo
message="${server}: Deploying ${war} to ${deployDir}/${autodeployDir}" />
<copy file="${war}" todir="${deployDir}/${autodeployDir}" />
<antcall target="afterDeploy" />
</target>

<target name="deployStatic">
<unzip src="${war}" dest="${staticDeployDir}/tmp-unpack-jar/">
<patternset>
<include name="WEB-INF/lib/*.jar" />
</patternset>
</unzip>
<unzip dest="${staticDeployDir}">
<fileset dir="${staticDeployDir}/tmp-unpack-jar/WEB-INF/lib"
includes="*.jar" />

<patternset>
<include name="VAADIN/**" />
</patternset>
</unzip>
<delete dir="${staticDeployDir}/tmp-unpack-jar/" />

<unzip src="${war}" dest="${staticDeployDir}">
<patternset>
<include name="VAADIN/**" />
</patternset>
</unzip>
</target>

<target name="unpack-server">
<echo message="${server}: Unpacking ${server}.tar.gz" />
<delete dir="${server}" />
<exec executable="tar">
<arg value="-xf" />
<arg value="${server}.tar.gz" />
</exec>
<move file="${server}" tofile="${deployDir}" />
<echo message="Done." />
</target>

<target name="doStartup">
<exec executable="./run.sh" spawn="${startupSpawn}">
<env key="JAVA_HOME" value="${JAVA_HOME}" />
</exec>
</target>

<target name="startup">
<antcall target="doStartup" />
<echo message="${server}: Waiting for ${waitUrl} to become available." />
<waitfor maxwait="${waitMinutes}" maxwaitunit="minute"
checkevery="10000" timeoutproperty="timeout">
<http url="${waitUrl}" />
</waitfor>
<!-- Print load averages to get an indicator on whether the server
still attempts to start up -->
<exec executable="uptime" />
<fail if="timeout" message="${server} failed to deploy" />

<echo message="${server}: Demo deployed successfully." />
</target>

<target name="shutdown">
<exec executable="./stop.sh">
<env key="JAVA_HOME" value="${JAVA_HOME}" />
</exec>
<sleep seconds="${shutdownWait}" />
</target>

<target name="force-shutdown">
<exec executable="./cleanup.sh" />
</target>

<target name="check-port">
<fail
message="${server}: Something is still listening on port ${serverPort}">
<condition>
<socket server="localhost" port="${serverPort}" />
</condition>
</fail>
</target>

<target name="check-lock">
<available file="${lock}" property="lockAvailable" />
<fail unless="lockAvailable" message="Instance is not locked!" />
</target>

<target name="get-lock">
<mkdir dir="deploy" />
<echo>${server}: Getting the lock</echo>
<exec executable="lockfile" failonerror="true">
<!-- Check every 10 seconds -->
<arg value="-10" />
<!-- Retry for 55 minutes (build server gives up after 60 minutes) -->
<arg value="-r330" />
<arg value="${lock}" />
</exec>
<echo>${server}: Got the lock</echo>
</target>

<target name="clean">
<delete dir="${deployDir}" failonerror="false" />
</target>

<target name="release-lock">
<!-- <exec executable="rm"> <arg value="-f" /> <arg value="${lock}"
/> </exec> -->
<delete>
<fileset dir="." includes="${lock}" />
</delete>
<echo>${server}: Released the lock</echo>
</target>

<target name="startup-and-deploy"
depends="check-lock,check-port,unpack-server,deploy,startup" />

<target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock,force-shutdown" />

</project>

+ 26
- 0
test/servlet-containers/generic/integration_base_files/cleanup.sh View File

@@ -0,0 +1,26 @@
#! /bin/bash
echo checking and killing open servers

# Find all java processes, except
# * grep, as we're running it
# * get-lock, as that one is just waiting for this cleanup to happen
# * shutdown-and-cleanup, as that could be the one we're running from
ps x | grep -E bin/java | grep -v grep | grep -v get-lock | grep -v shutdown-and-cleanup | awk '{print $1}' > temp
#Read and kill processes marked to temp
while read line
do
kill -9 $line
done < temp
#Remove temp
rm temp
if [ -a /home/integration/demo.war ]
then
echo removing old demo.war
rm /home/integration/demo.war
fi
echo Cleaning deploy dir
rm -rf /home/integration/deploy/*

+ 21
- 0
test/servlet-containers/generic/integration_base_files/lock_age.sh View File

@@ -0,0 +1,21 @@
#! /bin/bash
if lockfile -r0 -! /home/integration/deploy/lock.file &> /dev/null
then
# If we could not get the lock, check how old the lock file is
DATE=$(date +%s)
# What if the file is not there any more?
LOCK_AGE=$(stat -c %Z /home/integration/deploy/lock.file)

AGE=$[($DATE - $LOCK_AGE)/60]

if [ "$AGE" -gt "20" ]
then
echo lock.file is $AGE min old.
./cleanup.sh
# else
# echo lock.file is $AGE min old.
fi
else
# If we got the lock, do a cleanup (releasing the lock) just in case something has still been left running
./cleanup.sh &> /dev/null
fi

+ 339
- 0
test/servlet-containers/generic/integration_tests.xml View File

@@ -0,0 +1,339 @@
<?xml version="1.0"?>

<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="Vaadin Integration Tests" basedir="." default="integration-test-all">

<!-- Import common targets -->
<import file="common.xml" />
<dirname file="${ant.file.Vaadin Integration Tests}" property="integration_test.dir" />

<!-- Target deploying demo.war -->
<fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" />

<fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run" />
<fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run" />

<!-- Test with these browsers -->
<property name="test_browsers" value="winxp-firefox17-esr" />

<!-- Path to key file. Default value -->
<property name="sshkey.file" value="id_dsa" />

<!-- path and name for demo.war to be deployed -->
<property name="demo.war" value="demo.war" />

<!-- Host running Testbench RC or Testbench Hub. Default value -->
<property name="com.vaadin.testbench.tester.host" value="127.0.0.1" />

<!-- Base url where the testable application is deployed -->
<property name="deployment.url" value="http://${test.integration.server}:8080" />

<!-- TestBench license parameter -->
<property name="vaadin.testbench.developer.license" value="" />

<property name="report.dir" location="${vaadin.basedir}/result/reports-integration" />

<!-- ssh host values -->
<property name="ant.hub" value="${test.integration.antfile}" />
<property name="user" value="${test.integration.user}" />
<property name="passphrase" value="" />

<ivy:resolve file="ivy.xml" conf="build, build-provided" />
<ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
<path id="classpath.tb3">
<path location="target/test-classes" />
<path refid="classpath.tb3.lib" />
<path location="target/classes" />
</path>

<!-- Upload war to deploy to ssh host -->
<target name="integration-test-upload-demo">
<scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" />
</target>

<target name="run-tb3-servlet-test">
<antcall target="run-tb3-test" inheritall="true">
<param name="junit.test.suite" value="com.vaadin.tests.integration.ServletIntegrationTests" />
</antcall>
</target>
<target name="run-tb3-test">
<fail unless="phantomjs.binary.path" message="Define PhantomJS binary using -Dphantomjs.binary.path" />
<fail unless="server-name" message="Server name must be defined in server-name" />
<fail unless="deployment.url" message="Deplyoment url must be defined in deployment.url" />
<fail unless="com.vaadin.testbench.screenshot.directory" message="Screenshot directory must be defined in com.vaadin.testbench.screenshot.directory" />
<property name="server.report.dir" location="${report.dir}/integration-test-tb3/${server-name}" />
<!-- The junit task does not create the report dir... -->
<mkdir dir="${server.report.dir}" />

<junit showoutput="no" printsummary="no" fork="yes">
<formatter type="xml" />
<classpath refid="classpath.tb3" />

<jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
<jvmarg value="-Ddeployment.url=${deployment.url}" />
<jvmarg value="-Dserver-name=${server-name}" />
<jvmarg value="-Djava.awt.headless=true" />
<jvmarg value="-Ddemo.war=${demo.war}" />
<jvmarg value="-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" />
<jvmarg value="-Dphantomjs.binary.path=${phantomjs.binary.path}" />
<test name="${junit.test.suite}" todir="${server.report.dir}" />
</junit>
</target>

<!--
<target name="integration-test-tomcat7">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="tomcat7" />
</antcall>
</target>
-->
<target name="integration-test-tomcat7apacheproxy">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="tomcat7apacheproxy" />
</antcall>
</target>
<!--
<target name="integration-test-tomcat8">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="tomcat8" />
</antcall>
</target>

<target name="integration-test-jetty8">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="90" />
<param name="target-server" value="jetty8" />
</antcall>
</target>
<target name="integration-test-jetty9">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="90" />
<param name="target-server" value="jetty9" />
</antcall>
</target>
-->
<target name="integration-test-jboss-eap6">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="jbosseap6" />
<param name="demo.war" value="${demo.jboss6.war}"/>
</antcall>
</target>
<!--
<target name="integration-test-wildfly8">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="wildfly8" />
</antcall>
</target>
<target name="integration-test-wildfly9">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="wildfly9" />
</antcall>
</target>
<target name="integration-test-wildfly10">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="wildfly10" />
</antcall>
</target>
-->
<target name="integration-test-wildfly9-nginx">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="wildfly9-nginx" />
<param name="target-port" value="80" />
</antcall>
</target>
<!--
<target name="integration-test-glassfish4">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="glassfish4" />
</antcall>
</target>
<target name="integration-test-payara">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="10" />
<param name="target-server" value="payara" />
</antcall>
</target>
-->

<target name="integration-test-weblogic12">
<antcall target="run-generic-integration-test">
<param name="startDelay" value="60" />
<param name="target-port" value="7001" />
<param name="target-server" value="weblogic12" />
</antcall>
</target>


<!-- Upload demo, clean error screenshots and test deployment on all
servers -->
<target name="integration-test-all" unless="tests.integration.skip">
<property name="passphrase" value="${passphrase}" />
<fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
<fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
<delete dir="${report.dir}" />
<mkdir dir="${report.dir}" />

<parallel>
<antcall target="integration-test-weblogic12" />

<!--
<antcall target="integration-test-glassfish4" />
<antcall target="integration-test-payara" />
-->

<antcall target="integration-test-jboss-eap6" />

<!--
<antcall target="integration-test-wildfly8" />
<antcall target="integration-test-wildfly9" />
<antcall target="integration-test-wildfly10" />

<antcall target="integration-test-jetty8" />
<antcall target="integration-test-jetty9" />

<antcall target="integration-test-tomcat7" />
<antcall target="integration-test-tomcat8" />
-->
<antcall target="integration-test-tomcat7apacheproxy" />
</parallel>

</target>

<target name="do-run-generic-test">
<property name="target-host" value="${target-server}.devnet.vaadin.com" />
<property name="target-port" value="8080" />
<antcontrib:if>
<isset property="startDelay" />
<then>
<echo>Delaying startup of ${target-server} with ${startDelay} seconds</echo>
<sleep seconds="${startDelay}" />
</then>
</antcontrib:if>

<scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
<fileset dir="integration_base_files">
<include name="*" />
</fileset>
</scp>

<!-- trycatch probably not needed any more as it just fails with
the original message and doesn't do anything in the finally block -->
<antcontrib:trycatch property="error_message">
<try>
<!-- timeout in one hour (remote end should timeout in 55
minutes) -->
<sshexec host="${target-host}" outputproperty="lock-output" timeout="3600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="chmod +x *.sh; ant -f deploy.xml get-lock" />
<antcall target="echo-prefix">
<param name="prefix" value="${target-server}: " />
<param name="message" value="${lock-output}" />
</antcall>

<scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />

<!-- timeout in 15 minutes -->
<sshexec host="${target-host}" outputproperty="start-output" timeout="900000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml startup-and-deploy" failonerror="false" />
<antcall target="echo-prefix">
<param name="prefix" value="${target-server}: " />
<param name="message" value="${start-output}" />
</antcall>

<fail message="${start-output}">
<condition>
<not>
<contains string="${start-output}" substring="Demo deployed successfully" />
</not>
</condition>
</fail>

<echo>Starting TB3 test for ${target-server}</echo>
<antcall target="run-tb3-servlet-test">
<param name="server-name" value="${target-server}" />
<param name="deployment.url" value="http://${target-host}:${target-port}" />
</antcall>

<!-- timeout in five minutes -->
<sshexec host="${target-host}" outputproperty="stop-output" timeout="600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" />
<antcall target="echo-prefix">
<param name="prefix" value="${target-server}: " />
<param name="message" value="${stop-output}" />
</antcall>
</try>
<catch>
<fail message="${error_message}" />
</catch>
</antcontrib:trycatch>
</target>

<target name="echo-prefix">
<antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
<echo message="${message-prefixed}" />
</target>

<target name="run-generic-integration-test">
<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
<antcontrib:trycatch property="tried">
<try>
<antcall target="do-run-generic-test" />
</try>
<catch>
<antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
<param name="returnTo" value="tried-escaped" />
<param name="message" value="${tried}" />
</antcontrib:antcallback>
<concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
</catch>
</antcontrib:trycatch>
<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
</target>

<target name="teamcity-escape">
<property name="returnTo" value="return" />

<!-- Should also perform other escaping (\u0085, \u2028 and \u2029)
- see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
<!-- Immutable properties -> needs to create a new one every time -->
<antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
<antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
<antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />

<property name="${returnTo}" value="${details-escaped3}" />
</target>

<target name="run-integration-test">
<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
<antcontrib:trycatch property="tried">
<try>
<antcall target="integration-test-${target-server}" />
</try>
<catch>
<antcallback target="teamcity-escape" return="tried-escaped">
<param name="returnTo" value="tried-escaped" />
<param name="message" value="${tried}" />
</antcallback>
<concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
</catch>
</antcontrib:trycatch>
<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
</target>

<target name="integration-test-get-lock">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
</target>

<target name="integration-test-release-lock">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
</target>

<!-- Remove demo.war -->
<target name="integration-test-clean">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
</target>
</project>

+ 24
- 0
test/servlet-containers/generic/ivy-taskdefs.xml View File

@@ -0,0 +1,24 @@

<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">

<info organisation="com.vaadin" module="vaadin" />
<configurations>
<conf name="taskdefs" description="Ant task definitions"
visibility="private" />
</configurations>
<publications />
<dependencies>
<!-- Ant tasks -->
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"
conf="taskdefs ->master" />
<dependency org="org.apache.maven" name="maven-ant-tasks"
rev="2.1.2" conf="taskdefs ->master" />
<dependency org="com.googlecode.jarjar" name="jarjar"
rev="1.3" conf="taskdefs ->master" />
<dependency org="com.puppycrawl.tools" name="checkstyle"
rev="5.6" />
</dependencies>

</ivy-module>

+ 130
- 0
test/servlet-containers/generic/ivy.xml View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ivy-module [
<!ENTITY jetty.version "8.1.12.v20130726">
]>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
xmlns:m="http://ant.apache.org/ivy/maven">

<info organisation="com.vaadin" module="vaadin-uitest"
revision="${vaadin.version}" />

<configurations>
<conf name="build" />
<conf name="build-provided" visibility="private" />
<conf name="jetty-run" visibility="private" />
</configurations>
<dependencies defaultconf="build" defaultconfmapping="build->default">
<!-- API DEPENDENCIES -->
<dependency org="javax.portlet" name="portlet-api"
rev="2.0" conf="build-provided -> default" />

<dependency org="javax.validation" name="validation-api"
rev="1.0.0.GA" conf="build -> default,sources" />
<dependency org="org.hibernate" name="hibernate-validator"
rev="4.2.0.Final" conf="build -> default" />

<!-- LIBRARY DEPENDENCIES (compile time) -->
<!-- Project modules -->
<dependency org="com.vaadin" name="vaadin-server"
rev="${vaadin.version}" conf="build->default">
<exclude org="javax.servlet"></exclude>
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-compatibility-server"
rev="${vaadin.version}" conf="build->default">
<exclude org="javax.servlet"></exclude>
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-client"
rev="${vaadin.version}" conf="build->default">
<exclude org="javax.validation"></exclude>
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-compatibility-client"
rev="${vaadin.version}" conf="build->default">
<exclude org="javax.validation"></exclude>
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-client-compiled"
rev="${vaadin.version}" conf="build->default">
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-compatibility-client-compiled"
rev="${vaadin.version}" conf="build->default">
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-themes"
rev="${vaadin.version}" conf="build->default">
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-push" rev="${vaadin.version}"
conf="build->default">
<exclude org="javax.servlet"></exclude>
<exclude type="pom" />
</dependency>

<!-- For compiling TestingWidgetSet -->
<dependency org="com.vaadin" name="vaadin-client-compiler"
rev="${vaadin.version}" conf="build-provided-> default">
<exclude type="pom" />
</dependency>

<!-- Servlet 3.0 API -->
<dependency org="javax.servlet" name="javax.servlet-api"
rev="3.0.1" conf="build-provided -> default" />

<dependency org="org.eclipse.jetty" name="jetty-server"
rev="&jetty.version;" conf="build-provided, jetty-run->default">
<exclude org="org.eclipse.jetty.orbit"></exclude>
</dependency>
<!-- jetty-servlets needed by ProxyTest, but not by jetty-runner -->
<dependency org="org.eclipse.jetty" name="jetty-servlets"
rev="&jetty.version;" conf="build-provided, jetty-run->default">
<exclude org="org.eclipse.jetty.orbit"></exclude>
</dependency>
<dependency org="org.eclipse.jetty" name="jetty-websocket"
rev="&jetty.version;" conf="build-provided, jetty-run->default">
<exclude org="org.eclipse.jetty.orbit"></exclude>
</dependency>
<dependency org="org.eclipse.jetty" name="jetty-webapp"
rev="&jetty.version;" conf="build-provided, jetty-run->default">
<exclude org="org.eclipse.jetty.orbit"></exclude>
</dependency>
<dependency org="org.eclipse.jetty" name="jetty-util"
rev="&jetty.version;" conf="build-provided, jetty-run->default">
<exclude org="org.eclipse.jetty.orbit"></exclude>
</dependency>
<dependency org="org.mortbay.jetty" name="jetty-runner"
rev="&jetty.version;" conf="build-provided, jetty-run->default">
<exclude org="org.eclipse.jetty.orbit"></exclude>
</dependency>

<dependency org="junit" name="junit" rev="4.12"
conf="build -> default" />
<dependency org="org.hamcrest" name="hamcrest-all"
rev="1.3" conf="build->default" />
<dependency org="com.jcraft" name="jsch" rev="0.1.52"
conf="build->default" />
<dependency org="commons-codec" name="commons-codec"
rev="1.5" conf="build->default" />
<dependency org="commons-io" name="commons-io"
rev="${commons-io.version}" conf="build->default" />
<!-- Mainly for SQLContainer tests -->
<dependency org="org.hsqldb" name="hsqldb" rev="2.2.6"
conf="build -> default" />
<dependency org="com.vaadin" name="vaadin-testbench-api"
rev="${vaadin.version}" conf="build-provided -> default" />
<!-- This should be removed once tests have been updated to use lang3 -->
<dependency org="commons-lang" name="commons-lang"
rev="2.6" conf="build -> default" />

<dependency org="org.eclipse.jgit" name="org.eclipse.jgit"
rev="3.5.1.201410131835-r" conf="build->default">
<exclude org="org.apache.httpcomponents"></exclude>
</dependency>

</dependencies>

</ivy-module>

+ 75
- 0
test/servlet-containers/generic/ivysettings.xml View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<!-- Default ivysettings.xml stuff -->
<include url="${ivy.default.settings.dir}/ivysettings-public.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-local.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml" />

<!-- Customized stuff -->
<settings defaultResolver="public" />
<resolvers>
<ibiblio name="public" m2compatible="true" />
<ibiblio name="vaadin-addons" usepoms="true"
m2compatible="true" root="http://maven.vaadin.com/vaadin-addons" />
<filesystem name="local-maven" m2compatible="true">
<artifact
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
<ivy
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).pom" />
</filesystem>
<ibiblio name="vaadin-build" usepoms="true"
m2compatible="true" root="${vaadin.build.repository}" />
<chain name="vaadin-maven" returnFirst="true">
<resolver ref="local-maven" />
<resolver ref="vaadin-build" />
</chain>
</resolvers>
<modules>
<module organisation="com.vaadin" name="vaadin-testbench"
resolver="vaadin-addons" />
<module organisation="com.vaadin" name="vaadin-testbench-parent"
resolver="vaadin-addons" />
<module organisation="com.vaadin" name="vaadin-testbench-core"
resolver="vaadin-addons" />
<module organisation="com.vaadin" name="vaadin-testbench-api"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-buildhelpers"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-root"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-shared"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-compatibility-shared"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-server"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-compatibility-server"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-client"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-compatibility-client"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-client-compiler"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-client-compiled"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-compatibility-client-compiled"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-themes"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-compatibility-themes"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-push"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-widgets"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-bom"
resolver="vaadin-maven" />
<module organisation="com.vaadin" name="vaadin-liferay"
resolver="vaadin-maven" />
</modules>


</ivysettings>

+ 97
- 0
test/servlet-containers/generic/pom.xml View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-generic-integration</artifactId>
<name>vaadin-test-generic-integration</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
</properties>

<!-- This module exists only to run the Ant based server tests.
It will be removed in the future. -->

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Extract test classes for ant script to use -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-tests</id>
<phase>package</phase>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<includes>**/*.class</includes>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/test-classes</outputDirectory>
</configuration>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<!-- Currently tested using an Ant script. -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<!-- This execution builds an additional .war file with JBoss
6 specific descriptor -->
<executions>
<execution>
<id>jboss6-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<classifier>jboss6</classifier>
<webResources>
<resource>
<directory>src/main/jboss-6</directory>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

BIN
test/servlet-containers/generic/reference-screenshots/finland-phantomjs.png View File


BIN
test/servlet-containers/generic/reference-screenshots/initial-phantomjs.png View File


+ 7
- 0
test/servlet-containers/generic/src/main/jboss-6/WEB-INF/jboss-web.xml View File

@@ -0,0 +1,7 @@
<jboss-web version="7.2" xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
schema/jboss-web_7_2.xsd">
<!-- Enable websockets on JBoss EAP 6.4 -->
<enable-websockets>true</enable-websockets>
</jboss-web>

+ 64
- 0
test/servlet-containers/glassfish/pom.xml View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-glassfish-server</artifactId>
<name>Vaadin Glassfish Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<glassfish.version>4.1.2.173</glassfish.version>
<server.name>glassfish</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>4.1.1</version>
<executions>
<execution>
<id>start-glassfish</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-glassfish</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<port>8080</port>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 73
- 0
test/servlet-containers/jetty8/pom.xml View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-jetty8-server</artifactId>
<name>Vaadin Jetty 8 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<mortbay.jetty.version>8.1.16.v20140903</mortbay.jetty.version>
<server.name>jetty8</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!--
This server test is for an old, outdated version of jetty.
The configuration is not moved to the parent pom, since this
is not useful anywhere else.
-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${mortbay.jetty.version}</version>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<webApp>
<contextPath>${context.path}</contextPath>
</webApp>
<stopKey>q</stopKey>
<stopPort>8082</stopPort>
<daemon>true</daemon>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 43
- 0
test/servlet-containers/jetty9/pom.xml View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-jetty9-server</artifactId>
<name>Vaadin Jetty 9 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>false</jetty.skip>
<jetty.version>9.3.21.v20170918</jetty.version>
<server.name>jetty9</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 27
- 0
test/servlet-containers/jsp-integration/pom.xml View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-jsp-integration</artifactId>
<name>vaadin-test-jsp-integration</name>
<packaging>war</packaging>

<properties>
<context.path>/</context.path>
</properties>

<dependencies>

<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>

</dependencies>

</project>

+ 28
- 0
test/servlet-containers/jsp-integration/src/main/java/com/vaadin/tests/integration/AnotherTrivialUI.java View File

@@ -0,0 +1,28 @@
/*
* Copyright 2000-2017 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.integration;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;

public class AnotherTrivialUI extends UI {
@Override
protected void init(VaadinRequest request) {
setContent(new Label("Another Trivial UI"));
}

}

+ 28
- 0
test/servlet-containers/jsp-integration/src/main/java/com/vaadin/tests/integration/TrivialUI.java View File

@@ -0,0 +1,28 @@
/*
* Copyright 2000-2017 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.integration;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;

public class TrivialUI extends UI {
@Override
protected void init(VaadinRequest request) {
setContent(new Label("Trivial UI"));
}

}

+ 57
- 0
test/servlet-containers/jsp-integration/src/main/webapp/WEB-INF/web.xml View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="vaadin-uitest" version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

<!-- THIS IS A DEVELOPMENT AND TESTING web.xml . -->

<display-name>Vaadin</display-name>
<description>Vaadin JSP Integration Test</description>

<context-param>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>

<servlet>
<servlet-name>VaadinStaticFiles</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<async-supported>false</async-supported>
</servlet>

<servlet>
<servlet-name>PrimaryUIServlet</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param>
<param-name>UI</param-name>
<param-value>com.vaadin.tests.integration.TrivialUI</param-value>
</init-param>
<async-supported>true</async-supported>
</servlet>

<servlet>
<servlet-name>SecondaryUIServlet</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param>
<param-name>UI</param-name>
<param-value>com.vaadin.tests.integration.AnotherTrivialUI</param-value>
</init-param>
<async-supported>true</async-supported>
</servlet>

<servlet-mapping>
<servlet-name>PrimaryUIServlet</servlet-name>
<url-pattern>/primaryui/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>SecondaryUIServlet</servlet-name>
<url-pattern>/secondaryui/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>VaadinStaticFiles</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>

</web-app>

+ 54
- 0
test/servlet-containers/jsp-integration/src/main/webapp/staticfiles/vaadinsessions.jsp View File

@@ -0,0 +1,54 @@
<!DOCTYPE>
<%@page import="com.vaadin.ui.UI"%>
<%@page import="com.vaadin.server.VaadinSession"%>
<HTML>
<HEAD>
<TITLE>JSP integration</TITLE>
<style>
table {
background: #fff;
}

td {
border: 1px solid black;
padding: .5em;
}
</style>
</HEAD>
<BODY>
<table>
<tr>
<th align="left" colspan=4>Available UIs:</th>
</tr>
<tr>
<th>Service Name</th>
<th>CSRF token</th>
<th>UI id</th>
<th>UI type</th>
<th>Main content</th>
</tr>
<%
HttpSession httpSession = request.getSession(false);
for (VaadinSession vs : VaadinSession.getAllSessions(httpSession)) {
try {
vs.lock();
for (UI ui : vs.getUIs()) {
out.append("<tr class='uirow'>");
out.append("<td>" + vs.getService().getServiceName()
+ "</td>");
out.append("<td>" + vs.getCsrfToken() + "</td>");
out.append("<td>" + ui.getUIId() + "</td>");
out.append("<td>" + ui.getClass().getName() + "</td>");
out.append("<td>" + ui.getContent().getClass().getName() + "</td>");
out.append("</tr>");

}
} finally {
vs.unlock();
}

}
%>
</table>
</BODY>
</HTML>

+ 90
- 0
test/servlet-containers/jsp-integration/src/test/java/com/vaadin/tests/integration/JSPIntegrationIT.java View File

@@ -0,0 +1,90 @@
package com.vaadin.tests.integration;

import com.vaadin.testbench.TestBenchTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.phantomjs.PhantomJSDriver;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

public class JSPIntegrationIT extends TestBenchTestCase {

private static final String URL_PREFIX = "http://localhost:8080/";

private static final String primaryUIUrl = URL_PREFIX + "primaryui";
private static final String jspUrl = URL_PREFIX + "staticfiles/vaadinsessions.jsp";
private static final String secondaryUIUrl = URL_PREFIX + "secondaryui";

@Test
public void listVaadinSessions() {

assertUICount(0);

// Open a new UI
getDriver().navigate().to(primaryUIUrl);


assertUICount(1);
UIData firstUI = getUIs().get(0);

// Open a new UI
getDriver().navigate().to(primaryUIUrl);
UIData secondUI = getUIs().get(0);

// Should now have UI for the same service with different uiId
assertUICount(1);
assertNotEquals(firstUI.uiId, secondUI.uiId);
assertEquals(firstUI.serviceName, secondUI.serviceName);

getDriver().navigate().to(secondaryUIUrl);
// Should now have another services
List<UIData> twoUIs = getUIs();
assertEquals(2, twoUIs.size());
assertNotEquals(twoUIs.get(0).serviceName, twoUIs.get(1).serviceName);
}

private static class UIData {
private String serviceName;
private int uiId;
}

private List<UIData> getUIs() {
List<UIData> uis = new ArrayList<UIData>();

getDriver().get(jspUrl);
List<WebElement> rows = getDriver()
.findElements(By.xpath("//tr[@class='uirow']"));
for (WebElement row : rows) {
UIData data = new UIData();
List<WebElement> tds = row.findElements(By.xpath("./td"));

data.serviceName = tds.get(0).getText();
data.uiId = Integer.parseInt(tds.get(2).getText());

uis.add(data);
}

return uis;
}

private void assertUICount(int i) {
assertEquals(i, getUIs().size());
}

@Before
public void setup() {
setDriver(new PhantomJSDriver());
}

@After
public void teardown() {
getDriver().quit();
}
}

+ 54
- 0
test/servlet-containers/liberty-javaee/pom.xml View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-liberty-javaee-server</artifactId>
<name>Vaadin Liberty JavaEE7 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<liberty.version>17.0.0.1</liberty.version>
<liberty.profile>wlp-javaee7</liberty.profile>
<server.name>liberty-javaee</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!-- FIXME: Fix liberty to use the same port as everything else. -->
<deployment.url>http://localhost:9080</deployment.url>
</systemPropertyVariables>
</configuration>
</plugin>

<!-- Server configuration -->
<plugin>
<groupId>net.wasdev.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 54
- 0
test/servlet-containers/liberty-webprofile/pom.xml View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-liberty-webprofile-server</artifactId>
<name>Vaadin Liberty WebProfile Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<liberty.version>17.0.0.1</liberty.version>
<liberty.profile>wlp-webProfile7</liberty.profile>
<server.name>liberty-webprofile</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!-- FIXME: Fix liberty to use the same port as everything else. -->
<deployment.url>http://localhost:9080</deployment.url>
</systemPropertyVariables>
</configuration>
</plugin>

<!-- Server configuration -->
<plugin>
<groupId>net.wasdev.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 277
- 0
test/servlet-containers/pom.xml View File

@@ -0,0 +1,277 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-servlet-containers-test</artifactId>
<name>vaadin-servlet-containers-test</name>
<packaging>pom</packaging>

<properties>
<server.name>jetty9</server.name>
<context.path>/${project.build.finalName}</context.path>

<!-- Default reference screenshot location, relative to the module path -->
<reference.directory>${project.basedir}/../screenshots</reference.directory>
</properties>

<modules>
<module>generic-ui</module>
<module>generic-tests</module>
</modules>

<build>
<pluginManagement>
<plugins>
<!-- Wildfly Configuration. Version selected with wildfly.version -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.0.Final</version>
<executions>
<execution>
<id>start-wildfly</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-wildfly</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Glassfish Embedded Configuration. -->
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>4.1.1</version>
<executions>
<execution>
<id>start-glassfish</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-glassfish</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<port>8080</port>
</configuration>
</plugin>

<!-- Generic cargo plugin configuration. Define container to use in submodule. -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<configuration>
<type>standalone</type>
<home>
${project.build.directory}/cargo-server
</home>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<properties>
<context>${context.path}</context>
</properties>
</deployable>
</deployables>
</configuration>
<executions>
<execution>
<id>start-cargo-server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-cargo-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- WebSphere Liberty Configuration. Version and profile are configurable with liberty.version and liberty.profile -->
<plugin>
<groupId>net.wasdev.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<id>start-liberty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-liberty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- FIXME: This plug-in should also use port 8080 -->
<appArtifact>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</appArtifact>
<assemblyArtifact>
<groupId>com.ibm.websphere.appserver.runtime</groupId>
<artifactId>${liberty.profile}</artifactId>
<version>${liberty.version}</version>
<type>zip</type>
</assemblyArtifact>
</configuration>
</plugin>

<!-- Jetty Configuration. Version selected with jetty.version -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<webApp>
<contextPath>${context.path}</contextPath>
</webApp>
</configuration>
</plugin>

<!-- General purpose plugins -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<dependenciesToScan>
<dependency>${project.groupId}:vaadin-test-server-tests</dependency>
</dependenciesToScan>
<systemPropertyVariables>
<deployment.context.path>${context.path}</deployment.context.path>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>all</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>jsp-integration</module>
<module>wildfly13</module>
<module>wildfly12</module>
<module>wildfly11</module>
<module>wildfly10</module>
<module>wildfly9</module>
<module>wildfly8</module>
<module>jetty8</module>
<module>jetty9</module>
<module>glassfish</module>
<!-- TODO: Payara 5 and Glassfish 5 -->
<module>tomcat7</module>
<module>tomcat80</module>
<module>tomcat85</module>
<module>tomcat9</module>
<module>liberty-javaee</module>
<module>liberty-webprofile</module>
</modules>
</profile>
<profile>
<!-- TODO Remove this when the ant build is no longer used. -->
<id>ant-test</id>
<modules>
<module>generic</module>
</modules>
</profile>
<profile>
<id>wildfly</id>
<modules>
<module>wildfly13</module>
<module>wildfly12</module>
<module>wildfly11</module>
<module>wildfly10</module>
<module>wildfly9</module>
<module>wildfly8</module>
</modules>
</profile>
<profile>
<id>jetty</id>
<modules>
<module>jetty9</module>
<module>jetty8</module>
</modules>
</profile>
<profile>
<id>liberty</id>
<modules>
<module>liberty-webprofile</module>
<module>liberty-javaee</module>
</modules>
</profile>
<profile>
<id>glassfish</id>
<modules>
<module>glassfish</module>
</modules>
</profile>
<profile>
<id>tomcat</id>
<modules>
<module>tomcat7</module>
<module>tomcat80</module>
<module>tomcat85</module>
<module>tomcat9</module>
</modules>
</profile>
</profiles>

</project>

BIN
test/servlet-containers/screenshots/finland-phantomjs.png View File


BIN
test/servlet-containers/screenshots/initial-phantomjs.png View File


+ 53
- 0
test/servlet-containers/tomcat7/pom.xml View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-tomcat7-server</artifactId>
<name>Vaadin Tomcat 7 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<tomcat.version>7.0.82</tomcat.version>
<server.name>tomcat7</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
</artifactInstaller>
</container>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 53
- 0
test/servlet-containers/tomcat80/pom.xml View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-tomcat80-server</artifactId>
<name>Vaadin Tomcat 8.0 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<tomcat.version>8.0.47</tomcat.version>
<server.name>tomcat8.0</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
</artifactInstaller>
</container>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 53
- 0
test/servlet-containers/tomcat85/pom.xml View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-tomcat85-server</artifactId>
<name>Vaadin Tomcat 8.5 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<tomcat.version>8.5.23</tomcat.version>
<server.name>tomcat8.5</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
</artifactInstaller>
</container>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 53
- 0
test/servlet-containers/tomcat9/pom.xml View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-tomcat9-server</artifactId>
<name>Vaadin Tomcat 9 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<tomcat.version>9.0.1</tomcat.version>
<server.name>tomcat9</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat9x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
</artifactInstaller>
</container>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 43
- 0
test/servlet-containers/wildfly10/pom.xml View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-wildfly10-server</artifactId>
<name>Vaadin Wildfly 10 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<wildfly.version>10.1.0.Final</wildfly.version>
<server.name>wildfly10</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 43
- 0
test/servlet-containers/wildfly11/pom.xml View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-wildfly11-server</artifactId>
<name>Vaadin Wildfly 11 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<wildfly.version>11.0.0.Final</wildfly.version>
<server.name>wildfly11</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 43
- 0
test/servlet-containers/wildfly12/pom.xml View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-wildfly12-server</artifactId>
<name>Vaadin Wildfly 12 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<wildfly.version>12.0.0.Final</wildfly.version>
<server.name>wildfly12</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 43
- 0
test/servlet-containers/wildfly13/pom.xml View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-wildfly13-server</artifactId>
<name>Vaadin Wildfly 13 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<wildfly.version>13.0.0.Final</wildfly.version>
<server.name>wildfly13</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 43
- 0
test/servlet-containers/wildfly8/pom.xml View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-wildfly8-server</artifactId>
<name>Vaadin Wildfly 8 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<wildfly.version>8.2.1.Final</wildfly.version>
<server.name>wildfly8</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 43
- 0
test/servlet-containers/wildfly9/pom.xml View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-servlet-containers-test</artifactId>
<version>7.7-SNAPSHOT</version>
</parent>
<artifactId>vaadin-test-wildfly9-server</artifactId>
<name>Vaadin Wildfly 9 Test</name>
<packaging>war</packaging>
<properties>
<jetty.skip>true</jetty.skip>
<wildfly.version>9.0.2.Final</wildfly.version>
<server.name>wildfly9</server.name>
</properties>

<dependencies>
<!-- UI classes and tests from dependencies -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-test-server-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Server configuration -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 6
- 1
test/widget-set-testutil/src/test/java/com/vaadin/test/defaultwidgetset/AbstractWidgetSetIT.java View File

@@ -14,6 +14,8 @@ import com.vaadin.testbench.TestBenchTestCase;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.testbench.elements.TextFieldElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public abstract class AbstractWidgetSetIT extends TestBenchTestCase {

@@ -68,11 +70,14 @@ public abstract class AbstractWidgetSetIT extends TestBenchTestCase {
}

protected void assertHasDebugMessage(String message) {
// Make sure the correct debug window tab is open.
findElements(By.className("v-debugwindow-tab")).get(0).click();

List<WebElement> elements = getDriver().findElements(
By.xpath("//span[@class='v-debugwindow-message']"));
boolean found = false;
for (WebElement element : elements) {
if (element.getText().contains(message)) {
if (element.getAttribute("innerText").contains(message)) {
found = true;
break;
}

+ 0
- 34
uitest/vaadin-server.xml View File

@@ -1,34 +0,0 @@
<?xml version="1.0"?>
<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="vaadin-server" default="deploy-and-start" basedir=".">
<include file="../common.xml" />
<dirname property="dir" file="${ant.file.vaadin-server}" />

<target name="deploy-and-start">
<fail unless="war.file" message="No war file given in 'war.file'" />

<ivy:resolve log="download-only" file="${dir}/ivy.xml" />
<ivy:cachepath pathid="classpath.jetty" conf="jetty-run" />
<java classname="org.mortbay.jetty.runner.Runner" fork="yes" output="${vaadin.basedir}/result/jetty.java.out" resultproperty="resultCode" maxmemory="1024m">
<arg value="--port" />
<arg value="8888" />
<arg value="--out" />
<arg value="${vaadin.basedir}/result/jetty.out" />
<arg value="--log" />
<arg value="${vaadin.basedir}/result/jetty.log" />
<arg value="${war.file}" />
<classpath refid="classpath.jetty" />
<jvmarg value="-ea" />
</java>
<echo message="Jetty process ended with result code ${resultCode}" />

</target>

<target name="wait-for-startup">
<echo>Waiting for Servlet Container to start up.</echo>
<waitfor maxwait="60" maxwaitunit="second" checkevery="5" checkeveryunit="second" timeoutproperty="server.start.failed">
<http url="http://localhost:8888" />
</waitfor>
<fail if="server.start.failed" message="Server startup failed" />
</target>

</project>

Loading…
Cancel
Save