Browse Source

Automatic test for OSGi/karaf

tags/8.1.1
Ilia Motornyi 1 year ago
parent
commit
456f14f5e5

+ 1
- 0
.gitignore View File

@@ -12,6 +12,7 @@
12 12
 /extras
13 13
 
14 14
 uitest/src/main/themes/VAADIN/themes/**/styles.css
15
+test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/resources/VAADIN/themes/karaftesttheme/styles.css
15 16
 
16 17
 # Persisted scss cache files
17 18
 uitest/src/main/themes/VAADIN/themes/**/styles.scss.cache

+ 1
- 0
test/pom.xml View File

@@ -105,6 +105,7 @@
105 105
         <module>servlet-containers/generic</module>
106 106
         <module>cdi</module>
107 107
         <module>servlet-containers/jsp-integration</module>
108
+        <module>servlet-containers/karaf</module>
108 109
         <module>bean-api-validation</module>
109 110
         <module>bean-impl-validation</module>
110 111
         <module>dependency-rewrite-addon</module>

+ 31
- 0
test/servlet-containers/karaf/README.md View File

@@ -0,0 +1,31 @@
1
+Automatic test for Karaf deployment
2
+===
3
+
4
+What is tested
5
+---
6
+* Multiple applications are deployed and work properly
7
+* Default widgetset works
8
+* Custom widgetset works
9
+* Custom theme works
10
+
11
+Tips and Tricks
12
+---
13
+* Karaf is downloaded and deployed by maven karaf plugin
14
+* Karaf is run as a background process using maven `exec:exec` goal
15
+* Karaf is shut down using maven `karaf:client` goal during `post-integration-test` phase
16
+* All required karaf features and project bundles are deployed using maven karaf plugin with `client` goal
17
+
18
+Running and stopping karaf manually
19
+---
20
+* To start karaf as a foreground process and deploy both vaadin bundles and two existing applications, run `mvn  -f karaf-run-pom.xml clean karaf:run`
21
+in `karaf-run` module
22
+* To start karaf as a background process and deploy both vaadin bundles and two existing applications, run `mvn clean pre-integration-test`
23
+in `karaf-run` module
24
+* Karaf console is available via ssh at `127.0.0.0:8101` port, username/password is `karaf/karaf` 
25
+* To stop background karaf process, run `mvn karaf:client@karaf-client-shutdown`
26
+in `karaf-run` module
27
+
28
+Potential problems
29
+---
30
+* Maven executable should be in `PATH`
31
+* Background karaf process may be left running for 10 minutes if the build fails prior `integration-test` phase.

+ 21
- 0
test/servlet-containers/karaf/karaf-run/karaf-run-pom.xml View File

@@ -0,0 +1,21 @@
1
+<project xmlns="http://maven.apache.org/POM/4.0.0"
2
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+    <artifactId>karaf-runner</artifactId>
5
+    <groupId>com.vaadin</groupId>
6
+    <version>8.1-SNAPSHOT</version>
7
+    <modelVersion>4.0.0</modelVersion>
8
+    <build>
9
+        <plugins>
10
+            <plugin>
11
+                <groupId>org.apache.karaf.tooling</groupId>
12
+                <artifactId>karaf-maven-plugin</artifactId>
13
+                <version>4.0.8</version>
14
+                <configuration>
15
+                    <deployProjectArtifact>false</deployProjectArtifact>
16
+                    <startSsh>true</startSsh>
17
+                </configuration>
18
+            </plugin>
19
+        </plugins>
20
+    </build>
21
+</project>

+ 122
- 0
test/servlet-containers/karaf/karaf-run/pom.xml View File

