]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add Vaadin Spring dependency version to BOM (#112)
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>
Wed, 14 Dec 2016 11:10:39 +0000 (13:10 +0200)
committerPekka Hyvönen <pekka@vaadin.com>
Wed, 14 Dec 2016 11:10:39 +0000 (13:10 +0200)
* Add Vaadin Spring dependency version to BOM

This patch adds a smoke test that check that a basic
Vaadin UI loads and communication works.

* Remove Maven wrapper from Spring Boot test

* Remove .gitignore, add missing newlines

* Minor fixes to pom.xml files

* Separate vaadin-test from vaadin-root

* Fix whitespace

bom/pom.xml
test/pom.xml
test/spring-boot/pom.xml [new file with mode: 0644]
test/spring-boot/src/main/java/com/example/DemoApplication.java [new file with mode: 0644]
test/spring-boot/src/main/resources/application.properties [new file with mode: 0644]
test/spring-boot/src/test/java/com/example/SpringBootSmokeTest.java [new file with mode: 0644]

index ebf2eb7d10447578802052b4f2f7584899d45d29..35e53ac55d6533b0a7dfe34560c186a4fc078b4c 100644 (file)
@@ -5,6 +5,7 @@
         <groupId>com.vaadin</groupId>
         <artifactId>vaadin-parent</artifactId>
         <version>1.0.0</version>
+        <relativePath />
     </parent>
     <groupId>com.vaadin</groupId>
     <artifactId>vaadin-bom</artifactId>
     <name>Vaadin Framework (Bill of Materials)</name>
     <description>Vaadin Framework (Bill of Materials)</description>
     <url>http://vaadin.com</url>
+
+    <properties>
+        <vaadin.spring.version>2.0-SNAPSHOT</vaadin.spring.version>
+    </properties>
+
+    <repositories>
+        <repository>
+            <id>vaadin-snapshots</id>
+            <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots</url>
+        </repository>
+    </repositories>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
                 <artifactId>vaadin-compatibility-client-compiled</artifactId>
                 <version>${project.version}</version>
             </dependency>
+
+            <!-- AddOn Dependencies -->
+
+            <dependency>
+                <groupId>com.vaadin</groupId>
+                <artifactId>vaadin-spring-boot-starter</artifactId>
+                <version>${vaadin.spring.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.vaadin</groupId>
+                <artifactId>vaadin-spring-boot</artifactId>
+                <version>${vaadin.spring.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.vaadin</groupId>
+                <artifactId>vaadin-spring</artifactId>
+                <version>${vaadin.spring.version}</version>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
     <profiles>
index b1ee2fb0740b91fdf23c3f67217707b8193f6b29..6a4ce4f7ee93cec47021eabfa6fc582686f24b0a 100644 (file)
@@ -2,16 +2,20 @@
 <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>8.0-SNAPSHOT</version>
-    </parent>
+    <groupId>com.vaadin</groupId>
     <artifactId>vaadin-test</artifactId>
     <name>vaadin-test</name>
+    <version>1.0-SNAPSHOT</version>
+
     <packaging>pom</packaging>
     <properties>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <jetty.version>9.3.7.v20160115</jetty.version>
+        <phantomjs.version>2.1.1</phantomjs.version>
+        <vaadin.version>8.0-SNAPSHOT</vaadin.version>
         <failOnMissingWebXml>false</failOnMissingWebXml>
+        <vaadin.testbench.version>5.0.0.alpha1</vaadin.testbench.version>
     </properties>
 
     <repositories>
         </repository>
     </repositories>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>com.vaadin</groupId>
+                <artifactId>vaadin-bom</artifactId>
+                <version>${vaadin.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
     <dependencies>
 
         <!-- API DEPENDENCIES -->
         <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 -->
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <scope>provided</scope>
         </dependency>
 
-
         <!-- Testing -->
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-all</artifactId>
+            <version>4.12</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>com.vaadin</groupId>
             <artifactId>vaadin-testbench</artifactId>
+            <version>${vaadin.testbench.version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
@@ -71,6 +74,7 @@
         <module>addon-using-init-param-widget-set</module>
         <module>space in directory</module>
         <module>vaadinservletconfiguration-widget-set</module>
+        <module>spring-boot</module>
     </modules>
 
     <build>
             <plugin>
                 <groupId>com.github.klieber</groupId>
                 <artifactId>phantomjs-maven-plugin</artifactId>
+                <version>0.7</version>
                 <executions>
                     <execution>
                         <goals>
                     </execution>
                 </executions>
             </plugin>
-
             <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.19.1</version>
             </plugin>
             <plugin>
                 <artifactId>maven-failsafe-plugin</artifactId>
+                <version>2.19.1</version>
                 <executions>
                     <execution>
                         <goals>
                     </systemPropertyVariables>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <artifactId>maven-install-plugin</artifactId>
+                <version>2.5.2</version>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/test/spring-boot/pom.xml b/test/spring-boot/pom.xml
new file mode 100644 (file)
index 0000000..8cdde7e
--- /dev/null
@@ -0,0 +1,82 @@
+<?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>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>vaadin-test-spring-boot</artifactId>
+    <packaging>jar</packaging>
+
+    <name>vaadin-test-spring-boot</name>
+    <description>Demo project for Vaadin Spring Boot</description>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+        <spring.boot.version>1.4.2.RELEASE</spring.boot.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.vaadin</groupId>
+            <artifactId>vaadin-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>com.vaadin</groupId>
+                <artifactId>vaadin-bom</artifactId>
+                <version>${vaadin.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-parent</artifactId>
+                <type>pom</type>
+                <scope>import</scope>
+                <version>${spring.boot.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring.boot.version}</version>
+            </plugin>
+
+            <!-- Disable jetty-plugin -->
+            <plugin>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-maven-plugin</artifactId>
+                <version>${jetty.version}</version>
+                <executions>
+                    <execution>
+                        <id>start-jetty</id>
+                        <phase />
+                    </execution>
+                    <execution>
+                        <id>stop-jetty</id>
+                        <phase />
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/test/spring-boot/src/main/java/com/example/DemoApplication.java b/test/spring-boot/src/main/java/com/example/DemoApplication.java
new file mode 100644 (file)
index 0000000..9a4edd8
--- /dev/null
@@ -0,0 +1,29 @@
+package com.example;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.spring.annotation.SpringUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.UI;
+
+@SpringBootApplication
+public class DemoApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(DemoApplication.class, args);
+    }
+}
+
+@SpringUI
+class MyUI extends UI {
+    public static final String NOTIFICATION_TEXT = "Thank you for clicking.";
+
+    @Override
+    protected void init(VaadinRequest request) {
+        setContent(new Button("Click Me!",
+                e -> Notification.show(NOTIFICATION_TEXT)));
+    }
+}
diff --git a/test/spring-boot/src/main/resources/application.properties b/test/spring-boot/src/main/resources/application.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/spring-boot/src/test/java/com/example/SpringBootSmokeTest.java b/test/spring-boot/src/test/java/com/example/SpringBootSmokeTest.java
new file mode 100644 (file)
index 0000000..fe53575
--- /dev/null
@@ -0,0 +1,44 @@
+package com.example;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.phantomjs.PhantomJSDriver;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.vaadin.testbench.TestBench;
+import com.vaadin.testbench.TestBenchTestCase;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.NotificationElement;
+import com.vaadin.testbench.parallel.Browser;
+
+/**
+ * @author Vaadin Ltd
+ *
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+public class SpringBootSmokeTest extends TestBenchTestCase {
+
+    @LocalServerPort
+    Integer port;
+
+    @Before
+    public void setUp() {
+        setDriver(TestBench.createDriver(new PhantomJSDriver(
+                Browser.PHANTOMJS.getDesiredCapabilities())));
+    }
+
+    @Test
+    public void testPageLoadsAndButtonWorks() {
+        getDriver().navigate().to("http://localhost:" + port + "");
+        $(ButtonElement.class).first().click();
+        Assert.assertTrue($(NotificationElement.class).exists());
+        Assert.assertEquals(MyUI.NOTIFICATION_TEXT,
+                $(NotificationElement.class).first().getText());
+    }
+}