diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 94014d6..0000000 --- a/.drone.yml +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright © 2013 Sven Ruppert (sven.ruppert@gmail.com) -# -# 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. -# - -workspace: - base: /drone/src - path: rapidpm-dependencies - -pipeline: - build: - image: ${JDK_VERSION} - pull: true - commands: - - mkdir /root/.m2 -# - cp /drone/src/rapidpm-dependencies/_data/nexus/settings.xml /root/.m2/settings.xml - - mvn clean - - mvn test - -# deploy: -# image: ${JDK_VERSION} -# pull: true -# commands: -# - mkdir /root/.m2 -# - cp /drone/src/rapidpm-dependencies/_data/nexus/settings.xml /root/.m2/settings.xml -# - mvn clean -# - mvn deploy -# when: -# matrix: -# JDK_VERSION: svenruppert/maven-3.5-jdk-10 -# branches: -# include: develop, release/* -# exclude: feature/* - - -matrix: - JDK_VERSION: - - maven:3.5-jdk-8-alpine - - svenruppert/maven-3.5-jdk-08 - - svenruppert/maven-3.5-jdk-openjdk-09 - - svenruppert/maven-3.5-jdk-openjdk-10 - - svenruppert/maven-3.5-jdk-openjdk-11 - - svenruppert/maven-3.5-jdk-openjdk-shenandoah-08 - - svenruppert/maven-3.5-jdk-openjdk-shenandoah-09 - - svenruppert/maven-3.5-jdk-openjdk-shenandoah-10 - - svenruppert/maven-3.5-jdk-graalvm-ce-01 - - svenruppert/maven-3.5-jdk-oracle-08 - - svenruppert/maven-3.5-jdk-oracle-10 - - svenruppert/maven-3.5-jdk-oracle-11 - - svenruppert/maven-3.5-jdk-zulu-08 - - svenruppert/maven-3.5-jdk-zulu-09 - - svenruppert/maven-3.5-jdk-zulu-10 - - svenruppert/maven-3.5-jdk-ibm-08 -# - maven:3.5-ibmjava-8-alpine -# - maven:3.5-ibmjava-9-alpine diff --git a/README.md b/README.md index 0ddf388..7bf556b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ #Parent POM for Vaadin Tutorials ## Current state -[![](https://jitpack.io/v/vaadin-learning-center/vaadin-dependencies.svg)](https://jitpack.io/#vaadin-learning-center/vaadin-dependencies) -[![](https://jitci.com/gh/vaadin-learning-center/vaadin-dependencies/svg)](https://jitci.com/gh/vaadin-learning-center/vaadin-dependencies) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) @@ -13,16 +11,16 @@ This project is a minimized version of [https://github.com/RapidPM/rapidpm-dependencies](https://github.com/RapidPM/rapidpm-dependencies) ## How to use -The dependency is distributed via -jitpack [https://jitpack.io/#vaadin-learning-center/vaadin-dependencies/](https://jitpack.io/#vaadin-learning-center/vaadin-dependencies/) - +The dependency is distributed via Bintray. Add first to repository coordinates to your **pom.xml** ```xml - jitpack.io - https://jitpack.io + bintray + bintray-vaadin-tutorials-maven + https://dl.bintray.com/vaadin-tutorials/maven + false ``` @@ -33,7 +31,7 @@ This project supports all LTS versions up from Vaadin8 and the current version. ### V8 (LTS) ```xml - com.github.vaadin-learning-center.vaadin-dependencies + org.vaadintutorials vaadin-dependencies-v08 XXXX @@ -41,7 +39,7 @@ This project supports all LTS versions up from Vaadin8 and the current version. ### V10 (LTS) ```xml - com.github.vaadin-learning-center.vaadin-dependencies + org.vaadintutorials vaadin-dependencies-v10 XXXX @@ -49,7 +47,7 @@ This project supports all LTS versions up from Vaadin8 and the current version. ### V14 (LTS) ```xml - com.github.vaadin-learning-center.vaadin-dependencies + org.vaadintutorials vaadin-dependencies-v14 XXXX @@ -57,7 +55,7 @@ This project supports all LTS versions up from Vaadin8 and the current version. ### Current ```xml - com.github.vaadin-learning-center.vaadin-dependencies + org.vaadintutorials vaadin-dependencies-vXX XXXX @@ -68,6 +66,12 @@ This project supports all LTS versions up from Vaadin8 and the current version. ### NEXT * TBD +### 2.0.0 +* changed structure +* switched to bintray repos +* using nano-vaadin for jetty and undertow + + ### 1.0.6 * added java-faker to scope test diff --git a/core/pom.xml b/core/pom.xml index 551a498..c452d05 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -1,7 +1,7 @@ vaadin-dependencies - org.vaadin - 0.0.0-SNAPSHOT + org.vaadintutorials + 2.0.0 4.0.0 @@ -13,14 +30,15 @@ - org.vaadin + org.vaadintutorials vaadin-dependencies-core compile + - org.vaadin - vaadin-dependencies-nano-jetty + org.rapidpm.vaadin + nano-vaadin-jetty compile diff --git a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/ServletContainerExtension.java b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/ServletContainerExtension.java deleted file mode 100644 index 63519bb..0000000 --- a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/ServletContainerExtension.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.vaadin.tutorial.nano.jetty.junit5; - -import org.junit.jupiter.api.extension.AfterEachCallback; -import org.junit.jupiter.api.extension.BeforeEachCallback; -import org.junit.jupiter.api.extension.ExtensionContext; -import org.vaadin.tutorial.nano.jetty.CoreUIService; - - -public class ServletContainerExtension - implements BeforeEachCallback, AfterEachCallback { - - @Override - public void beforeEach(ExtensionContext ctx) throws Exception { -// Stagemonitor.init(); - final CoreUIService uiService = new CoreUIService(); - uiService.startup(); - ctx.getStore(ExtensionContext.Namespace.GLOBAL) - .put(CoreUIService.class.getSimpleName(), uiService); - } - - - @Override - public void afterEach(ExtensionContext ctx) throws Exception { - ctx.getStore(ExtensionContext.Namespace.GLOBAL) - .get(CoreUIService.class.getSimpleName(), CoreUIService.class).jetty.ifPresent(server -> { - try { - server.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - }); - } -} diff --git a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/VaadinTutorial.java b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/VaadinTutorial.java deleted file mode 100644 index f7d2578..0000000 --- a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/VaadinTutorial.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.vaadin.tutorial.nano.jetty.junit5; - -import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; -import org.junit.jupiter.api.extension.ExtendWith; - -import java.lang.annotation.*; - -@Target({ElementType.TYPE, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Inherited -@ExtendWith(ServletContainerExtension.class) -@ExtendWith(WebdriverExtension.class) -@ExtendWith(WebDriverParameterResolver.class) -@EnabledIfEnvironmentVariable(named = "TESTBENCH", matches = "on") -public @interface VaadinTutorial { } diff --git a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/ServletContainerExtension.java b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/ServletContainerExtension.java new file mode 100644 index 0000000..24dc922 --- /dev/null +++ b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/ServletContainerExtension.java @@ -0,0 +1,47 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; + +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.rapidpm.vaadin.nano.CoreUIServiceJava; + + +public class ServletContainerExtension + implements BeforeEachCallback, AfterEachCallback { + + @Override + public void beforeEach(ExtensionContext ctx) throws Exception { + final CoreUIServiceJava uiService = new CoreUIServiceJava(); + uiService.startup(); + ctx.getStore(ExtensionContext.Namespace.GLOBAL) + .put(CoreUIServiceJava.class.getSimpleName(), uiService); + } + + + @Override + public void afterEach(ExtensionContext ctx) throws Exception { + ctx.getStore(ExtensionContext.Namespace.GLOBAL) + .get(CoreUIServiceJava.class.getSimpleName(), CoreUIServiceJava.class).jetty.ifPresent(server -> { + try { + server.stop(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + } +} diff --git a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/VaadinTutorial.java b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/VaadinTutorial.java new file mode 100644 index 0000000..a012b6e --- /dev/null +++ b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/VaadinTutorial.java @@ -0,0 +1,31 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; + +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; +import org.junit.jupiter.api.extension.ExtendWith; + +import java.lang.annotation.*; + +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +@ExtendWith(ServletContainerExtension.class) +@ExtendWith(WebdriverExtension.class) +@ExtendWith(WebDriverParameterResolver.class) +@EnabledIfEnvironmentVariable(named = "TESTBENCH", matches = "on") +public @interface VaadinTutorial { } diff --git a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/WebDriverParameterResolver.java b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebDriverParameterResolver.java similarity index 90% rename from nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/WebDriverParameterResolver.java rename to nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebDriverParameterResolver.java index abf6919..d1d1f74 100644 --- a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/WebDriverParameterResolver.java +++ b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebDriverParameterResolver.java @@ -1,4 +1,19 @@ -package org.vaadin.tutorial.nano.jetty.junit5; +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; diff --git a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/WebdriverExtension.java b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebdriverExtension.java similarity index 73% rename from nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/WebdriverExtension.java rename to nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebdriverExtension.java index a0391ca..0097216 100644 --- a/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/jetty/junit5/WebdriverExtension.java +++ b/nano-jetty-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebdriverExtension.java @@ -1,4 +1,19 @@ -package org.vaadin.tutorial.nano.jetty.junit5; +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; diff --git a/nano-jetty-junit5/src/test/java/demo/DemoAppServlet.java b/nano-jetty-junit5/src/test/java/demo/DemoAppServlet.java index bba24af..0bd3deb 100644 --- a/nano-jetty-junit5/src/test/java/demo/DemoAppServlet.java +++ b/nano-jetty-junit5/src/test/java/demo/DemoAppServlet.java @@ -1,3 +1,18 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 demo; import javax.servlet.ServletException; diff --git a/nano-jetty-junit5/src/test/java/junit/org/vaadin/tutorialnano/jetty/junit5/VaadinTutorialTest.java b/nano-jetty-junit5/src/test/java/junit/org/vaadin/tutorialnano/jetty/junit5/VaadinTutorialTest.java index f674a03..978cc9e 100644 --- a/nano-jetty-junit5/src/test/java/junit/org/vaadin/tutorialnano/jetty/junit5/VaadinTutorialTest.java +++ b/nano-jetty-junit5/src/test/java/junit/org/vaadin/tutorialnano/jetty/junit5/VaadinTutorialTest.java @@ -1,11 +1,26 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 junit.org.vaadin.tutorialnano.jetty.junit5; import demo.DemoAppServlet; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.vaadin.tutorial.nano.jetty.junit5.VaadinTutorial; -import org.vaadin.tutorial.nano.jetty.junit5.WebDriverParameterResolver.GenericPageObject; +import org.vaadin.tutorial.nano.junit5.VaadinTutorial; +import org.vaadin.tutorial.nano.junit5.WebDriverParameterResolver.GenericPageObject; @VaadinTutorial public class VaadinTutorialTest { diff --git a/nano-jetty/pom.xml b/nano-jetty/pom.xml deleted file mode 100644 index 1b99504..0000000 --- a/nano-jetty/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - vaadin-dependencies - org.vaadin - 0.0.0-SNAPSHOT - - 4.0.0 - - vaadin-dependencies-nano-jetty - - - 9.4.19.v20190610 - - - - - - - - - - - org.vaadin - vaadin-dependencies-core - - - - javax.servlet - javax.servlet-api - - - - org.eclipse.jetty - jetty-continuation - ${jetty.version} - - - org.eclipse.jetty - jetty-server - ${jetty.version} - - - org.eclipse.jetty.websocket - websocket-server - ${jetty.version} - - - org.eclipse.jetty.websocket - javax-websocket-server-impl - ${jetty.version} - - - - commons-cli - commons-cli - - - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-simple - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - vaadin-app - - - - - org.vaadin.tutorial.nano.jetty.NanoVaadin - - - - - - - - - - \ No newline at end of file diff --git a/nano-jetty/src/main/java/org/vaadin/tutorial/nano/jetty/CoreUIService.java b/nano-jetty/src/main/java/org/vaadin/tutorial/nano/jetty/CoreUIService.java deleted file mode 100644 index 1c67796..0000000 --- a/nano-jetty/src/main/java/org/vaadin/tutorial/nano/jetty/CoreUIService.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright © 2017 Sven Ruppert (sven.ruppert@gmail.com) - *