@@ -0,0 +1,122 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <parent>
6
+        <artifactId>vaadin-test-karaf</artifactId>
7
+        <groupId>com.vaadin</groupId>
8
+        <relativePath>..</relativePath>
9
+        <version>8.1-SNAPSHOT</version>
10
+    </parent>
11
+    <modelVersion>4.0.0</modelVersion>
12
+
13
+    <artifactId>karaf-run</artifactId>
14
+    <name>Vaadin Karaf Test Runner</name>
15
+
16
+    <dependencies>
17
+        <!--Vaadin dependencies should not be in a classpath-->
18
+        <dependency>
19
+            <groupId>com.vaadin</groupId>
20
+            <artifactId>vaadin-server</artifactId>
21
+            <version>${vaadin.version}</version>
22
+            <scope>provided</scope>
23
+        </dependency>
24
+        <dependency>
25
+            <groupId>com.vaadin</groupId>
26
+            <artifactId>vaadin-themes</artifactId>
27
+            <version>${vaadin.version}</version>
28
+            <scope>provided</scope>
29
+        </dependency>
30
+    </dependencies>
31
+    <build>
32
+        <plugins>
33
+            <plugin>
34
+                <groupId>org.codehaus.mojo</groupId>
35
+                <artifactId>exec-maven-plugin</artifactId>
36
+                <version>1.6.0</version>
37
+                <executions>
38
+                    <execution>
39
+                        <phase>pre-integration-test</phase>
40
+                        <goals>
41
+                            <goal>exec</goal>
42
+                        </goals>
43
+                        <configuration>
44
+                            <executable>mvn</executable>
45
+                            <async>true</async>
46
+                            <asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
47
+                            <commandlineArgs>-f karaf-run-pom.xml karaf:run</commandlineArgs>
48
+                        </configuration>
49
+                    </execution>
50
+                </executions>
51
+
52
+            </plugin>
53
+            <plugin>
54
+                <groupId>org.apache.karaf.tooling</groupId>
55
+                <artifactId>karaf-maven-plugin</artifactId>
56
+                <version>4.0.8</version>
57
+                <executions>
58
+                    <execution>
59
+                        <id>karaf-client-ctrl</id>
60
+                        <phase>pre-integration-test</phase>
61
+                        <goals>
62
+                            <goal>client</goal>
63
+                        </goals>
64
+                        <configuration>
65
+                            <delay>5</delay>
66
+                            <attempts>150</attempts>
67
+                            <commands>
68
+                                <!--Scheduled shutdown in 15 minutes-->
69
+                                <command>shutdown -f +10</command>
70
+                                <command>feature:install http</command>
71
+                                <command>feature:install http-whiteboard</command>
72
+                                <command>bundle:install -s mvn:org.jsoup/jsoup/1.8.3</command>
73
+                                <command>bundle:install -s mvn:com.vaadin.external/gentyref/1.2.0.vaadin1</command>
74
+                                <command>bundle:install -s mvn:com.vaadin/vaadin-shared/${vaadin.version}</command>
75
+                                <command>bundle:install -s mvn:com.vaadin/vaadin-server/${vaadin.version}</command>
76
+                                <command>bundle:install -s mvn:com.vaadin/vaadin-osgi-integration/${vaadin.version}</command>
77
+                                <command>bundle:install -s mvn:com.vaadin/vaadin-client-compiled/${vaadin.version}</command>
78
+                                <command>bundle:install -s mvn:com.vaadin/vaadin-themes/${vaadin.version}</command>
79
+                                <command>
80
+                                    <![CDATA[bundle:install -s file:./../vaadin-karaf-bundle1/target/vaadin-karaf-bundle1-${project.version}.jar]]></command>
81
+                                <command>
82
+                                    <![CDATA[bundle:install -s file:./../vaadin-karaf-bundle2/target/vaadin-karaf-bundle2-${project.version}.jar]]></command>
83
+                            </commands>
84
+                        </configuration>
85
+                    </execution>
86
+                    <execution>
87
+                        <id>karaf-client-shutdown</id>
88
+                        <phase>post-integration-test</phase>
89
+                        <goals>
90
+                            <goal>client</goal>
91
+                        </goals>
92
+                        <configuration>
93
+                            <delay>5</delay>
94
+                            <attempts>10</attempts>
95
+                            <commands>
96
+                                <command>system:shutdown -f</command>
97
+                            </commands>
98
+                        </configuration>
99
+                    </execution>
100
+                </executions>
101
+            </plugin>
102
+            <plugin>
103
+                <groupId>org.apache.maven.plugins</groupId>
104
+                <artifactId>maven-failsafe-plugin</artifactId>
105
+                <version>2.19.1</version>
106
+                <executions>
107
+                    <execution>
108
+                        <goals>
109
+                            <goal>integration-test</goal>
110
+                            <goal>verify</goal>
111
+                        </goals>
112
+                    </execution>
113
+                </executions>
114
+                <configuration>
115
+                    <environmentVariables>
116
+                        <vaadin.version>${vaadin.version}</vaadin.version>
117
+                    </environmentVariables>
118
+                </configuration>
119
+            </plugin>
120
+        </plugins>
121
+    </build>
122
+</project>