- * 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 org.vaadin.tutorial.nano.jetty; - -import org.eclipse.jetty.annotations.AnnotationConfiguration; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.webapp.*; -import org.rapidpm.dependencies.core.logger.HasLogger; -import org.rapidpm.frp.model.Result; - -import static java.lang.System.getProperty; -import static org.rapidpm.frp.model.Result.failure; - -/** - * - */ -public class CoreUIService - implements HasLogger { - - public static final String JAR_PATTERN = "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern"; - - public static final String CORE_UI_SERVER_HOST_DEFAULT = "0.0.0.0"; - public static final String CORE_UI_SERVER_PORT_DEFAULT = "8899"; - - public static final String CORE_UI_SERVER_HOST = "core-ui-server-host"; - public static final String CORE_UI_SERVER_PORT = "core-ui-server-port"; - - public Result jetty = failure("not initialised so far"); - - public void startupAndBlock() { - try { - startup(); - jetty.get() - .join(); -// jetty = Result.success(server); - } catch (Exception e) { - logger().warning(e.getLocalizedMessage()); - } - } - - public void startup() { - initServer(); - try { - jetty.get() - .start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * This will init the Server instance only - */ - - public void initServer() { - WebAppContext context = new WebAppContext(); - context.setLogUrlOnStart(true); - context.setConfigurationDiscovered(true); - context.setConfigurations(new Configuration[]{ - new AnnotationConfiguration(), new WebInfConfiguration(), new WebXmlConfiguration(), new MetaInfConfiguration() - }); - - context.setContextPath("/"); - Resource classPathResource = Resource.newClassPathResource("/META-INF/resources", true, true); - context.setBaseResource(classPathResource); - context.setAllowNullPathInfo(true); - context.setAttribute(JAR_PATTERN, ".*"); - - Server server = new Server(Integer.parseInt(getProperty(CORE_UI_SERVER_PORT, CORE_UI_SERVER_PORT_DEFAULT))); - server.setHandler(context); - jetty = Result.success(server); - } -} diff --git a/nano-jetty/src/main/java/org/vaadin/tutorial/nano/jetty/NanoVaadin.java b/nano-jetty/src/main/java/org/vaadin/tutorial/nano/jetty/NanoVaadin.java deleted file mode 100644 index 71214f0..0000000 --- a/nano-jetty/src/main/java/org/vaadin/tutorial/nano/jetty/NanoVaadin.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright © 2017 Sven Ruppert (sven.ruppert@gmail.com) - *

- * 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 org.vaadin.tutorial.nano.jetty; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; - -import static java.lang.System.setProperty; - - -/** - * - */ -public class NanoVaadin { - private NanoVaadin() { - } - - public static final String APM = "apm"; - - public static final String CLI_HOST = "host"; - public static final String CLI_PORT = "port"; - - public static void main(String[] args) throws ParseException { - //init i18n - final Options options = new Options(); - options.addOption(CLI_HOST, true, "host to use"); - options.addOption(CLI_PORT, true, "port to use"); - options.addOption(APM, false, "activate APM on"); - - DefaultParser parser = new DefaultParser(); - CommandLine cmd = parser.parse(options, args); - - if (cmd.hasOption(CLI_HOST)) { - setProperty(CoreUIService.CORE_UI_SERVER_HOST, cmd.getOptionValue(CLI_HOST)); - } if (cmd.hasOption(CLI_PORT)) { - setProperty(CoreUIService.CORE_UI_SERVER_PORT, cmd.getOptionValue(CLI_PORT)); - } if(cmd.hasOption(APM)){ - //Stagemonitor.init(); - } - new CoreUIService().startupAndBlock(); - } -} diff --git a/nano-jetty/src/test/java/junit/org/vaadin/tutorial/nano/jetty/CoreUIServiceTest.java b/nano-jetty/src/test/java/junit/org/vaadin/tutorial/nano/jetty/CoreUIServiceTest.java deleted file mode 100644 index e28141c..0000000 --- a/nano-jetty/src/test/java/junit/org/vaadin/tutorial/nano/jetty/CoreUIServiceTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package junit.org.vaadin.tutorial.nano.jetty; - -import org.junit.jupiter.api.Test; -import org.vaadin.tutorial.nano.jetty.CoreUIService; - -public class CoreUIServiceTest { - - - @Test - void test001() throws Exception { - final CoreUIService service = new CoreUIService(); - service.initServer(); - - service.jetty.get().stop(); - - - } -} diff --git a/nano-undertow-junit5/pom.xml b/nano-undertow-junit5/pom.xml new file mode 100644 index 0000000..0089a90 --- /dev/null +++ b/nano-undertow-junit5/pom.xml @@ -0,0 +1,79 @@ + + + + + vaadin-dependencies + org.vaadintutorials + 2.0.0 + + 4.0.0 + + vaadin-dependencies-nano-undertow-junit5 + + + + org.vaadintutorials + vaadin-dependencies-core + compile + + + + + org.rapidpm.vaadin + nano-vaadin-undertow + compile + + + org.junit.jupiter + junit-jupiter-api + compile + + + org.junit.jupiter + junit-jupiter-engine + compile + + + org.seleniumhq.selenium + selenium-api + 3.141.59 + compile + + + + org.testcontainers + selenium + compile + + + org.testcontainers + testcontainers + compile + + + org.seleniumhq.selenium + selenium-chrome-driver + 3.141.59 + compile + + + + \ No newline at end of file diff --git a/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/ServletContainerExtension.java b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/ServletContainerExtension.java new file mode 100644 index 0000000..03a7947 --- /dev/null +++ b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/ServletContainerExtension.java @@ -0,0 +1,47 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; + +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.rapidpm.vaadin.nano.CoreUIServiceJava; + + +public class ServletContainerExtension + implements BeforeEachCallback, AfterEachCallback { + + @Override + public void beforeEach(ExtensionContext ctx) throws Exception { + final CoreUIServiceJava uiService = new CoreUIServiceJava(); + uiService.startup(); + ctx.getStore(ExtensionContext.Namespace.GLOBAL) + .put(CoreUIServiceJava.class.getSimpleName(), uiService); + } + + + @Override + public void afterEach(ExtensionContext ctx) throws Exception { + ctx.getStore(ExtensionContext.Namespace.GLOBAL) + .get(CoreUIServiceJava.class.getSimpleName(), CoreUIServiceJava.class).undertow.ifPresent(server -> { + try { + server.stop(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + } +} diff --git a/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/VaadinTutorial.java b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/VaadinTutorial.java new file mode 100644 index 0000000..a012b6e --- /dev/null +++ b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/VaadinTutorial.java @@ -0,0 +1,31 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; + +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; +import org.junit.jupiter.api.extension.ExtendWith; + +import java.lang.annotation.*; + +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +@ExtendWith(ServletContainerExtension.class) +@ExtendWith(WebdriverExtension.class) +@ExtendWith(WebDriverParameterResolver.class) +@EnabledIfEnvironmentVariable(named = "TESTBENCH", matches = "on") +public @interface VaadinTutorial { } diff --git a/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebDriverParameterResolver.java b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebDriverParameterResolver.java new file mode 100644 index 0000000..d1d1f74 --- /dev/null +++ b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebDriverParameterResolver.java @@ -0,0 +1,138 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.openqa.selenium.WebDriver; +import org.rapidpm.dependencies.core.logger.HasLogger; +import org.rapidpm.frp.Transformations; +import org.rapidpm.frp.functions.CheckedPredicate; +import org.rapidpm.frp.functions.CheckedSupplier; +import org.testcontainers.containers.BrowserWebDriverContainer; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.util.Collections; +import java.util.Enumeration; +import java.util.function.Supplier; + +import static org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL; +import static org.rapidpm.frp.StringFunctions.notEmpty; +import static org.rapidpm.frp.StringFunctions.notStartsWith; +import static org.rapidpm.frp.Transformations.not; + +public class WebDriverParameterResolver + implements ParameterResolver, HasLogger { + + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + final Class type = parameterContext.getParameter() + .getType(); + return GenericPageObject.class.isAssignableFrom(type); + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + + final BrowserWebDriverContainer container = extensionContext.getStore(GLOBAL) + .get(BrowserWebDriverContainer.class.getSimpleName(), + BrowserWebDriverContainer.class); + + + final String property = System.getProperty("os.name"); + final boolean osx = property.contains("Mac OS X"); + +// return new WebDriverInfo(container.getWebDriver(), (osx) +// ? "host.docker.internal" +// : localeIP().get(), container.getVncAddress()); + final Class type = parameterContext.getParameter() + .getType(); + + try { + final Constructor declaredConstructor = type.getDeclaredConstructor(WebDriver.class, String.class, + String.class); + return declaredConstructor.newInstance((WebDriver) container.getWebDriver(), localeIP().get(), + container.getVncAddress()); + } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { + logger().warning(e.getMessage()); + } + throw new RuntimeException("no Page Object created"); +// return ReflectionUtils.newInstance(type, (WebDriver)container.getWebDriver(), localeIP().get(), container.getVncAddress()); +// return new GenericPageObject(container.getWebDriver(), localeIP().get(), container.getVncAddress()); + } + + public static class GenericPageObject { + private WebDriver webdriver; + private String hostIpAddress; + private String vncAdress; + + public GenericPageObject(WebDriver webdriver, String hostIpAddress, String vncAdress) { + this.webdriver = webdriver; + this.hostIpAddress = hostIpAddress; + this.vncAdress = vncAdress; + } + + public WebDriver getWebdriver() { + return webdriver; + } + + public String getHostIpAddress() { + return hostIpAddress; + } + + public String getVncAdress() { + return vncAdress; + } + } + + public static Supplier localeIP() { + return () -> { + final CheckedSupplier> checkedSupplier = NetworkInterface::getNetworkInterfaces; + + return Transformations.enumToStream().apply( + checkedSupplier.getOrElse(Collections::emptyEnumeration)) + .filter( + (CheckedPredicate) NetworkInterface::isUp) + .map(NetworkInterface::getInetAddresses) + .flatMap( + iaEnum -> Transformations.enumToStream().apply( + iaEnum)) + .filter(inetAddress -> inetAddress instanceof Inet4Address) + .filter(not(InetAddress::isMulticastAddress)) + .filter(not(InetAddress::isLoopbackAddress)) + .map(InetAddress::getHostAddress) + .filter(notEmpty()) + .filter(adr -> notStartsWith().apply(adr, "127")) + .filter(adr -> notStartsWith().apply(adr, "169.254")) + .filter( + adr -> notStartsWith().apply(adr, "255.255.255.255")) + .filter( + adr -> notStartsWith().apply(adr, "255.255.255.255")) + .filter(adr -> notStartsWith().apply(adr, "0.0.0.0")) + // .filter(adr -> range(224, 240).noneMatch(nr -> adr.startsWith(valueOf(nr)))) + .findFirst() + .orElse("localhost"); + }; + } +} diff --git a/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebdriverExtension.java b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebdriverExtension.java new file mode 100644 index 0000000..0097216 --- /dev/null +++ b/nano-undertow-junit5/src/main/java/org/vaadin/tutorial/nano/junit5/WebdriverExtension.java @@ -0,0 +1,74 @@ +/** + * Copyright © 2019 Vaadin - Marketing Team - Developer Relations (devrel@vaadin.com) + * + * 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 org.vaadin.tutorial.nano.junit5; + +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.openqa.selenium.chrome.ChromeOptions; +import org.testcontainers.containers.BrowserWebDriverContainer; +import org.testcontainers.containers.DefaultRecordingFileFactory; +import org.testcontainers.lifecycle.TestDescription; + +import java.io.File; +import java.util.Optional; + +import static org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL; +import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL; + +public class WebdriverExtension implements + BeforeEachCallback, + AfterEachCallback { + + @Override + public void beforeEach(ExtensionContext extensionContext) throws Exception { + + final BrowserWebDriverContainer container = new BrowserWebDriverContainer() + .withCapabilities(new ChromeOptions()) + .withRecordingMode(RECORD_ALL , new File("./target/")) +// .withRecordingMode(SKIP , new File("./target/")) + .withRecordingFileFactory(new DefaultRecordingFileFactory()); + + container.start(); + extensionContext + .getStore(GLOBAL) + .put(BrowserWebDriverContainer.class.getSimpleName() , container); + + } + + @Override + public void afterEach(ExtensionContext extensionContext) throws Exception { + + final BrowserWebDriverContainer container = extensionContext + .getStore(GLOBAL) + .get(BrowserWebDriverContainer.class.getSimpleName() , BrowserWebDriverContainer.class); + + final String uniqueId = extensionContext.getUniqueId(); + final String name = extensionContext.getRequiredTestMethod().getName(); + + + container.afterTest(new TestDescription() { + @Override + public String getTestId() { return uniqueId; } + + @Override + public String getFilesystemFriendlyName() { return name; } + } , Optional.empty()); + + container + .stop(); + } +} diff --git a/pom.xml b/pom.xml index f7a4bd9..e39836f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ - 0.0.0-SNAPSHOT + 2.0.0 2019 @@ -98,7 +98,7 @@ 2.12.1 0.8.4 - 1.4.9 + 1.4.10 0.9 org.vaadin.* junit.org.vaadin* @@ -106,27 +106,27 @@ 1.21 - 5.5.1 - 1.5.1 + 5.5.2 + 1.5.2 1.0.0-M5 0.33.0 7.1 - 1.12.0 + 1.12.2 - 8.8.5 + 8.8.6 5.2.0 - 10.0.16 + 10.0.17 6.2.0 - 14.0.2 + 14.0.8 6.2.0 - 14.0.2 + 15.0.0.alpha1 6.2.0 4.0.1 @@ -135,20 +135,32 @@ 0.89.0 0.33.0 - 1.10.0 + 1.10.1 + + + + + bintray-vaadin-tutorials-maven + vaadin-tutorials-maven + https://api.bintray.com/maven/vaadin-tutorials/maven/vaadin-dependencies/;publish=1 + + + + + - jitpack.io - https://jitpack.io + bintray-vaadin-tutorials-maven + bintray + https://dl.bintray.com/vaadin-tutorials/maven + false central https://repo1.maven.org/maven2/ - - false - + false @@ -159,27 +171,27 @@ Vaadin - Prereleases https://maven.vaadin.com/vaadin-prereleases - - false - + false + + bintray-plugins + bintray-vaadin-tutorials-maven + https://dl.bintray.com/vaadin-tutorials/maven + false + central https://repo1.maven.org/maven2/ - - false - + false Vaadin - Prereleases https://maven.vaadin.com/vaadin-prereleases - - false - + false @@ -187,23 +199,24 @@ - + - org.vaadin + org.vaadintutorials vaadin-dependencies-core - 0.0.0-SNAPSHOT - - - org.vaadin - vaadin-dependencies-nano-jetty - 0.0.0-SNAPSHOT + 2.0.0 + - org.vaadin + org.vaadintutorials vaadin-dependencies-nano-jetty-junit5 - 0.0.0-SNAPSHOT + 2.0.0 + + org.vaadintutorials + vaadin-dependencies-nano-undertow-junit5 + 2.0.0 + @@ -222,13 +235,13 @@ net.oneandone.reflections8 reflections8 - 0.11.5 + 0.11.6 org.javassist javassist - 3.25.0-GA + 3.26.0-GA @@ -236,19 +249,19 @@ org.rapidpm rapidpm-functional-reactive - 01.00.03-RPM + 01.00.04-RPM org.rapidpm rapidpm-logger-adapter - 01.00.03-RPM + 01.00.04-RPM com.google.code.gson gson - 2.8.5 + 2.8.6 true @@ -269,7 +282,7 @@ org.apache.commons commons-compress - 1.18 + 1.19 org.apache.commons @@ -284,17 +297,17 @@ org.apache.commons commons-vfs2 - 2.4 + 2.4.1 org.apache.httpcomponents httpclient - 4.5.9 + 4.5.10 org.apache.httpcomponents fluent-hc - 4.5.9 + 4.5.10 @@ -328,7 +341,7 @@ com.zaxxer HikariCP - 3.3.1 + 3.4.1 compile @@ -343,6 +356,17 @@ 3.0.2 + + + org.rapidpm.vaadin + nano-vaadin-undertow + 01.00.02-RPM + + + org.rapidpm.vaadin + nano-vaadin-jetty + 01.00.01-RPM + @@ -439,7 +463,7 @@ com.github.javafaker javafaker - 1.0.0 + 1.0.1 test @@ -448,7 +472,7 @@ io.gatling.highcharts gatling-charts-highcharts - 3.2.0 + 3.2.1 test @@ -523,7 +547,7 @@ core - nano-jetty + nano-undertow-junit5 nano-jetty-junit5 vaadin-v08 vaadin-v10 @@ -610,7 +634,7 @@ jcip-annotations - + org.testcontainers testcontainers @@ -802,7 +826,7 @@ frontend-maven-plugin - 1.7.6 + 1.8.0 @@ -990,10 +1014,14 @@

com/mycila/maven/plugin/license/templates/APACHE-2.txt
- Sven Ruppert - sven.ruppert@gmail.com + Vaadin - Marketing Team - Developer Relations + devrel@vaadin.com + package.json + package-lock.json + webpack.config.js + webpack.generated.js **/node/** **/node_modules/** **/*.iml diff --git a/vaadin-v08/pom.xml b/vaadin-v08/pom.xml index cea2fe7..1da1cb3 100644 --- a/vaadin-v08/pom.xml +++ b/vaadin-v08/pom.xml @@ -1,7 +1,7 @@ + + org.rapidpm.vaadin + nano-vaadin-undertow + + + + org.vaadintutorials + vaadin-dependencies-core + + com.vaadin - - vaadin - - - - com.vaadin.webjar - * - - - org.webjars.bowergithub.insites - * - - - org.webjars.bowergithub.polymer - * - - - org.webjars.bowergithub.polymerelements - * - - - org.webjars.bowergithub.vaadin - * - - - org.webjars.bowergithub.webcomponents - * - - + flow-server + + + com.vaadin + flow-push + + + com.vaadin + flow-client + + + com.vaadin + flow-html-components + + + com.vaadin + flow-data + + + + + org.vaadintutorials + vaadin-dependencies-nano-undertow-junit5 @@ -159,6 +162,7 @@ ${vaadin-v14.version} + test-compile prepare-frontend build-frontend diff --git a/vaadin-vXX/pom.xml b/vaadin-vXX/pom.xml index cb4d707..e99e370 100644 --- a/vaadin-vXX/pom.xml +++ b/vaadin-vXX/pom.xml @@ -1,7 +1,7 @@ + + org.rapidpm.vaadin + nano-vaadin-undertow + + + + org.vaadintutorials + vaadin-dependencies-core + com.vaadin - - vaadin - - - - com.vaadin.webjar - * - - - org.webjars.bowergithub.insites - * - - - org.webjars.bowergithub.polymer - * - - - org.webjars.bowergithub.polymerelements - * - - - org.webjars.bowergithub.vaadin - * - - - org.webjars.bowergithub.webcomponents - * - - + flow-server + + com.vaadin + flow-push + + + com.vaadin + flow-client + + + com.vaadin + flow-html-components + + + com.vaadin + flow-data + + + + + org.vaadintutorials + vaadin-dependencies-nano-undertow-junit5 + + com.vaadin vaadin-testbench @@ -156,6 +159,7 @@ ${vaadin-vXX.version} + test-compile prepare-frontend build-frontend