+ 67
- 0
test/servlet-containers/karaf/karaf-run/src/test/java/com/vaadin/test/osgi/KarafIntegrationIT.java View File

@@ -0,0 +1,67 @@
1
+/*
2
+ * Copyright 2000-2017 Vaadin Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
+ * use this file except in compliance with the License. You may obtain a copy of
6
+ * the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ * License for the specific language governing permissions and limitations under
14
+ * the License.
15
+ */
16
+package com.vaadin.test.osgi;
17
+
18
+import com.vaadin.testbench.TestBenchTestCase;
19
+import org.junit.After;
20
+import org.junit.Before;
21
+import org.junit.Test;
22
+import org.openqa.selenium.By;
23
+import org.openqa.selenium.WebElement;
24
+import org.openqa.selenium.phantomjs.PhantomJSDriver;
25
+
26
+import static org.junit.Assert.assertEquals;
27
+
28
+public class KarafIntegrationIT extends TestBenchTestCase {
29
+
30
+    private static final String URL_PREFIX = "http://localhost:8181/";
31
+    private static final String APP1_URL = URL_PREFIX + "myapp1";
32
+    private static final String APP2_URL = URL_PREFIX + "myapp2";
33
+
34
+
35
+    @Test
36
+    public void testApp1() {
37
+        runBasicTest(APP1_URL, "bar");
38
+        //App theme should make a button pink
39
+        WebElement element = getDriver().findElement(By.className("v-button"));
40
+        String buttonColor = element.getCssValue("color");
41
+        assertEquals("rgba(255, 128, 128, 1)", buttonColor);
42
+    }
43
+
44
+    @Test
45
+    public void testApp2() {
46
+        runBasicTest(APP2_URL, "foo");
47
+    }
48
+
49
+    private void runBasicTest(String app1Url, String text) {
50
+        getDriver().navigate().to(app1Url);
51
+        getDriver().findElement(By.className("v-textfield")).sendKeys(text);
52
+        getDriver().findElement(By.className("v-button")).click();
53
+        String foundText = getDriver().findElement(By.className("v-label")).getText();
54
+        assertEquals("Thanks " + text + ", it works!", foundText);
55
+    }
56
+
57
+
58
+    @Before
59
+    public void setup() {
60
+        setDriver(new PhantomJSDriver());
61
+    }
62
+
63
+    @After
64
+    public void teardown() {
65
+        getDriver().quit();
66
+    }
67
+}

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

@@ -0,0 +1,37 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+    <modelVersion>4.0.0</modelVersion>
5
+    <parent>
6
+        <groupId>com.vaadin</groupId>
7
+        <artifactId>vaadin-test</artifactId>
8
+        <version>8.1-SNAPSHOT</version>
9
+        <relativePath>../..</relativePath>
10
+    </parent>
11
+    <artifactId>vaadin-test-karaf</artifactId>
12
+    <packaging>pom</packaging>
13
+    <name>Vaadin Karaf TestRoot</name>
14
+
15
+    <modules>
16
+        <module>vaadin-karaf-bundle1</module>
17
+        <module>vaadin-karaf-bundle2</module>
18
+        <module>karaf-run</module>
19
+    </modules>
20
+
21
+    <properties>
22
+        <karaf.plugin.version>4.0.8</karaf.plugin.version>
23
+        <vaadin.widgetset.mode>local</vaadin.widgetset.mode>
24
+    </properties>
25
+    <build>
26
+        <plugins>
27
+            <plugin>
28
+                <groupId>org.eclipse.jetty</groupId>
29
+                <artifactId>jetty-maven-plugin</artifactId>
30
+                <configuration>
31
+                    <skip>true</skip>
32
+                </configuration>
33
+            </plugin>
34
+        </plugins>
35
+
36
+    </build>
37
+</project>

+ 6
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle1/bnd.bnd View File

@@ -0,0 +1,6 @@
1
+Bundle-Name: ${project.name}
2
+Bundle-Version: ${project.version}
3
+Bundle-SymbolicName: ${project.groupId}.${project.artifactId}
4
+Export-Package: com.vaadin.test.osgi.myapplication1
5
+Import-Package: *
6
+Web-ContentPath: /myapp1

+ 164
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle1/pom.xml View File

@@ -0,0 +1,164 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+    <modelVersion>4.0.0</modelVersion>
5
+
6
+    <parent>
7
+        <groupId>com.vaadin</groupId>
8
+        <artifactId>vaadin-test-karaf</artifactId>
9
+        <version>8.1-SNAPSHOT</version>
10
+        <relativePath>..</relativePath>
11
+    </parent>
12
+    <artifactId>vaadin-karaf-bundle1</artifactId>
13
+    <packaging>jar</packaging>
14
+    <name>Vaadin Karaf test bundle 1</name>
15
+
16
+    <dependencyManagement>
17
+        <dependencies>
18
+            <dependency>
19
+                <groupId>com.vaadin</groupId>
20
+                <artifactId>vaadin-bom</artifactId>
21
+                <version>${vaadin.version}</version>
22
+                <type>pom</type>
23
+                <scope>import</scope>
24
+            </dependency>
25
+        </dependencies>
26
+    </dependencyManagement>
27
+
28
+    <dependencies>
29
+        <dependency>
30
+            <groupId>com.vaadin</groupId>
31
+            <artifactId>vaadin-server</artifactId>
32
+            <scope>provided</scope>
33
+        </dependency>
34
+        <dependency>
35
+            <groupId>com.vaadin</groupId>
36
+            <artifactId>vaadin-client-compiled</artifactId>
37
+            <scope>provided</scope>
38
+        </dependency>
39
+        <dependency>
40
+            <groupId>com.vaadin</groupId>
41
+            <artifactId>vaadin-themes</artifactId>
42
+            <scope>provided</scope>
43
+        </dependency>
44
+        <dependency>
45
+            <groupId>com.vaadin</groupId>
46
+            <artifactId>vaadin-osgi-integration</artifactId>
47
+            <version>8.1.0.beta1</version>
48
+            <scope>provided</scope>
49
+        </dependency>
50
+        <dependency>
51
+            <groupId>org.osgi</groupId>
52
+            <artifactId>osgi.core</artifactId>
53
+            <version>6.0.0</version>
54
+            <scope>provided</scope>
55
+        </dependency>
56
+        <dependency>
57
+            <groupId>org.osgi</groupId>
58
+            <artifactId>osgi.annotation</artifactId>
59
+            <version>6.0.1</version>
60
+            <scope>provided</scope>
61
+        </dependency>
62
+        <dependency>
63
+            <groupId>org.osgi</groupId>
64
+            <artifactId>osgi.cmpn</artifactId>
65
+            <version>6.0.0</version>
66
+            <scope>provided</scope>
67
+        </dependency>
68
+        <!-- For compiling WidgetSet -->
69
+        <dependency>
70
+            <groupId>com.vaadin</groupId>
71
+            <artifactId>vaadin-client</artifactId>
72
+            <version>${vaadin.version}</version>
73
+            <scope>provided</scope>
74
+        </dependency>
75
+    </dependencies>
76
+
77
+
78
+    <build>
79
+        <plugins>
80
+            <plugin>
81
+                <groupId>biz.aQute.bnd</groupId>
82
+                <artifactId>bnd-maven-plugin</artifactId>
83
+                <version>3.3.0</version>
84
+                <executions>
85
+                    <execution>
86
+                        <goals>
87
+                            <goal>bnd-process</goal>
88
+                        </goals>
89
+                        <configuration>
90
+
91
+                        </configuration>
92
+                    </execution>
93
+                </executions>
94
+            </plugin>
95
+            <plugin>
96
+                <groupId>com.vaadin</groupId>
97
+                <artifactId>vaadin-maven-plugin</artifactId>
98
+                <version>${vaadin.plugin.version}</version>
99
+                <executions>
100
+                    <execution>
101
+                        <goals>
102
+                            <goal>compile</goal>
103
+                            <goal>compile-theme</goal>
104
+                        </goals>
105
+                    </execution>
106
+                </executions>
107
+            </plugin>
108
+            <plugin>
109
+                <groupId>org.apache.maven.plugins</groupId>
110
+                <artifactId>maven-jar-plugin</artifactId>
111
+                <version>3.0.2</version>
112
+                <configuration>
113
+                    <archive>
114
+                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
115
+                    </archive>
116
+                </configuration>
117
+            </plugin>
118
+        </plugins>
119
+    </build>
120
+
121
+    <profiles>
122
+        <profile>
123
+            <!-- Vaadin pre-release repositories -->
124
+            <id>vaadin-prerelease</id>
125
+            <activation>
126
+                <activeByDefault>true</activeByDefault>
127
+            </activation>
128
+
129
+            <repositories>
130
+                <repository>
131
+                    <id>vaadin-prereleases</id>
132
+                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
133
+                </repository>
134
+                <repository>
135
+                    <id>vaadin-snapshots</id>
136
+                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
137
+                    <releases>
138
+                        <enabled>false</enabled>
139
+                    </releases>
140
+                    <snapshots>
141
+                        <enabled>true</enabled>
142
+                    </snapshots>
143
+                </repository>
144
+            </repositories>
145
+            <pluginRepositories>
146
+                <pluginRepository>
147
+                    <id>vaadin-prereleases</id>
148
+                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
149
+                </pluginRepository>
150
+                <pluginRepository>
151
+                    <id>vaadin-snapshots</id>
152
+                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
153
+                    <releases>
154
+                        <enabled>false</enabled>
155
+                    </releases>
156
+                    <snapshots>
157
+                        <enabled>true</enabled>
158
+                    </snapshots>
159
+                </pluginRepository>
160
+            </pluginRepositories>
161
+        </profile>
162
+    </profiles>
163
+
164
+</project>

+ 14
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/CustomWidgetSet.java View File

@@ -0,0 +1,14 @@
1
+package com.vaadin.test.osgi.myapplication1;
2
+
3
+import com.vaadin.osgi.resources.OsgiVaadinTheme;
4
+import com.vaadin.osgi.resources.OsgiVaadinWidgetset;
5
+import com.vaadin.ui.themes.ValoTheme;
6
+import org.osgi.service.component.annotations.Component;
7
+
8
+@Component
9
+public class CustomWidgetSet implements OsgiVaadinWidgetset {
10
+    @Override
11
+    public String getName() {
12
+        return "com.vaadin.test.osgi.widgetset.CustomWidgetSet";
13
+    }
14
+}

+ 13
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/KarafTestTheme.java View File

@@ -0,0 +1,13 @@
1
+package com.vaadin.test.osgi.myapplication1;
2
+
3
+import com.vaadin.osgi.resources.OsgiVaadinTheme;
4
+import com.vaadin.ui.themes.ValoTheme;
5
+import org.osgi.service.component.annotations.Component;
6
+
7
+@Component
8
+public class KarafTestTheme extends ValoTheme implements OsgiVaadinTheme {
9
+    @Override
10
+    public String getName() {
11
+        return "karaftesttheme";
12
+    }
13
+}

+ 45
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java View File

@@ -0,0 +1,45 @@
1
+package com.vaadin.test.osgi.myapplication1;
2
+
3
+import javax.servlet.annotation.WebServlet;
4
+
5
+import com.vaadin.annotations.Theme;
6
+import com.vaadin.annotations.Widgetset;
7
+import org.osgi.service.component.annotations.Component;
8
+
9
+import com.vaadin.annotations.VaadinServletConfiguration;
10
+import com.vaadin.server.VaadinRequest;
11
+import com.vaadin.server.VaadinServlet;
12
+import com.vaadin.ui.Button;
13
+import com.vaadin.ui.Label;
14
+import com.vaadin.ui.TextField;
15
+import com.vaadin.ui.UI;
16
+import com.vaadin.ui.VerticalLayout;
17
+
18
+@Theme("karaftesttheme")
19
+@Widgetset("com.vaadin.test.osgi.widgetset.CustomWidgetSet")
20
+public class MyUI extends UI {
21
+
22
+    @Override
23
+    protected void init(VaadinRequest vaadinRequest) {
24
+        final VerticalLayout layout = new VerticalLayout();
25
+
26
+        final TextField name = new TextField();
27
+        name.setCaption("Type your name here:");
28
+
29
+        Button button = new Button("Click Me");
30
+        button.addClickListener(e -> {
31
+            layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
32
+        });
33
+
34
+        layout.addComponents(name, button);
35
+
36
+        setContent(layout);
37
+    }
38
+
39
+    @Component(service = VaadinServlet.class)
40
+    @WebServlet(urlPatterns = "/myapp1/*", name = "MyUIServlet", asyncSupported = true)
41
+    @VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
42
+    public static class MyUIServlet extends VaadinServlet {
43
+    }
44
+
45
+}

+ 12
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/resources/VAADIN/themes/karaftesttheme/styles.scss View File

@@ -0,0 +1,12 @@
1
+@import "../valo/valo.scss";
2
+
3
+@mixin karaftesttheme {
4
+  @include valo;
5
+  .v-button {
6
+    color: rgba(255, 128, 128, 1)
7
+  }
8
+}
9
+
10
+.karaftesttheme {
11
+  @include karaftesttheme;
12
+}

+ 7
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/resources/com/vaadin/test/osgi/widgetset/CustomWidgetSet.gwt.xml View File

@@ -0,0 +1,7 @@
1
+<module>
2
+    <!-- Hint for WidgetSetBuilder not to automatically update the file -->
3
+    <!-- WS Compiler: manually edited -->
4
+
5
+    <inherits name="com.vaadin.DefaultWidgetSet" />
6
+
7
+</module>

+ 5
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle2/bnd.bnd View File

@@ -0,0 +1,5 @@
1
+Bundle-Name: ${project.name}
2
+Bundle-Version: ${project.version}
3
+Bundle-SymbolicName: ${project.groupId}.${project.artifactId}
4
+Import-Package: *
5
+Web-ContentPath: /myapp2

+ 154
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle2/pom.xml View File

@@ -0,0 +1,154 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+    <modelVersion>4.0.0</modelVersion>
5
+
6
+    <parent>
7
+        <artifactId>vaadin-test-karaf</artifactId>
8
+        <groupId>com.vaadin</groupId>
9
+        <relativePath>..</relativePath>
10
+        <version>8.1-SNAPSHOT</version>
11
+    </parent>
12
+    <artifactId>vaadin-karaf-bundle2</artifactId>
13
+    <packaging>jar</packaging>
14
+    <name>Vaadin Karaf test bundle 2</name>
15
+
16
+    <dependencyManagement>
17
+        <dependencies>
18
+            <dependency>
19
+                <groupId>com.vaadin</groupId>
20
+                <artifactId>vaadin-bom</artifactId>
21
+                <version>${vaadin.version}</version>
22
+                <type>pom</type>
23
+                <scope>import</scope>
24
+            </dependency>
25
+        </dependencies>
26
+    </dependencyManagement>
27
+
28
+    <dependencies>
29
+        <dependency>
30
+            <groupId>com.vaadin</groupId>
31
+            <artifactId>vaadin-server</artifactId>
32
+            <scope>provided</scope>
33
+        </dependency>
34
+        <dependency>
35
+            <groupId>com.vaadin</groupId>
36
+            <artifactId>vaadin-client-compiled</artifactId>
37
+            <scope>provided</scope>
38
+        </dependency>
39
+        <dependency>
40
+            <groupId>com.vaadin</groupId>
41
+            <artifactId>vaadin-themes</artifactId>
42
+            <scope>provided</scope>
43
+        </dependency>
44
+        <dependency>
45
+            <groupId>com.vaadin</groupId>
46
+            <artifactId>vaadin-osgi-integration</artifactId>
47
+            <version>8.1.0.beta1</version>
48
+            <scope>provided</scope>
49
+        </dependency>
50
+        <dependency>
51
+            <groupId>org.osgi</groupId>
52
+            <artifactId>osgi.core</artifactId>
53
+            <version>6.0.0</version>
54
+            <scope>provided</scope>
55
+        </dependency>
56
+        <dependency>
57
+            <groupId>org.osgi</groupId>
58
+            <artifactId>osgi.annotation</artifactId>
59
+            <version>6.0.1</version>
60
+            <scope>provided</scope>
61
+        </dependency>
62
+        <dependency>
63
+            <groupId>org.osgi</groupId>
64
+            <artifactId>osgi.cmpn</artifactId>
65
+            <version>6.0.0</version>
66
+            <scope>provided</scope>
67
+        </dependency>
68
+    </dependencies>
69
+
70
+
71
+    <build>
72
+        <plugins>
73
+            <plugin>
74
+                <groupId>biz.aQute.bnd</groupId>
75
+                <artifactId>bnd-maven-plugin</artifactId>
76
+                <version>3.3.0</version>
77
+                <executions>
78
+                    <execution>
79
+                        <goals>
80
+                            <goal>bnd-process</goal>
81
+                        </goals>
82
+                    </execution>
83
+                </executions>
84
+            </plugin>
85
+            <plugin>
86
+                <groupId>com.vaadin</groupId>
87
+                <artifactId>vaadin-maven-plugin</artifactId>
88
+                <version>${vaadin.plugin.version}</version>
89
+                <executions>
90
+                    <execution>
91
+                        <phase>process-resources</phase>
92
+                        <goals>
93
+                            <goal>compile-theme</goal>
94
+                        </goals>
95
+                    </execution>
96
+                </executions>
97
+            </plugin>
98
+            <plugin>
99
+                <groupId>org.apache.maven.plugins</groupId>
100
+                <artifactId>maven-jar-plugin</artifactId>
101
+                <version>3.0.2</version>
102
+                <configuration>
103
+                    <archive>
104
+                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
105
+                    </archive>
106
+                </configuration>
107
+            </plugin>
108
+        </plugins>
109
+    </build>
110
+
111
+    <profiles>
112
+        <profile>
113
+            <!-- Vaadin pre-release repositories -->
114
+            <id>vaadin-prerelease</id>
115
+            <activation>
116
+                <activeByDefault>true</activeByDefault>
117
+            </activation>
118
+
119
+            <repositories>
120
+                <repository>
121
+                    <id>vaadin-prereleases</id>
122
+                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
123
+                </repository>
124
+                <repository>
125
+                    <id>vaadin-snapshots</id>
126
+                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
127
+                    <releases>
128
+                        <enabled>false</enabled>
129
+                    </releases>
130
+                    <snapshots>
131
+                        <enabled>true</enabled>
132
+                    </snapshots>
133
+                </repository>
134
+            </repositories>
135
+            <pluginRepositories>
136
+                <pluginRepository>
137
+                    <id>vaadin-prereleases</id>
138
+                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
139
+                </pluginRepository>
140
+                <pluginRepository>
141
+                    <id>vaadin-snapshots</id>
142
+                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
143
+                    <releases>
144
+                        <enabled>false</enabled>
145
+                    </releases>
146
+                    <snapshots>
147
+                        <enabled>true</enabled>
148
+                    </snapshots>
149
+                </pluginRepository>
150
+            </pluginRepositories>
151
+        </profile>
152
+    </profiles>
153
+
154
+</project>

+ 42
- 0
test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java View File

@@ -0,0 +1,42 @@
1
+package com.vaadin.test.osgi.myapplication;
2
+
3
+import javax.servlet.annotation.WebServlet;
4
+
5
+import com.vaadin.annotations.Theme;
6
+import org.osgi.service.component.annotations.Component;
7
+
8
+import com.vaadin.annotations.VaadinServletConfiguration;
9
+import com.vaadin.server.VaadinRequest;
10
+import com.vaadin.server.VaadinServlet;
11
+import com.vaadin.ui.Button;
12
+import com.vaadin.ui.Label;
13
+import com.vaadin.ui.TextField;
14
+import com.vaadin.ui.UI;
15
+import com.vaadin.ui.VerticalLayout;
16
+
17
+public class MyUI extends UI {
18
+
19
+    @Override
20
+    protected void init(VaadinRequest vaadinRequest) {
21
+        final VerticalLayout layout = new VerticalLayout();
22
+
23
+        final TextField name = new TextField();
24
+        name.setCaption("Type your name here:");
25
+
26
+        Button button = new Button("Click Me");
27
+        button.addClickListener(e -> {
28
+            layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
29
+        });
30
+
31
+        layout.addComponents(name, button);
32
+
33
+        setContent(layout);
34
+    }
35
+
36
+    @Component(service = VaadinServlet.class)
37
+    @WebServlet(urlPatterns = "/myapp2/*", name = "MyUIServlet", asyncSupported = true)
38
+    @VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
39
+    public static class MyUIServlet extends VaadinServlet {
40
+    }
41
+
42
+}

Loading…
Cancel
Save