From 3d9077b39f25e4dc4992dbe06c784d01bb9d04ac Mon Sep 17 00:00:00 2001
From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com>
Date: Thu, 3 Oct 2024 17:10:49 -0300
Subject: [PATCH] feat: initial implementation
---
.gitignore | 23 +-
README.md | 69 ++-
addon-utils/.gitignore | 21 +
addon-utils/pom.xml | 306 +++++++++++
.../utils/checker/AllowedPackageChecker.java | 114 +++++
.../addons/utils/checker/AllowedPackages.java | 26 +
.../utils/checker/AllowedPackagesImpl.java | 56 ++
.../VaadinServiceInitListenerImpl.java | 85 ++++
...adin.flow.server.VaadinServiceInitListener | 1 +
.../utils/checker/TestAllowedPackages.java | 68 +++
.../checker/TestAllowedPackagesChecker.java | 76 +++
.../TestVaadinServiceInitListenerImpl.java | 92 ++++
pom.xml | 479 +-----------------
.../frontend/styles/static_addon_styles | 1 -
.../META-INF/resources/static_addon_resources | 1 -
.../vaadin/addons/template/TemplateDemo.java | 17 -
.../addons/template/it/AbstractViewTest.java | 106 ----
.../vaadin/addons/template/it/ViewIT.java | 64 ---
.../template/test/SerializationTest.java | 52 --
.../frontend/styles/shared-styles.css | 1 -
.../resources/static_addon_test_resources | 1 -
test-jetty/.gitignore | 24 +
test-jetty/pom.xml | 144 ++++++
.../example/application/GoodComponent.java | 20 +-
.../com/example/application/GoodView.java | 21 +-
.../META-INF/resources/icons/icon.png | Bin 0 -> 2424 bytes
.../AllowedPackageCheckerJettyIT.java | 37 ++
test-spring-boot-v14/.gitignore | 28 +
test-spring-boot-v14/pom.xml | 157 ++++++
.../com/example/application/Application.java | 32 ++
.../java/com/example/application/BadView.java | 27 +-
.../example/application/GoodComponent.java | 34 ++
.../com/example/application/GoodView.java | 28 +-
.../com/example/disallowed/BadComponent.java | 34 ++
.../META-INF/resources/icons/icon.png | Bin 0 -> 2424 bytes
.../src/main/resources/application.properties | 7 +
.../src/main/resources/banner.txt | 1 +
.../AllowedPackageChecker14IT.java | 73 +++
test-spring-boot-v23/.gitignore | 27 +
test-spring-boot-v23/pom.xml | 147 ++++++
.../com/example/application/Application.java | 34 ++
.../java/com/example/application/BadView.java | 35 ++
.../example/application/GoodComponent.java | 34 ++
.../com/example/application/GoodView.java | 34 ++
.../com/example/disallowed/BadComponent.java | 34 ++
.../META-INF/resources/icons/icon.png | Bin 0 -> 2424 bytes
.../src/main/resources/application.properties | 7 +
.../src/main/resources/banner.txt | 1 +
.../AllowedPackageChecker23IT.java | 67 +++
test-spring-boot-v24/.gitignore | 23 +
test-spring-boot-v24/pom.xml | 147 ++++++
.../com/example/application/Application.java | 32 ++
.../java/com/example/application/BadView.java | 35 ++
.../example/application/GoodComponent.java | 34 ++
.../com/example/application/GoodView.java | 34 ++
.../com/example/disallowed/BadComponent.java | 34 ++
.../META-INF/resources/icons/icon.png | Bin 0 -> 2424 bytes
.../src/main/resources/application.properties | 7 +
.../src/main/resources/banner.txt | 1 +
.../AllowedPackageChecker24IT.java | 54 ++
60 files changed, 2346 insertions(+), 801 deletions(-)
create mode 100644 addon-utils/.gitignore
create mode 100644 addon-utils/pom.xml
create mode 100644 addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackageChecker.java
create mode 100644 addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackages.java
create mode 100644 addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackagesImpl.java
create mode 100644 addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/VaadinServiceInitListenerImpl.java
create mode 100644 addon-utils/src/main/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener
create mode 100644 addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackages.java
create mode 100644 addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackagesChecker.java
create mode 100644 addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestVaadinServiceInitListenerImpl.java
delete mode 100644 src/main/resources/META-INF/frontend/styles/static_addon_styles
delete mode 100644 src/main/resources/META-INF/resources/static_addon_resources
delete mode 100644 src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemo.java
delete mode 100644 src/test/java/com/flowingcode/vaadin/addons/template/it/AbstractViewTest.java
delete mode 100644 src/test/java/com/flowingcode/vaadin/addons/template/it/ViewIT.java
delete mode 100644 src/test/java/com/flowingcode/vaadin/addons/template/test/SerializationTest.java
delete mode 100644 src/test/resources/META-INF/frontend/styles/shared-styles.css
delete mode 100644 src/test/resources/META-INF/resources/static_addon_test_resources
create mode 100644 test-jetty/.gitignore
create mode 100644 test-jetty/pom.xml
rename src/main/java/com/flowingcode/vaadin/addons/template/TemplateAddon.java => test-jetty/src/main/java/com/example/application/GoodComponent.java (67%)
rename src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java => test-jetty/src/main/java/com/example/application/GoodView.java (70%)
create mode 100644 test-jetty/src/main/resources/META-INF/resources/icons/icon.png
create mode 100644 test-jetty/src/test/java/com/example/application/AllowedPackageCheckerJettyIT.java
create mode 100644 test-spring-boot-v14/.gitignore
create mode 100644 test-spring-boot-v14/pom.xml
create mode 100644 test-spring-boot-v14/src/main/java/com/example/application/Application.java
rename src/test/java/com/flowingcode/vaadin/addons/template/DemoView.java => test-spring-boot-v14/src/main/java/com/example/application/BadView.java (59%)
create mode 100644 test-spring-boot-v14/src/main/java/com/example/application/GoodComponent.java
rename src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemoView.java => test-spring-boot-v14/src/main/java/com/example/application/GoodView.java (55%)
create mode 100644 test-spring-boot-v14/src/main/java/com/example/disallowed/BadComponent.java
create mode 100644 test-spring-boot-v14/src/main/resources/META-INF/resources/icons/icon.png
create mode 100644 test-spring-boot-v14/src/main/resources/application.properties
create mode 100644 test-spring-boot-v14/src/main/resources/banner.txt
create mode 100644 test-spring-boot-v14/src/test/java/com/example/application/AllowedPackageChecker14IT.java
create mode 100644 test-spring-boot-v23/.gitignore
create mode 100644 test-spring-boot-v23/pom.xml
create mode 100644 test-spring-boot-v23/src/main/java/com/example/application/Application.java
create mode 100644 test-spring-boot-v23/src/main/java/com/example/application/BadView.java
create mode 100644 test-spring-boot-v23/src/main/java/com/example/application/GoodComponent.java
create mode 100644 test-spring-boot-v23/src/main/java/com/example/application/GoodView.java
create mode 100644 test-spring-boot-v23/src/main/java/com/example/disallowed/BadComponent.java
create mode 100644 test-spring-boot-v23/src/main/resources/META-INF/resources/icons/icon.png
create mode 100644 test-spring-boot-v23/src/main/resources/application.properties
create mode 100644 test-spring-boot-v23/src/main/resources/banner.txt
create mode 100644 test-spring-boot-v23/src/test/java/com/example/application/AllowedPackageChecker23IT.java
create mode 100644 test-spring-boot-v24/.gitignore
create mode 100644 test-spring-boot-v24/pom.xml
create mode 100644 test-spring-boot-v24/src/main/java/com/example/application/Application.java
create mode 100644 test-spring-boot-v24/src/main/java/com/example/application/BadView.java
create mode 100644 test-spring-boot-v24/src/main/java/com/example/application/GoodComponent.java
create mode 100644 test-spring-boot-v24/src/main/java/com/example/application/GoodView.java
create mode 100644 test-spring-boot-v24/src/main/java/com/example/disallowed/BadComponent.java
create mode 100644 test-spring-boot-v24/src/main/resources/META-INF/resources/icons/icon.png
create mode 100644 test-spring-boot-v24/src/main/resources/application.properties
create mode 100644 test-spring-boot-v24/src/main/resources/banner.txt
create mode 100644 test-spring-boot-v24/src/test/java/com/example/application/AllowedPackageChecker24IT.java
diff --git a/.gitignore b/.gitignore
index 2201857..541e887 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,2 @@
-node_modules
-target
-.vscode
-.settings
-.project
-.classpath
-webpack.generated.js
-package-lock.json
-package.json
-webpack.config.js
-/error-screenshots
-drivers
-tsconfig.json
-.idea
-types.d.ts
-vite.generated.ts
-vite.config.ts
-/src/main/dev-bundle
-/src/main/bundles
-/src/main/frontend/generated
-/src/main/frontend/index.html
\ No newline at end of file
+/.project
+/.settings
diff --git a/README.md b/README.md
index e600a7e..3ab2553 100644
--- a/README.md
+++ b/README.md
@@ -1,24 +1,15 @@
-[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/template-addon)
-[![Stars on vaadin.com/directory](https://img.shields.io/vaadin-directory/star/template-addon.svg)](https://vaadin.com/directory/component/template-addon)
-[![Build Status](https://jenkins.flowingcode.com/job/template-addon/badge/icon)](https://jenkins.flowingcode.com/job/template-addon)
-[![Maven Central](https://img.shields.io/maven-central/v/com.flowingcode.vaadin.addons/template-addon)](https://mvnrepository.com/artifact/com.flowingcode.vaadin.addons/template-addon)
-[![Javadoc](https://img.shields.io/badge/javadoc-00b4f0)](https://javadoc.flowingcode.com/artifact/com.flowingcode.vaadin.addons/template-addon)
+[![Build Status](https://jenkins.flowingcode.com/job/utils-addon/badge/icon)](https://jenkins.flowingcode.com/job/utils-addon)
+[![Maven Central](https://img.shields.io/maven-central/v/com.flowingcode.vaadin.addons/addon-utils)](https://mvnrepository.com/artifact/com.flowingcode.vaadin.addons/addon-utils)
+[![Javadoc](https://img.shields.io/badge/javadoc-00b4f0)](https://javadoc.flowingcode.com/artifact/com.flowingcode.vaadin.addons/addon-utils)
-# Template Add-on
+# Add-on Utils
-This is a template project for building new Vaadin 24 add-ons
+Utilities for Vaadin add-ons.
## Features
-* List the features of your add-on in here
-
-## Online demo
-
-[Online demo here](http://addonsv24.flowingcode.com/template)
-
-## Download release
-
-[Available in Vaadin Directory](https://vaadin.com/directory/component/template-addon)
+* Check that the add-on package is [allowed](https://vaadin.com/docs/latest/integrations/spring/configuration/#configure-the-scanning-of-packages). In development mode, show a browser alert if it isn't allowed.
+* Compatible with Vaadin 14-24
### Maven install
@@ -27,7 +18,7 @@ Add the following dependencies in your pom.xml file:
```xml
com.flowingcode.vaadin.addons
- template-addon
+ addon-utilsX.Y.Z
```
@@ -35,20 +26,13 @@ Add the following dependencies in your pom.xml file:
Release versions are available from Maven Central repository. For SNAPSHOT versions see [here](https://maven.flowingcode.com/snapshots/).
-## Building and running demo
-
-- git clone repository
-- mvn clean install jetty:run
-
-To see the demo, navigate to http://localhost:8080/
-
## Release notes
-See [here](https://github.com/FlowingCode/TemplateAddon/releases)
+See [here](https://github.com/FlowingCode/AddonUtils/releases)
## Issue tracking
-The issues for this add-on are tracked on its github.com page. All bug reports and feature requests are appreciated.
+The issues for this library are tracked on its github.com page. All bug reports and feature requests are appreciated.
## Contributions
@@ -67,22 +51,37 @@ Then, follow these steps for creating a contribution:
## License & Author
-This add-on is distributed under Apache License 2.0. For license terms, see LICENSE.txt.
+This library is distributed under Apache License 2.0. For license terms, see LICENSE.txt.
-TEMPLATE_ADDON is written by Flowing Code S.A.
+AddonUtils is written by Flowing Code S.A.
# Developer Guide
## Getting started
-Add your code samples in this section
+Check that `com.flowingcode.vaadin.addons.example` is included in the allowed-packages list. If missing, show an alert in the browser.
-## Special configuration when using Spring
+```
+package com.flowingcode.vaadin.addons.example;
-By default, Vaadin Flow only includes ```com/vaadin/flow/component``` to be always scanned for UI components and views. For this reason, the add-on might need to be allowed in order to display correctly.
+public class MyComponent extends Div {
-To do so, just add ```com.flowingcode``` to the ```vaadin.allowed-packages``` property in ```src/main/resources/application.properties```, like:
+ public MyComponent() {
+ AllowedPackageChecker.check(this, MyComponent.class);
+ }
-```vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.flowingcode```
-
-More information on Spring scanning configuration [here](https://vaadin.com/docs/latest/integrations/spring/configuration/#configure-the-scanning-of-packages).
+}
+```
+
+Check that `com.flowingcode.vaadin.addons.example` is included in the allowed-packages list. If missing, show an alert in the browser (the alert will reference `com.flowingcode.vaadin.addons`, i.e. the package name with one subpackage removed).
+```
+package com.flowingcode.vaadin.addons.example;
+
+public class MyComponent extends Div {
+
+ public MyComponent() {
+ AllowedPackageChecker.check(this, MyComponent.class, -1);
+ }
+
+}
+```
diff --git a/addon-utils/.gitignore b/addon-utils/.gitignore
new file mode 100644
index 0000000..2201857
--- /dev/null
+++ b/addon-utils/.gitignore
@@ -0,0 +1,21 @@
+node_modules
+target
+.vscode
+.settings
+.project
+.classpath
+webpack.generated.js
+package-lock.json
+package.json
+webpack.config.js
+/error-screenshots
+drivers
+tsconfig.json
+.idea
+types.d.ts
+vite.generated.ts
+vite.config.ts
+/src/main/dev-bundle
+/src/main/bundles
+/src/main/frontend/generated
+/src/main/frontend/index.html
\ No newline at end of file
diff --git a/addon-utils/pom.xml b/addon-utils/pom.xml
new file mode 100644
index 0000000..914ecc3
--- /dev/null
+++ b/addon-utils/pom.xml
@@ -0,0 +1,306 @@
+
+
+ 4.0.0
+
+ com.flowingcode.vaadin.addons
+ addon-utils
+ 1.0.0-SNAPSHOT
+ Add-on Utils
+ Add-on Utils for Vaadin Flow
+ https://www.flowingcode.com/en/open-source/
+
+
+ 24.4.6
+ 17
+ 17
+ UTF-8
+ UTF-8
+
+
+
+ Flowing Code
+ https://www.flowingcode.com
+
+
+ 2024
+
+
+ Apache 2
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ https://github.com/FlowingCode/AddonUtils
+ scm:git:git://github.com/FlowingCode/AddonUtils.git
+ scm:git:ssh://git@github.com:/FlowingCode/AddonUtils.git
+ master
+
+
+
+
+ ossrh
+ https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
+
+ flowingcode
+ Flowing Code
+ https://www.flowingcode.com
+
+
+
+
+
+
+ com.vaadin
+ vaadin-bom
+ pom
+ import
+ ${vaadin.version}
+
+
+
+
+
+
+ central
+ https://repo.maven.apache.org/maven2
+
+ false
+
+
+
+ Vaadin Directory
+ https://maven.vaadin.com/vaadin-addons
+
+
+
+ Vaadin prereleases
+ https://maven.vaadin.com/vaadin-prereleases
+
+
+
+ vaadin-snapshots
+ https://oss.sonatype.org/content/repositories/vaadin-snapshots/
+
+
+
+
+
+ central
+ https://repo.maven.apache.org/maven2
+
+ false
+
+
+
+
+ Vaadin prereleases
+ https://maven.vaadin.com/vaadin-prereleases
+
+
+ vaadin-snapshots
+ https://oss.sonatype.org/content/repositories/vaadin-snapshots/
+ false
+
+
+
+
+
+ com.vaadin
+ vaadin-core
+ true
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 6.0.0
+ test
+
+
+ org.springframework
+ spring-context
+ 6.1.13
+ true
+ provided
+
+
+ org.springframework
+ spring-web
+ 6.1.13
+ true
+ provided
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+ org.hamcrest
+ hamcrest-library
+ 1.3
+ test
+
+
+ org.mockito
+ mockito-core
+ 5.12.0
+ test
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 3.0.1
+
+ @{project.version}
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.22.1
+
+ false
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.1.2
+
+
+ true
+
+ false
+ true
+
+
+ 1
+
+
+
+
+
+ org.codehaus.mojo
+ license-maven-plugin
+ 2.3.0
+
+ apache_v2
+ false
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ false
+
+
+
+
+
+
+
+ directory
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.0.1
+
+
+ attach-sources
+ package
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.10.0
+
+
+ attach-javadocs
+ package
+
+ jar
+
+
+
+
+ true
+ none
+ true
+
+ https://javadoc.io/doc/com.vaadin/vaadin-platform-javadoc/${vaadin.version}
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.1.2
+
+
+
+
+
+
+ gpg
+
+
+ env.gpg.passphrase
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 3.1.0
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+ ${env.gpg.passphrase}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackageChecker.java b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackageChecker.java
new file mode 100644
index 0000000..b942dca
--- /dev/null
+++ b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackageChecker.java
@@ -0,0 +1,114 @@
+/*-
+ * #%L
+ * Add-on Utils
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.utils.checker;
+
+import com.vaadin.flow.component.Component;
+
+/**
+ * Utilities for checking if a component's package is
+ * allowed.
+ */
+public class AllowedPackageChecker {
+
+ private static AllowedPackages impl;
+
+ private static final String SCRIPT =
+ "Vaadin.Flow.fcWarnPackageNotAllowed = Vaadin.Flow.fcWarnPackageNotAllowed || function(element, package) {"
+ + "var tag = element.tagName.toLowerCase();"
+ + "if (!Vaadin.Flow.fcWarnPackageNotAllowed[tag]) {"
+ + " Vaadin.Flow.fcWarnPackageNotAllowed[tag]=true;"
+ + " var message = 'Please check that package '+package+' is allowed.';"
+ + " if (!element.shadowRoot) message = '<'+tag+'> is not a web component.\\n'+message;"
+ + " console.error(message+'\\nSee https://vaadin.com/docs/latest/flow/integrations/spring/configuration'); "
+ + " alert(message);"
+ + "}}; Vaadin.Flow.fcWarnPackageNotAllowed(this, $0);";
+
+ private AllowedPackageChecker() {}
+
+ static void setImpl(AllowedPackages impl) {
+ AllowedPackageChecker.impl = impl;
+ }
+
+ /**
+ * Checks that the component's package is allowed and displays an error message if the package
+ * name is not in the list.
+ *
+ * The check is performed only in development mode for Spring Boot applications that have an
+ * allowed packages list. No check is done in production mode.
+ *
+ * This method is equivalent to {@link #check(Component, String, int) check(component,type,0)}.
+ *
+ * @param component the component instance to be checked.
+ * @param type the type of the component to be checked.
+ */
+ public static void check(T component, Class super T> type) {
+ check(component, type, 0);
+ }
+
+ /**
+ * Checks that the component's package is allowed and displays an error message if the package
+ * name is not in the list.
+ *
+ * The check is performed only in development mode for Spring Boot applications that have an
+ * allowed packages list. No check is done in production mode.
+ *
+ * When displaying the error message, {@code -removePackages} subpackages are removed from the
+ * package of {@code type}. For instance, if {@code type} is
+ * {@code com.flowingcode.vaadin.addons.utils} and {@code removePackages} is {@code -1}, the error
+ * will reference {@code com.flowingcode.vaadin.addons}.
+ *
+ * @param component the component instance to be checked.
+ * @param type the type of the component to be checked.
+ * @param removePackages a negative number specifying how many subpackage levels to discard from
+ * the type package when displaying the error message.
+ * @throws IllegalArgumentException if {@code removePackages} is positive, or if the package name
+ * does not contain enough subpackages to remove the specified number of levels.
+ */
+ public static void check(T component, Class super T> type, int removePackages) {
+ if (removePackages > 0) {
+ throw new IllegalArgumentException();
+ }
+ String packageName = type.getPackage().getName();
+ check(component, packageName, removePackages);
+ }
+
+ private static void check(Component component, String packageName, int removePackages) {
+ if (impl != null) {
+ // call removePackages before if in order to validate attribute
+ String messagePackageName = removePackages(packageName, removePackages);
+ if (!impl.isPackageAllowed(packageName)) {
+ component.getElement().executeJs(SCRIPT, messagePackageName);
+ }
+ }
+ }
+
+ private static String removePackages(String packageName, int removePackages) {
+ while (removePackages != 0) {
+ int pos = packageName.lastIndexOf('.');
+ if (pos < 0) {
+ throw new IllegalArgumentException();
+ }
+ packageName = packageName.substring(0, pos);
+ removePackages++;
+ }
+ return packageName;
+ }
+
+}
diff --git a/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackages.java b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackages.java
new file mode 100644
index 0000000..1e1ab49
--- /dev/null
+++ b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackages.java
@@ -0,0 +1,26 @@
+/*-
+ * #%L
+ * Add-on Utils
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.utils.checker;
+
+interface AllowedPackages {
+
+ boolean isPackageAllowed(String packageName);
+
+}
diff --git a/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackagesImpl.java b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackagesImpl.java
new file mode 100644
index 0000000..df378e9
--- /dev/null
+++ b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/AllowedPackagesImpl.java
@@ -0,0 +1,56 @@
+/*-
+ * #%L
+ * Add-on Utils
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.utils.checker;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.springframework.context.ApplicationContext;
+
+class AllowedPackagesImpl implements AllowedPackages {
+
+ private final List allowedPackages;
+
+ AllowedPackagesImpl(ApplicationContext appContext) {
+ // "reuse" code from VaadinServletContextInitializer
+
+ String onlyScanProperty = appContext.getEnvironment().getProperty("vaadin.allowed-packages");
+ if (onlyScanProperty == null) {
+ onlyScanProperty = appContext.getEnvironment().getProperty("vaadin.whitelisted-packages");
+ }
+ if (onlyScanProperty == null) {
+ allowedPackages = Collections.emptyList();
+ } else {
+ allowedPackages = Arrays.stream(onlyScanProperty.split(","))
+ .map(onlyPackage -> onlyPackage.replace('/', '.').trim()).collect(Collectors.toList());
+ }
+ }
+
+ @Override
+ public boolean isPackageAllowed(String packageName) {
+ if (allowedPackages.isEmpty() || allowedPackages.contains(packageName)) {
+ return true;
+ }
+ int pos = packageName.lastIndexOf('.');
+ return pos > 0 && isPackageAllowed(packageName.substring(0, pos));
+ }
+
+}
diff --git a/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/VaadinServiceInitListenerImpl.java b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/VaadinServiceInitListenerImpl.java
new file mode 100644
index 0000000..8a7a97a
--- /dev/null
+++ b/addon-utils/src/main/java/com/flowingcode/vaadin/addons/utils/checker/VaadinServiceInitListenerImpl.java
@@ -0,0 +1,85 @@
+/*-
+ * #%L
+ * Add-on Utils
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.utils.checker;
+
+import com.vaadin.flow.server.ServiceInitEvent;
+import com.vaadin.flow.server.VaadinService;
+import com.vaadin.flow.server.VaadinServiceInitListener;
+import com.vaadin.flow.server.VaadinServletContext;
+import java.lang.reflect.Constructor;
+
+@SuppressWarnings("serial")
+public class VaadinServiceInitListenerImpl implements VaadinServiceInitListener {
+
+ @SuppressWarnings("unchecked")
+ private static Constructor extends AllowedPackages> reflectConstructor() throws Exception {
+ Class> applicationContextClass =
+ Class.forName("org.springframework.context.ApplicationContext");
+ Class> allowedPackagesSpringImplClass =
+ Class.forName("com.flowingcode.vaadin.addons.utils.checker.AllowedPackagesImpl");
+ return (Constructor extends AllowedPackages>) allowedPackagesSpringImplClass
+ .getDeclaredConstructor(applicationContextClass);
+ }
+
+ private static AllowedPackages newInstance(Object context) throws Exception {
+ Constructor extends AllowedPackages> constructor = reflectConstructor();
+ return constructor.newInstance(context);
+ }
+
+ private static Object getServletContext(VaadinServletContext vaadinServletContext)
+ throws Exception {
+ return VaadinServletContext.class.getMethod("getContext").invoke(vaadinServletContext);
+ }
+
+ private static AllowedPackages newAllowedPackageChecker(VaadinService service) {
+ try {
+ Object applicationContext;
+ Object servletContext = getServletContext((VaadinServletContext) service.getContext());
+ applicationContext = getWebApplicationContext(servletContext);
+ if (applicationContext != null) {
+ return newInstance(applicationContext);
+ }
+ } catch (Exception e) {
+ // do nothing
+ }
+ return null;
+ }
+
+ private static Object getWebApplicationContext(Object servletContext) throws Exception {
+ Class> servletContextClass;
+ try {
+ servletContextClass = Class.forName("javax.servlet.ServletContext");
+ } catch (ClassNotFoundException e) {
+ servletContextClass = Class.forName("jakarta.servlet.ServletContext");
+ }
+ return Class.forName("org.springframework.web.context.support.WebApplicationContextUtils")
+ .getMethod("getWebApplicationContext", servletContextClass).invoke(null, servletContext);
+ }
+
+
+ @Override
+ public void serviceInit(ServiceInitEvent event) {
+ VaadinService service = event.getSource();
+ if (!service.getDeploymentConfiguration().isProductionMode()) {
+ AllowedPackageChecker.setImpl(newAllowedPackageChecker(service));
+ }
+ }
+
+}
diff --git a/addon-utils/src/main/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener b/addon-utils/src/main/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener
new file mode 100644
index 0000000..c51366b
--- /dev/null
+++ b/addon-utils/src/main/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener
@@ -0,0 +1 @@
+com.flowingcode.vaadin.addons.utils.checker.VaadinServiceInitListenerImpl
\ No newline at end of file
diff --git a/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackages.java b/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackages.java
new file mode 100644
index 0000000..d9795fc
--- /dev/null
+++ b/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackages.java
@@ -0,0 +1,68 @@
+/*-
+ * #%L
+ * Add-on Utils
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.utils.checker;
+
+import static org.junit.Assert.assertFalse;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.env.Environment;
+
+public class TestAllowedPackages {
+
+ @Test
+ public void testAllowedPackages() {
+ var env = Mockito.mock(Environment.class);
+ var ctx = Mockito.mock(ApplicationContext.class);
+ Mockito.when(ctx.getEnvironment()).thenReturn(env);
+ Mockito.when(env.getProperty("vaadin.allowed-packages")).thenReturn("foo, bar");
+
+ var impl = new AllowedPackagesImpl(ctx);
+ assertFalse("foo is not allowed", !impl.isPackageAllowed("foo"));
+ assertFalse("bar is not allowed", !impl.isPackageAllowed("bar"));
+ assertFalse("foo.x is not allowed", !impl.isPackageAllowed("foo.x"));
+ assertFalse("baz is allowed", impl.isPackageAllowed("baz"));
+ }
+
+ @Test
+ public void testWhitelistedPackages() {
+ var env = Mockito.mock(Environment.class);
+ var ctx = Mockito.mock(ApplicationContext.class);
+ Mockito.when(ctx.getEnvironment()).thenReturn(env);
+ Mockito.when(env.getProperty("vaadin.whitelisted-packages")).thenReturn("foo, bar");
+
+ var impl = new AllowedPackagesImpl(ctx);
+ assertFalse("foo is not allowed", !impl.isPackageAllowed("foo"));
+ assertFalse("bar is not allowed", !impl.isPackageAllowed("bar"));
+ assertFalse("foo.x is not allowed", !impl.isPackageAllowed("foo.x"));
+ assertFalse("baz is allowed", impl.isPackageAllowed("baz"));
+ }
+
+ @Test
+ public void testNoPackages() {
+ var env = Mockito.mock(Environment.class);
+ var ctx = Mockito.mock(ApplicationContext.class);
+ Mockito.when(ctx.getEnvironment()).thenReturn(env);
+
+ var impl = new AllowedPackagesImpl(ctx);
+ assertFalse("foo is not allowed", !impl.isPackageAllowed("foo"));
+ }
+
+}
diff --git a/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackagesChecker.java b/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackagesChecker.java
new file mode 100644
index 0000000..eaf2b6e
--- /dev/null
+++ b/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestAllowedPackagesChecker.java
@@ -0,0 +1,76 @@
+/*-
+ * #%L
+ * Add-on Utils
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.utils.checker;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import com.vaadin.flow.component.Component;
+import com.vaadin.flow.dom.Element;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class TestAllowedPackagesChecker {
+
+ private static Component mockComponent() {
+ var component = Mockito.mock(Component.class);
+ var element = Mockito.mock(Element.class);
+ Mockito.when(component.getElement()).thenReturn(element);
+ return component;
+ }
+
+ @Test
+ public void testCheck() {
+ var impl = Mockito.mock(AllowedPackages.class);
+ var component = mockComponent();
+ AllowedPackageChecker.setImpl(impl);
+
+ AllowedPackageChecker.check(component, Component.class);
+ verify(impl, times(1)).isPackageAllowed("com.vaadin.flow.component");
+ verify(component.getElement(), times(1)).executeJs(any(),
+ eq("com.vaadin.flow.component"));
+ }
+
+ @Test
+ public void testCheckMinus1() {
+ var impl = Mockito.mock(AllowedPackages.class);
+ var component = mockComponent();
+ AllowedPackageChecker.setImpl(impl);
+
+ AllowedPackageChecker.check(component, Component.class, -1);
+ verify(impl, times(1)).isPackageAllowed("com.vaadin.flow.component");
+ verify(component.getElement(), times(1)).executeJs(any(),
+ eq("com.vaadin.flow"));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCheckMinus4() {
+ var component = mockComponent();
+ AllowedPackageChecker.check(component, Component.class, -4);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCheckPlus1() {
+ var component = mockComponent();
+ AllowedPackageChecker.check(component, Component.class, +1);
+ }
+
+}
diff --git a/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestVaadinServiceInitListenerImpl.java b/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestVaadinServiceInitListenerImpl.java
new file mode 100644
index 0000000..572ff3b
--- /dev/null
+++ b/addon-utils/src/test/java/com/flowingcode/vaadin/addons/utils/checker/TestVaadinServiceInitListenerImpl.java
@@ -0,0 +1,92 @@
+/*-
+ * #%L
+ * Add-on Utils
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.utils.checker;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
+import com.vaadin.flow.component.Component;
+import com.vaadin.flow.dom.Element;
+import com.vaadin.flow.function.DeploymentConfiguration;
+import com.vaadin.flow.server.ServiceInitEvent;
+import com.vaadin.flow.server.VaadinService;
+import com.vaadin.flow.server.VaadinServletContext;
+import jakarta.servlet.ServletContext;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.springframework.core.env.Environment;
+import org.springframework.web.context.WebApplicationContext;
+
+public class TestVaadinServiceInitListenerImpl {
+
+ private static VaadinService mockVaadinService(boolean productionMode) {
+ var service = Mockito.mock(VaadinService.class);
+ var config = Mockito.mock(DeploymentConfiguration.class);
+ Mockito.when(service.getDeploymentConfiguration()).thenReturn(config);
+ Mockito.when(config.isProductionMode()).thenReturn(productionMode);
+
+ var vctx = Mockito.mock(VaadinServletContext.class);
+ var sctx = Mockito.mock(ServletContext.class);
+ var actx = Mockito.mock(WebApplicationContext.class);
+ Mockito.when(service.getContext()).thenReturn(vctx);
+ Mockito.when(vctx.getContext()).thenReturn(sctx);
+ Mockito.when(sctx.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE))
+ .thenReturn(actx);
+
+ var env = Mockito.mock(Environment.class);
+ Mockito.when(actx.getEnvironment()).thenReturn(env);
+ Mockito.when(env.getProperty("vaadin.allowed-packages")).thenReturn("foo");
+
+ return service;
+ }
+
+ private static Component mockComponent() {
+ var component = Mockito.mock(Component.class);
+ var element = Mockito.mock(Element.class);
+ Mockito.when(component.getElement()).thenReturn(element);
+ return component;
+ }
+
+ @Test
+ public void testProductionMode() {
+ AllowedPackageChecker.setImpl(null);
+ ServiceInitEvent ev = new ServiceInitEvent(mockVaadinService(true));
+ new VaadinServiceInitListenerImpl().serviceInit(ev);
+
+ // no checks are done in production mode
+ var component = mockComponent();
+ AllowedPackageChecker.check(component, Component.class);
+ verifyNoInteractions(component.getElement());
+ }
+
+ @Test
+ public void testDevelopmentMode() {
+ AllowedPackageChecker.setImpl(null);
+ ServiceInitEvent ev = new ServiceInitEvent(mockVaadinService(false));
+ new VaadinServiceInitListenerImpl().serviceInit(ev);
+
+ // a check is done in development mode, and it fails
+ var component = mockComponent();
+ AllowedPackageChecker.check(component, Component.class);
+ verify(component.getElement(), times(1)).executeJs(any(), any());
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index 7ceac95..06a5257 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,24 +5,18 @@
4.0.0com.flowingcode.vaadin.addons
- template-addon
+ addon-utils-project1.0.0-SNAPSHOT
- Template Add-on
- Template Add-on for Vaadin Flow
- https://www.flowingcode.com/en/open-source/
+ Add-on Utils - Project
+ pom
-
- 24.4.6
- 4.10.0
- 17
- 17
- UTF-8
- UTF-8
- ${project.basedir}/drivers
- 11.0.20
- 4.1.0
- true
-
+
+ addon-utils
+ test-jetty
+ test-spring-boot-v14
+ test-spring-boot-v23
+ test-spring-boot-v24
+ Flowing Code
@@ -39,184 +33,28 @@
- https://github.com/FlowingCode/AddonStarter24
- scm:git:git://github.com/FlowingCode/AddonStarter24.git
- scm:git:ssh://git@github.com:/FlowingCode/AddonStarter24.git
+ https://github.com/FlowingCode/AddonUtils
+ scm:git:git://github.com/FlowingCode/AddonUtils.git
+ scm:git:ssh://git@github.com:/FlowingCode/AddonUtils.gitmaster
-
-
-
- ossrh
- https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
-
-
-
- flowingcode
- Flowing Code
- https://www.flowingcode.com
-
-
-
-
-
-
- com.vaadin
- vaadin-bom
- pom
- import
- ${vaadin.version}
-
-
-
-
-
-
- central
- https://repo.maven.apache.org/maven2
-
- false
-
-
-
- Vaadin Directory
- https://maven.vaadin.com/vaadin-addons
-
-
-
- Vaadin prereleases
- https://maven.vaadin.com/vaadin-prereleases
-
-
-
- vaadin-snapshots
- https://oss.sonatype.org/content/repositories/vaadin-snapshots/
-
-
-
-
-
- central
- https://repo.maven.apache.org/maven2
-
- false
-
-
-
-
- Vaadin prereleases
- https://maven.vaadin.com/vaadin-prereleases
-
-
- vaadin-snapshots
- https://oss.sonatype.org/content/repositories/vaadin-snapshots/
- false
-
-
-
-
-
- com.vaadin
- vaadin-core
- true
-
-
- com.flowingcode.vaadin.addons.demo
- commons-demo
- ${flowingcode.commons.demo.version}
- test
-
-
- org.slf4j
- slf4j-simple
- test
-
-
- com.vaadin
- vaadin-testbench
- test
-
-
- org.hamcrest
- hamcrest-library
- 1.3
- test
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- jar
- test
-
-
- io.github.bonigarcia
- webdrivermanager
- 5.9.1
- test
-
-
-
+
- jetty:run
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- 3.0.1
-
- @{project.version}
-
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- 2.8.2
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.22.1
-
- false
-
-
-
-
-
org.apache.maven.plugins
- maven-jar-plugin
- 3.1.2
+ maven-install-plugin
+ 2.4
-
- true
-
- false
- true
-
-
- 1
-
-
+ true
- maven-clean-plugin
- 3.3.2
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
-
-
- ${basedir}
-
- tsconfig.json
-
-
-
+ true
@@ -230,281 +68,14 @@
**/main/dev-bundle/****/main/bundles/****/main/frontend/**
- **/main/frontend/**
+ **/main/frontend
+ /frontend/**
+ /frontend
+ **/application.properties
-
- java
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- false
-
-
-
- com.vaadin
- vaadin-maven-plugin
- ${vaadin.version}
-
-
-
- prepare-frontend
-
-
-
-
-
- org.eclipse.jetty
- jetty-maven-plugin
- ${jetty.version}
-
- 3
-
- true
-
-
- src/test/resources/META-INF/resources
- src/main/resources/META-INF/resources
-
-
-
- jar
-
-
-
- directory
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.0.1
-
-
- attach-sources
- package
-
- jar-no-fork
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 3.10.0
-
-
- attach-javadocs
- package
-
- jar
-
-
-
-
- true
- none
- true
-
- https://javadoc.io/doc/com.vaadin/vaadin-platform-javadoc/${vaadin.version}
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 3.1.2
-
-
-
- META-INF/VAADIN/config/flow-build-info.json
-
-
-
-
-
-
-
-
-
- production
-
- true
-
-
-
- com.vaadin
- flow-server-production-mode
-
-
-
-
-
-
- com.vaadin
- vaadin-maven-plugin
-
-
-
- build-frontend
-
-
-
-
-
-
-
-
-
- integration-tests
-
-
-
- org.eclipse.jetty
- jetty-maven-plugin
- ${jetty.version}
-
- 0
-
- jar
-
- ${project.artifactId}
- 8081
-
-
-
- start-jetty
- pre-integration-test
-
- start
-
-
-
- stop-jetty
- post-integration-test
-
- stop
-
-
-
-
-
- org.apache.maven.plugins
- maven-failsafe-plugin
- 2.22.2
-
-
-
- integration-test
- verify
-
-
-
-
- false
- true
-
-
-
- ${webdriver.chrome.driver}
-
-
-
-
-
- maven-resources-plugin
- 3.1.0
-
-
-
- copy-test-to-classes
- process-test-classes
-
- copy-resources
-
-
- ${project.build.outputDirectory}
-
-
- ${project.build.testOutputDirectory}
-
-
-
-
-
-
-
-
-
-
-
- gpg
-
-
- env.gpg.passphrase
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 3.1.0
-
-
- sign-artifacts
- verify
-
- sign
-
-
- ${env.gpg.passphrase}
-
-
-
-
-
-
-
-
-
- demo-jar
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- test-jar
-
-
- demo
-
- **/test/*
- **/it/*
- **/DemoView.class
- **/DemoLayout.class
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/resources/META-INF/frontend/styles/static_addon_styles b/src/main/resources/META-INF/frontend/styles/static_addon_styles
deleted file mode 100644
index c2a6ed1..0000000
--- a/src/main/resources/META-INF/frontend/styles/static_addon_styles
+++ /dev/null
@@ -1 +0,0 @@
-Place add-on shareable styles in this folder
\ No newline at end of file
diff --git a/src/main/resources/META-INF/resources/static_addon_resources b/src/main/resources/META-INF/resources/static_addon_resources
deleted file mode 100644
index 70832cc..0000000
--- a/src/main/resources/META-INF/resources/static_addon_resources
+++ /dev/null
@@ -1 +0,0 @@
-Place static add-on resources in this folder
\ No newline at end of file
diff --git a/src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemo.java b/src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemo.java
deleted file mode 100644
index 5f6e6ee..0000000
--- a/src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemo.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.flowingcode.vaadin.addons.template;
-
-import com.flowingcode.vaadin.addons.demo.DemoSource;
-import com.vaadin.flow.component.html.Div;
-import com.vaadin.flow.router.PageTitle;
-import com.vaadin.flow.router.Route;
-
-@DemoSource
-@PageTitle("Template Add-on Demo")
-@SuppressWarnings("serial")
-@Route(value = "demo", layout = TemplateDemoView.class)
-public class TemplateDemo extends Div {
-
- public TemplateDemo() {
- add(new TemplateAddon());
- }
-}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/template/it/AbstractViewTest.java b/src/test/java/com/flowingcode/vaadin/addons/template/it/AbstractViewTest.java
deleted file mode 100644
index 1f7749b..0000000
--- a/src/test/java/com/flowingcode/vaadin/addons/template/it/AbstractViewTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * #%L
- * Template Add-on
- * %%
- * Copyright (C) 2024 Flowing Code
- * %%
- * 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.
- * #L%
- */
-
-package com.flowingcode.vaadin.addons.template.it;
-
-import com.vaadin.testbench.ScreenshotOnFailureRule;
-import com.vaadin.testbench.TestBench;
-import com.vaadin.testbench.parallel.ParallelTest;
-import io.github.bonigarcia.wdm.WebDriverManager;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.openqa.selenium.chrome.ChromeDriver;
-
-/**
- * Base class for ITs
- *
- *
The tests use Chrome driver (see pom.xml for integration-tests profile) to run integration
- * tests on a headless Chrome. If a property {@code test.use .hub} is set to true, {@code
- * AbstractViewTest} will assume that the TestBench test is running in a CI environment. In order to
- * keep the this class light, it makes certain assumptions about the CI environment (such as
- * available environment variables). It is not advisable to use this class as a base class for you
- * own TestBench tests.
- *
- *
To learn more about TestBench, visit Vaadin TestBench.
- */
-public abstract class AbstractViewTest extends ParallelTest {
- private static final int SERVER_PORT = 8080;
-
- private final String route;
-
- @Rule public ScreenshotOnFailureRule rule = new ScreenshotOnFailureRule(this, true);
-
- public AbstractViewTest() {
- this("");
- }
-
- protected AbstractViewTest(String route) {
- this.route = route;
- }
-
- @BeforeClass
- public static void setupClass() {
- WebDriverManager.chromedriver().setup();
- }
-
- @Override
- @Before
- public void setup() throws Exception {
- if (isUsingHub()) {
- super.setup();
- } else {
- setDriver(TestBench.createDriver(new ChromeDriver()));
- }
- getDriver().get(getURL(route));
- }
-
- /**
- * Returns deployment host name concatenated with route.
- *
- * @return URL to route
- */
- private static String getURL(String route) {
- return String.format("http://%s:%d/%s", getDeploymentHostname(), SERVER_PORT, route);
- }
-
- /** Property set to true when running on a test hub. */
- private static final String USE_HUB_PROPERTY = "test.use.hub";
-
- /**
- * Returns whether we are using a test hub. This means that the starter is running tests in
- * Vaadin's CI environment, and uses TestBench to connect to the testing hub.
- *
- * @return whether we are using a test hub
- */
- private static boolean isUsingHub() {
- return Boolean.TRUE.toString().equals(System.getProperty(USE_HUB_PROPERTY));
- }
-
- /**
- * If running on CI, get the host name from environment variable HOSTNAME
- *
- * @return the host name
- */
- private static String getDeploymentHostname() {
- return isUsingHub() ? System.getenv("HOSTNAME") : "localhost";
- }
-}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/template/it/ViewIT.java b/src/test/java/com/flowingcode/vaadin/addons/template/it/ViewIT.java
deleted file mode 100644
index 0e5f164..0000000
--- a/src/test/java/com/flowingcode/vaadin/addons/template/it/ViewIT.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * #%L
- * Template Add-on
- * %%
- * Copyright (C) 2024 Flowing Code
- * %%
- * 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.
- * #L%
- */
-
-package com.flowingcode.vaadin.addons.template.it;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
-
-import com.vaadin.testbench.TestBenchElement;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeDiagnosingMatcher;
-import org.junit.Test;
-
-public class ViewIT extends AbstractViewTest {
-
- private Matcher hasBeenUpgradedToCustomElement =
- new TypeSafeDiagnosingMatcher() {
-
- @Override
- public void describeTo(Description description) {
- description.appendText("a custom element");
- }
-
- @Override
- protected boolean matchesSafely(TestBenchElement item, Description mismatchDescription) {
- String script = "let s=arguments[0].shadowRoot; return !!(s&&s.childElementCount)";
- if (!item.getTagName().contains("-")) {
- return true;
- }
- if ((Boolean) item.getCommandExecutor().executeScript(script, item)) {
- return true;
- } else {
- mismatchDescription.appendText(item.getTagName() + " ");
- mismatchDescription.appendDescriptionOf(is(not(this)));
- return false;
- }
- }
- };
-
- @Test
- public void componentWorks() {
- TestBenchElement element = $("paper-input").first();
- assertThat(element, hasBeenUpgradedToCustomElement);
- }
-}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/template/test/SerializationTest.java b/src/test/java/com/flowingcode/vaadin/addons/template/test/SerializationTest.java
deleted file mode 100644
index 1ee78c3..0000000
--- a/src/test/java/com/flowingcode/vaadin/addons/template/test/SerializationTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * #%L
- * Template Add-on
- * %%
- * Copyright (C) 2024 Flowing Code
- * %%
- * 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.
- * #L%
- */
-package com.flowingcode.vaadin.addons.template.test;
-
-import com.flowingcode.vaadin.addons.template.TemplateAddon;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class SerializationTest {
-
- private void testSerializationOf(Object obj) throws IOException, ClassNotFoundException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
- oos.writeObject(obj);
- }
- try (ObjectInputStream in =
- new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
- obj.getClass().cast(in.readObject());
- }
- }
-
- @Test
- public void testSerialization() throws ClassNotFoundException, IOException {
- try {
- testSerializationOf(new TemplateAddon());
- } catch (Exception e) {
- Assert.fail("Problem while testing serialization: " + e.getMessage());
- }
- }
-}
diff --git a/src/test/resources/META-INF/frontend/styles/shared-styles.css b/src/test/resources/META-INF/frontend/styles/shared-styles.css
deleted file mode 100644
index 6680e2d..0000000
--- a/src/test/resources/META-INF/frontend/styles/shared-styles.css
+++ /dev/null
@@ -1 +0,0 @@
-/*Demo styles*/
\ No newline at end of file
diff --git a/src/test/resources/META-INF/resources/static_addon_test_resources b/src/test/resources/META-INF/resources/static_addon_test_resources
deleted file mode 100644
index b68f527..0000000
--- a/src/test/resources/META-INF/resources/static_addon_test_resources
+++ /dev/null
@@ -1 +0,0 @@
-Place static addon test resources in this folder
\ No newline at end of file
diff --git a/test-jetty/.gitignore b/test-jetty/.gitignore
new file mode 100644
index 0000000..36b334c
--- /dev/null
+++ b/test-jetty/.gitignore
@@ -0,0 +1,24 @@
+/target/
+.idea/
+.vscode/
+.settings
+.project
+.classpath
+
+*.iml
+.DS_Store
+
+# The following files are generated/updated by vaadin-maven-plugin
+node_modules/
+src/main/frontend/generated/
+pnpmfile.js
+vite.generated.ts
+
+# Browser drivers for local integration tests
+drivers/
+# Error screenshots generated by TestBench for failed integration tests
+error-screenshots/
+webpack.generated.js
+
+src/main/frontend
+src/main/bundles
\ No newline at end of file
diff --git a/test-jetty/pom.xml b/test-jetty/pom.xml
new file mode 100644
index 0000000..c1e8e4c
--- /dev/null
+++ b/test-jetty/pom.xml
@@ -0,0 +1,144 @@
+
+
+ 4.0.0
+
+ addon-utils-test-jetty
+ Add-on Utils - Jetty Test
+ jar
+
+
+ 17
+ 17
+ 24.4.12
+ 11.0.13
+
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils-project
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+ com.vaadin
+ vaadin-bom
+ ${vaadin.version}
+ pom
+ import
+
+
+
+
+
+
+ com.vaadin
+ vaadin-core
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils
+ ${project.version}
+
+
+ com.vaadin
+ vaadin-testbench-junit5
+ test
+
+
+ io.github.bonigarcia
+ selenium-jupiter
+ 5.1.1
+ test
+
+
+
+
+ jetty:run
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+ ${jetty.version}
+
+ 3
+
+ true
+
+
+ src/test/resources/META-INF/resources
+
+
+
+ jar
+
+
+
+
+
+ com.vaadin
+ vaadin-maven-plugin
+ ${vaadin.version}
+
+
+
+ prepare-frontend
+
+
+
+
+
+
+
+
+
+
+ it
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ start-spring-boot
+ pre-integration-test
+
+ start
+
+
+
+ stop-spring-boot
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
+ false
+ true
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/flowingcode/vaadin/addons/template/TemplateAddon.java b/test-jetty/src/main/java/com/example/application/GoodComponent.java
similarity index 67%
rename from src/main/java/com/flowingcode/vaadin/addons/template/TemplateAddon.java
rename to test-jetty/src/main/java/com/example/application/GoodComponent.java
index c9ec694..14e370d 100644
--- a/src/main/java/com/flowingcode/vaadin/addons/template/TemplateAddon.java
+++ b/test-jetty/src/main/java/com/example/application/GoodComponent.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * Template Add-on
+ * Add-on Utils - Jetty Test
* %%
* Copyright (C) 2024 Flowing Code
* %%
@@ -17,16 +17,18 @@
* limitations under the License.
* #L%
*/
+package com.example.application;
-package com.flowingcode.vaadin.addons.template;
-
+import com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker;
import com.vaadin.flow.component.Tag;
-import com.vaadin.flow.component.dependency.JsModule;
-import com.vaadin.flow.component.dependency.NpmPackage;
import com.vaadin.flow.component.html.Div;
@SuppressWarnings("serial")
-@NpmPackage(value = "@polymer/paper-input", version = "3.2.1")
-@JsModule("@polymer/paper-input/paper-input.js")
-@Tag("paper-input")
-public class TemplateAddon extends Div {}
+@Tag("my-component")
+public class GoodComponent extends Div {
+
+ {
+ AllowedPackageChecker.check(this, GoodComponent.class);
+ }
+
+}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java b/test-jetty/src/main/java/com/example/application/GoodView.java
similarity index 70%
rename from src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java
rename to test-jetty/src/main/java/com/example/application/GoodView.java
index b84172e..2bd922a 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java
+++ b/test-jetty/src/main/java/com/example/application/GoodView.java
@@ -1,15 +1,15 @@
/*-
* #%L
- * Template Add-on
+ * Add-on Utils - Jetty Test
* %%
* Copyright (C) 2024 Flowing Code
* %%
* 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.
@@ -17,15 +17,18 @@
* limitations under the License.
* #L%
*/
-package com.flowingcode.vaadin.addons;
+package com.example.application;
import com.vaadin.flow.component.html.Div;
-import com.vaadin.flow.router.RouterLayout;
+import com.vaadin.flow.component.html.Span;
+import com.vaadin.flow.router.Route;
-@SuppressWarnings("serial")
-public class DemoLayout extends Div implements RouterLayout {
+@Route("good")
+public class GoodView extends Div {
- public DemoLayout() {
- setSizeFull();
+ public GoodView() {
+ add(new Span("Good"));
+ add(new GoodComponent());
}
+
}
diff --git a/test-jetty/src/main/resources/META-INF/resources/icons/icon.png b/test-jetty/src/main/resources/META-INF/resources/icons/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..df2ed4bd80778f7141c825ce9275984b4a34a15c
GIT binary patch
literal 2424
zcmb7GYdDl!8(!}_2Xi!xLSytzg|bPKGNKGdQ9{O+Mmf~5kr)bTi+7yjDmC;)Ax){I
z!*)I-hJgV-~m>2#eiJdBKFd<3_8n6Io=hB2qm7CYu9O3
z0zkOu#&z^L08O-tR0RN${3zEeSF8KK#;IF&j$SWAQbB5s2(9EKzB
z^Da35@IY%rH25Kcr3n#9Ea%9Z*qN$1Wn5aY^N2E|+p)g)VbS&ec{7g|RF_7zhQ9P@
z9yJtfd|8OyXCdeydcAzqT!x*f=r2AxXPA(bI&rxlm(Na~g!_06#7yqw%;pP2qxKW0
z6ekI)$kl&X1E*PbcXllP`;=MKDEWH-L1
zJqwMdAhJ)hd_>y^#1AECemZQfh2zWviA$auf@u4!aAZaKRY
zzt3EQ&m*BaGq!6w!#6!QjVp^k`l^OPLIXZE{;(bPC>>2Eal&8cQ!do}fhTbSO8alG
zTtPfKWo;-jt#)^Wq*{>P_TOkrLh~PZD%woFAO$Zs#BP|Ur)%DpWk617z1QQ88-)1z
zQFk^LH&jMod<)$
pvYS!Cl
zlvPo+lA14Ikh02`Kd3WzuPUh}_%2sR*MHp}(E`)QsX$7ijsdr}5}}T|+&tFNw^y4n`en55hinWX3eD
zrUd*`52D}1#C7m44j*)A<+5{qM3hNVlTz@
z&}_OK2K!qbBa5PBOPPX=CQ(E2!EWMGVb#a2*UV*tjHks26w7Xy9k`=g)T?*UXA4b4
zT+JhAiFZeQ3cR-nU$Hz!ynEAZ_JUZS5{D^+Sf89sP>2gBU3NozlO2ymlpmlNk&tU~
z8l21~3~T4hG|t!zM%*4d8-OskJwDtT*uBi_M35oopzFgx(ns+U|Icx(ICfeJMm@NM9
z5gt}L>Y#XDe6ZO!g)yo$zx07wvZcrLBXwYH^QN^Lx3w#Xc@?jfE1P1IcfRh@>{?ug
z(lY8K9SXA&C+~L8obn4DY{A9AxKZWKvZ5KBTwD;466+ydnrO8LzB7|InNWPcjV|du
z+srCh)$&Fs_KEV_=}k@h);n1h6tAD(oin#PLttU6HzFK5o{qimAKNoD!#r(s>@}Pc
z_Mpb_em^W2Jbpt)Wwl#yLg${Jx(bch5weEylfompA_MC;)*u$K=X5T=6w3hqQVcgr
zo6PT|B!aG8d=%YcKLRywF<*Kl-5%I9<@W$rDH$H*nNkt420<2PdJ)1(&0Zxe3Q@RQ
z^_y}S`Q7j%*|^OJ`?c8Zu1>JcK4WVHBxdCobA!Z1fP=~xfVt}MI@25?kV4yLLQ-9mawo?b+=-!TEP0V(d
zp?Lw%VGG#Q7bhvYkL_w=cnYT|iNwU3T?MmffhO+zP#O<}9>mfrr
z(08-6*k_mJvC^@SO)FMmEOlf`-<;zl+NJCb-y8<$zs;O0t2Z=(DvqHXHd7>;vH;eu
z01*!CSR~}Y6R;a9#beX=h)~SKujH0|BB0U%D=BL|i3Jq|Q>2HWdv_6hVb2L95*yDy
zKu3hsrUWc&o=9Yg#kcjwP^7oE8WNX%i8c_AneJ!9Pb7IcC`TdFMz|{8xF4Ay)&UIM
zruFS*cNR})X^Cp>_HeQ^ATEBZHLIW~M&vnK%QLDS&
zaBx>D7&3-MBB8=Ui`pcR!_W|3^nvIihx>F6UUBRrP|}r-gL-FpG{PTpxLa}$D?5(~
z^1OUtfz^ZENGMzs094B2z12!LQcCn%U;4xLj?1FUAswpf}2X^=6!9UzsZV2rin
zQW!QL5n%EVSXASvFb8AuO(ae|-f)qSO>hn(261k%9w101NRJSM$C6{VE){=anRx%@
zDu$yEV}c=xpuqj5VVhnMewR-r=oNq
zGDe`pZF$g*4Ld-XSS3>>kMgrt7pMfNlT@c~R=1HtAduBB#Q3bZz#Vr*^BVl&$`eeGVHm@3l9-1XQ{j&!?^`(YTdq~qC
z@SZh%)lLn!tB`-_u2O$IP*%$Ooi)ocCRY8A-w*_xH{bdCE)GXm7r422aQ|`&O8pO#
C@ant(
literal 0
HcmV?d00001
diff --git a/test-jetty/src/test/java/com/example/application/AllowedPackageCheckerJettyIT.java b/test-jetty/src/test/java/com/example/application/AllowedPackageCheckerJettyIT.java
new file mode 100644
index 0000000..7fb04f0
--- /dev/null
+++ b/test-jetty/src/test/java/com/example/application/AllowedPackageCheckerJettyIT.java
@@ -0,0 +1,37 @@
+/*-
+ * #%L
+ * Add-on Utils - Jetty Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.html.testbench.DivElement;
+import com.vaadin.testbench.BrowserTest;
+import com.vaadin.testbench.BrowserTestBase;
+
+public class AllowedPackageCheckerJettyIT extends BrowserTestBase {
+
+ @BrowserTest
+ public void testGood() {
+ // just check that the lack of Spring does not break it
+ getDriver().get("http://127.0.0.1:8080/good");
+ getCommandExecutor().waitForVaadin();
+ $(DivElement.class).first();
+ }
+
+}
+
diff --git a/test-spring-boot-v14/.gitignore b/test-spring-boot-v14/.gitignore
new file mode 100644
index 0000000..1d0591e
--- /dev/null
+++ b/test-spring-boot-v14/.gitignore
@@ -0,0 +1,28 @@
+/target/
+.idea/
+.vscode/
+.settings
+.project
+.classpath
+
+*.iml
+.DS_Store
+
+# The following files are generated/updated by vaadin-maven-plugin
+node_modules/
+/frontend/generated/
+pnpmfile.js
+vite.generated.ts
+
+# Browser drivers for local integration tests
+drivers/
+# Error screenshots generated by TestBench for failed integration tests
+error-screenshots/
+webpack.generated.js
+/tsconfig.json
+/types.d.ts
+/vite.config.ts
+/package-lock.json
+/package.json
+/frontend
+/webpack.config.js
diff --git a/test-spring-boot-v14/pom.xml b/test-spring-boot-v14/pom.xml
new file mode 100644
index 0000000..2a7d640
--- /dev/null
+++ b/test-spring-boot-v14/pom.xml
@@ -0,0 +1,157 @@
+
+
+ 4.0.0
+
+ addon-utils-test-spring-boot-v14
+ Add-on Utils - Vaadin 14 Spring-Boot Test
+ jar
+
+
+ 17
+ 17
+ 14.11.13
+ 2.7.2
+
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils-project
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+ com.vaadin
+ vaadin-bom
+ ${vaadin.version}
+ pom
+ import
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+ com.vaadin
+ vaadin-core
+
+
+ com.vaadin
+ vaadin-spring-boot-starter
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils
+ ${project.version}
+
+
+ com.vaadin
+ vaadin-testbench
+ test
+
+
+ com.vaadin
+ vaadin-testbench-core
+ test
+
+
+ io.github.bonigarcia
+ webdrivermanager
+ 5.9.2
+ test
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+ 5.2.1
+
+
+ com.squareup.okio
+ okio
+ 2.8.0
+
+
+
+
+ spring-boot:run
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ com.vaadin
+ vaadin-maven-plugin
+ ${vaadin.version}
+
+
+
+ prepare-frontend
+
+
+
+
+
+
+
+
+
+
+ it
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ start-spring-boot
+ pre-integration-test
+
+ start
+
+
+
+ stop-spring-boot
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
+ false
+ true
+
+
+
+
+
+
+
+
diff --git a/test-spring-boot-v14/src/main/java/com/example/application/Application.java b/test-spring-boot-v14/src/main/java/com/example/application/Application.java
new file mode 100644
index 0000000..bcd9e5d
--- /dev/null
+++ b/test-spring-boot-v14/src/main/java/com/example/application/Application.java
@@ -0,0 +1,32 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 14 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/template/DemoView.java b/test-spring-boot-v14/src/main/java/com/example/application/BadView.java
similarity index 59%
rename from src/test/java/com/flowingcode/vaadin/addons/template/DemoView.java
rename to test-spring-boot-v14/src/main/java/com/example/application/BadView.java
index a600c9d..33b5eb1 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/template/DemoView.java
+++ b/test-spring-boot-v14/src/main/java/com/example/application/BadView.java
@@ -1,15 +1,15 @@
/*-
* #%L
- * Template Add-on
+ * Add-on Utils - Vaadin 14 Spring-Boot Test
* %%
* Copyright (C) 2024 Flowing Code
* %%
* 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.
@@ -17,20 +17,19 @@
* limitations under the License.
* #L%
*/
+package com.example.application;
-package com.flowingcode.vaadin.addons.template;
-
-import com.vaadin.flow.component.orderedlayout.VerticalLayout;
-import com.vaadin.flow.router.BeforeEnterEvent;
-import com.vaadin.flow.router.BeforeEnterObserver;
+import com.example.disallowed.BadComponent;
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.router.Route;
-@SuppressWarnings("serial")
-@Route("")
-public class DemoView extends VerticalLayout implements BeforeEnterObserver {
+@Route("bad")
+public class BadView extends Div {
- @Override
- public void beforeEnter(BeforeEnterEvent event) {
- event.forwardTo(TemplateDemoView.class);
+ public BadView() {
+ add(new Span("Bad"));
+ add(new BadComponent());
}
+
}
diff --git a/test-spring-boot-v14/src/main/java/com/example/application/GoodComponent.java b/test-spring-boot-v14/src/main/java/com/example/application/GoodComponent.java
new file mode 100644
index 0000000..bc5fa16
--- /dev/null
+++ b/test-spring-boot-v14/src/main/java/com/example/application/GoodComponent.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 14 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.html.Div;
+
+@SuppressWarnings("serial")
+@Tag("my-component")
+public class GoodComponent extends Div {
+
+ {
+ AllowedPackageChecker.check(this, GoodComponent.class);
+ }
+
+}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemoView.java b/test-spring-boot-v14/src/main/java/com/example/application/GoodView.java
similarity index 55%
rename from src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemoView.java
rename to test-spring-boot-v14/src/main/java/com/example/application/GoodView.java
index 1954535..408a645 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemoView.java
+++ b/test-spring-boot-v14/src/main/java/com/example/application/GoodView.java
@@ -1,15 +1,15 @@
/*-
* #%L
- * Template Add-on
+ * Add-on Utils - Vaadin 14 Spring-Boot Test
* %%
* Copyright (C) 2024 Flowing Code
* %%
* 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.
@@ -17,22 +17,18 @@
* limitations under the License.
* #L%
*/
-package com.flowingcode.vaadin.addons.template;
+package com.example.application;
-import com.flowingcode.vaadin.addons.DemoLayout;
-import com.flowingcode.vaadin.addons.GithubLink;
-import com.flowingcode.vaadin.addons.demo.TabbedDemo;
-import com.vaadin.flow.router.ParentLayout;
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.router.Route;
-@SuppressWarnings("serial")
-@ParentLayout(DemoLayout.class)
-@Route("template")
-@GithubLink("https://github.com/FlowingCode/AddonStarter24")
-public class TemplateDemoView extends TabbedDemo {
+@Route("good")
+public class GoodView extends Div {
- public TemplateDemoView() {
- addDemo(TemplateDemo.class);
- setSizeFull();
+ public GoodView() {
+ add(new Span("Good"));
+ add(new GoodComponent());
}
+
}
diff --git a/test-spring-boot-v14/src/main/java/com/example/disallowed/BadComponent.java b/test-spring-boot-v14/src/main/java/com/example/disallowed/BadComponent.java
new file mode 100644
index 0000000..6c78a3e
--- /dev/null
+++ b/test-spring-boot-v14/src/main/java/com/example/disallowed/BadComponent.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 14 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.disallowed;
+
+import com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.html.Div;
+
+@SuppressWarnings("serial")
+@Tag("not-allowed")
+public class BadComponent extends Div {
+
+ {
+ AllowedPackageChecker.check(this, BadComponent.class);
+ }
+
+}
diff --git a/test-spring-boot-v14/src/main/resources/META-INF/resources/icons/icon.png b/test-spring-boot-v14/src/main/resources/META-INF/resources/icons/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..df2ed4bd80778f7141c825ce9275984b4a34a15c
GIT binary patch
literal 2424
zcmb7GYdDl!8(!}_2Xi!xLSytzg|bPKGNKGdQ9{O+Mmf~5kr)bTi+7yjDmC;)Ax){I
z!*)I-hJgV-~m>2#eiJdBKFd<3_8n6Io=hB2qm7CYu9O3
z0zkOu#&z^L08O-tR0RN${3zEeSF8KK#;IF&j$SWAQbB5s2(9EKzB
z^Da35@IY%rH25Kcr3n#9Ea%9Z*qN$1Wn5aY^N2E|+p)g)VbS&ec{7g|RF_7zhQ9P@
z9yJtfd|8OyXCdeydcAzqT!x*f=r2AxXPA(bI&rxlm(Na~g!_06#7yqw%;pP2qxKW0
z6ekI)$kl&X1E*PbcXllP`;=MKDEWH-L1
zJqwMdAhJ)hd_>y^#1AECemZQfh2zWviA$auf@u4!aAZaKRY
zzt3EQ&m*BaGq!6w!#6!QjVp^k`l^OPLIXZE{;(bPC>>2Eal&8cQ!do}fhTbSO8alG
zTtPfKWo;-jt#)^Wq*{>P_TOkrLh~PZD%woFAO$Zs#BP|Ur)%DpWk617z1QQ88-)1z
zQFk^LH&jMod<)$
pvYS!Cl
zlvPo+lA14Ikh02`Kd3WzuPUh}_%2sR*MHp}(E`)QsX$7ijsdr}5}}T|+&tFNw^y4n`en55hinWX3eD
zrUd*`52D}1#C7m44j*)A<+5{qM3hNVlTz@
z&}_OK2K!qbBa5PBOPPX=CQ(E2!EWMGVb#a2*UV*tjHks26w7Xy9k`=g)T?*UXA4b4
zT+JhAiFZeQ3cR-nU$Hz!ynEAZ_JUZS5{D^+Sf89sP>2gBU3NozlO2ymlpmlNk&tU~
z8l21~3~T4hG|t!zM%*4d8-OskJwDtT*uBi_M35oopzFgx(ns+U|Icx(ICfeJMm@NM9
z5gt}L>Y#XDe6ZO!g)yo$zx07wvZcrLBXwYH^QN^Lx3w#Xc@?jfE1P1IcfRh@>{?ug
z(lY8K9SXA&C+~L8obn4DY{A9AxKZWKvZ5KBTwD;466+ydnrO8LzB7|InNWPcjV|du
z+srCh)$&Fs_KEV_=}k@h);n1h6tAD(oin#PLttU6HzFK5o{qimAKNoD!#r(s>@}Pc
z_Mpb_em^W2Jbpt)Wwl#yLg${Jx(bch5weEylfompA_MC;)*u$K=X5T=6w3hqQVcgr
zo6PT|B!aG8d=%YcKLRywF<*Kl-5%I9<@W$rDH$H*nNkt420<2PdJ)1(&0Zxe3Q@RQ
z^_y}S`Q7j%*|^OJ`?c8Zu1>JcK4WVHBxdCobA!Z1fP=~xfVt}MI@25?kV4yLLQ-9mawo?b+=-!TEP0V(d
zp?Lw%VGG#Q7bhvYkL_w=cnYT|iNwU3T?MmffhO+zP#O<}9>mfrr
z(08-6*k_mJvC^@SO)FMmEOlf`-<;zl+NJCb-y8<$zs;O0t2Z=(DvqHXHd7>;vH;eu
z01*!CSR~}Y6R;a9#beX=h)~SKujH0|BB0U%D=BL|i3Jq|Q>2HWdv_6hVb2L95*yDy
zKu3hsrUWc&o=9Yg#kcjwP^7oE8WNX%i8c_AneJ!9Pb7IcC`TdFMz|{8xF4Ay)&UIM
zruFS*cNR})X^Cp>_HeQ^ATEBZHLIW~M&vnK%QLDS&
zaBx>D7&3-MBB8=Ui`pcR!_W|3^nvIihx>F6UUBRrP|}r-gL-FpG{PTpxLa}$D?5(~
z^1OUtfz^ZENGMzs094B2z12!LQcCn%U;4xLj?1FUAswpf}2X^=6!9UzsZV2rin
zQW!QL5n%EVSXASvFb8AuO(ae|-f)qSO>hn(261k%9w101NRJSM$C6{VE){=anRx%@
zDu$yEV}c=xpuqj5VVhnMewR-r=oNq
zGDe`pZF$g*4Ld-XSS3>>kMgrt7pMfNlT@c~R=1HtAduBB#Q3bZz#Vr*^BVl&$`eeGVHm@3l9-1XQ{j&!?^`(YTdq~qC
z@SZh%)lLn!tB`-_u2O$IP*%$Ooi)ocCRY8A-w*_xH{bdCE)GXm7r422aQ|`&O8pO#
C@ant(
literal 0
HcmV?d00001
diff --git a/test-spring-boot-v14/src/main/resources/application.properties b/test-spring-boot-v14/src/main/resources/application.properties
new file mode 100644
index 0000000..6d8e43c
--- /dev/null
+++ b/test-spring-boot-v14/src/main/resources/application.properties
@@ -0,0 +1,7 @@
+server.port=${PORT:8014}
+logging.level.org.atmosphere = warn
+
+# Launch the default browser when starting the application in development mode
+vaadin.launch-browser=true
+
+vaadin.whitelisted-packages = com.vaadin,org.vaadin,com.example.application
diff --git a/test-spring-boot-v14/src/main/resources/banner.txt b/test-spring-boot-v14/src/main/resources/banner.txt
new file mode 100644
index 0000000..569727b
--- /dev/null
+++ b/test-spring-boot-v14/src/main/resources/banner.txt
@@ -0,0 +1 @@
+Add-on Utils - Vaadin 14 Spring-Boot Test
\ No newline at end of file
diff --git a/test-spring-boot-v14/src/test/java/com/example/application/AllowedPackageChecker14IT.java b/test-spring-boot-v14/src/test/java/com/example/application/AllowedPackageChecker14IT.java
new file mode 100644
index 0000000..3eb585c
--- /dev/null
+++ b/test-spring-boot-v14/src/test/java/com/example/application/AllowedPackageChecker14IT.java
@@ -0,0 +1,73 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 14 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.html.testbench.DivElement;
+import com.vaadin.testbench.TestBenchTestCase;
+import io.github.bonigarcia.wdm.WebDriverManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.logging.LogEntries;
+import org.openqa.selenium.logging.LogEntry;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class AllowedPackageChecker14IT extends TestBenchTestCase {
+
+ @BeforeClass
+ public static void setupClass() {
+ WebDriverManager.chromedriver().setup();
+ }
+
+ @Before
+ public void setup() throws Exception {
+ setDriver(new ChromeDriver());
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ getDriver().quit();
+ }
+
+ @Test
+ public void testBad() {
+ getDriver().get("http://127.0.0.1:8014/bad");
+ WebDriverWait wait = new WebDriverWait(getDriver(), 1);
+ wait.until(ExpectedConditions.alertIsPresent());
+ getDriver().switchTo().alert().dismiss();
+ $(DivElement.class).first();
+ LogEntries logEntries = getDriver().manage().logs().get("browser");
+ for (LogEntry entry : logEntries) {
+ System.out.println(entry);
+ }
+ }
+
+ @Test
+ public void testGood() {
+ getDriver().get("http://127.0.0.1:8014/good");
+ getCommandExecutor().waitForVaadin();
+ $(DivElement.class).first();
+ }
+
+}
+
diff --git a/test-spring-boot-v23/.gitignore b/test-spring-boot-v23/.gitignore
new file mode 100644
index 0000000..e30d022
--- /dev/null
+++ b/test-spring-boot-v23/.gitignore
@@ -0,0 +1,27 @@
+/target/
+.idea/
+.vscode/
+.settings
+.project
+.classpath
+
+*.iml
+.DS_Store
+
+# The following files are generated/updated by vaadin-maven-plugin
+node_modules/
+/frontend/generated/
+pnpmfile.js
+vite.generated.ts
+
+# Browser drivers for local integration tests
+drivers/
+# Error screenshots generated by TestBench for failed integration tests
+error-screenshots/
+webpack.generated.js
+/tsconfig.json
+/types.d.ts
+/vite.config.ts
+/package-lock.json
+/package.json
+/frontend
\ No newline at end of file
diff --git a/test-spring-boot-v23/pom.xml b/test-spring-boot-v23/pom.xml
new file mode 100644
index 0000000..175b904
--- /dev/null
+++ b/test-spring-boot-v23/pom.xml
@@ -0,0 +1,147 @@
+
+
+ 4.0.0
+
+ addon-utils-test-spring-boot-v23
+ Add-on Utils - Vaadin 23 Spring-Boot Test
+ jar
+
+
+ 17
+ 17
+ 23.4.1
+ 2.7.2
+
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils-project
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+ com.vaadin
+ vaadin-bom
+ ${vaadin.version}
+ pom
+ import
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+ com.vaadin
+ vaadin-core
+
+
+ com.vaadin
+ vaadin-spring-boot-starter
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils
+ ${project.version}
+
+
+ com.vaadin
+ vaadin-testbench
+ test
+
+
+ com.vaadin
+ vaadin-testbench-core
+ test
+
+
+ io.github.bonigarcia
+ webdrivermanager
+ 5.9.2
+ test
+
+
+
+
+ spring-boot:run
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ com.vaadin
+ vaadin-maven-plugin
+ ${vaadin.version}
+
+
+
+ prepare-frontend
+
+
+
+
+
+
+
+
+
+
+ it
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ start-spring-boot
+ pre-integration-test
+
+ start
+
+
+
+ stop-spring-boot
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
+ false
+ true
+
+
+
+
+
+
+
+
diff --git a/test-spring-boot-v23/src/main/java/com/example/application/Application.java b/test-spring-boot-v23/src/main/java/com/example/application/Application.java
new file mode 100644
index 0000000..119a127
--- /dev/null
+++ b/test-spring-boot-v23/src/main/java/com/example/application/Application.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 23 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.page.AppShellConfigurator;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SuppressWarnings("serial")
+@SpringBootApplication
+public class Application implements AppShellConfigurator {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/test-spring-boot-v23/src/main/java/com/example/application/BadView.java b/test-spring-boot-v23/src/main/java/com/example/application/BadView.java
new file mode 100644
index 0000000..288a02f
--- /dev/null
+++ b/test-spring-boot-v23/src/main/java/com/example/application/BadView.java
@@ -0,0 +1,35 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 23 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.example.disallowed.BadComponent;
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.component.html.Span;
+import com.vaadin.flow.router.Route;
+
+@Route("bad")
+public class BadView extends Div {
+
+ public BadView() {
+ add(new Span("Bad"));
+ add(new BadComponent());
+ }
+
+}
diff --git a/test-spring-boot-v23/src/main/java/com/example/application/GoodComponent.java b/test-spring-boot-v23/src/main/java/com/example/application/GoodComponent.java
new file mode 100644
index 0000000..16cefbf
--- /dev/null
+++ b/test-spring-boot-v23/src/main/java/com/example/application/GoodComponent.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 23 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.html.Div;
+
+@SuppressWarnings("serial")
+@Tag("my-component")
+public class GoodComponent extends Div {
+
+ {
+ AllowedPackageChecker.check(this, GoodComponent.class);
+ }
+
+}
diff --git a/test-spring-boot-v23/src/main/java/com/example/application/GoodView.java b/test-spring-boot-v23/src/main/java/com/example/application/GoodView.java
new file mode 100644
index 0000000..c40f24b
--- /dev/null
+++ b/test-spring-boot-v23/src/main/java/com/example/application/GoodView.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 23 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.component.html.Span;
+import com.vaadin.flow.router.Route;
+
+@Route("good")
+public class GoodView extends Div {
+
+ public GoodView() {
+ add(new Span("Good"));
+ add(new GoodComponent());
+ }
+
+}
diff --git a/test-spring-boot-v23/src/main/java/com/example/disallowed/BadComponent.java b/test-spring-boot-v23/src/main/java/com/example/disallowed/BadComponent.java
new file mode 100644
index 0000000..82b0997
--- /dev/null
+++ b/test-spring-boot-v23/src/main/java/com/example/disallowed/BadComponent.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 23 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.disallowed;
+
+import com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.html.Div;
+
+@SuppressWarnings("serial")
+@Tag("not-allowed")
+public class BadComponent extends Div {
+
+ {
+ AllowedPackageChecker.check(this, BadComponent.class);
+ }
+
+}
diff --git a/test-spring-boot-v23/src/main/resources/META-INF/resources/icons/icon.png b/test-spring-boot-v23/src/main/resources/META-INF/resources/icons/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..df2ed4bd80778f7141c825ce9275984b4a34a15c
GIT binary patch
literal 2424
zcmb7GYdDl!8(!}_2Xi!xLSytzg|bPKGNKGdQ9{O+Mmf~5kr)bTi+7yjDmC;)Ax){I
z!*)I-hJgV-~m>2#eiJdBKFd<3_8n6Io=hB2qm7CYu9O3
z0zkOu#&z^L08O-tR0RN${3zEeSF8KK#;IF&j$SWAQbB5s2(9EKzB
z^Da35@IY%rH25Kcr3n#9Ea%9Z*qN$1Wn5aY^N2E|+p)g)VbS&ec{7g|RF_7zhQ9P@
z9yJtfd|8OyXCdeydcAzqT!x*f=r2AxXPA(bI&rxlm(Na~g!_06#7yqw%;pP2qxKW0
z6ekI)$kl&X1E*PbcXllP`;=MKDEWH-L1
zJqwMdAhJ)hd_>y^#1AECemZQfh2zWviA$auf@u4!aAZaKRY
zzt3EQ&m*BaGq!6w!#6!QjVp^k`l^OPLIXZE{;(bPC>>2Eal&8cQ!do}fhTbSO8alG
zTtPfKWo;-jt#)^Wq*{>P_TOkrLh~PZD%woFAO$Zs#BP|Ur)%DpWk617z1QQ88-)1z
zQFk^LH&jMod<)$
pvYS!Cl
zlvPo+lA14Ikh02`Kd3WzuPUh}_%2sR*MHp}(E`)QsX$7ijsdr}5}}T|+&tFNw^y4n`en55hinWX3eD
zrUd*`52D}1#C7m44j*)A<+5{qM3hNVlTz@
z&}_OK2K!qbBa5PBOPPX=CQ(E2!EWMGVb#a2*UV*tjHks26w7Xy9k`=g)T?*UXA4b4
zT+JhAiFZeQ3cR-nU$Hz!ynEAZ_JUZS5{D^+Sf89sP>2gBU3NozlO2ymlpmlNk&tU~
z8l21~3~T4hG|t!zM%*4d8-OskJwDtT*uBi_M35oopzFgx(ns+U|Icx(ICfeJMm@NM9
z5gt}L>Y#XDe6ZO!g)yo$zx07wvZcrLBXwYH^QN^Lx3w#Xc@?jfE1P1IcfRh@>{?ug
z(lY8K9SXA&C+~L8obn4DY{A9AxKZWKvZ5KBTwD;466+ydnrO8LzB7|InNWPcjV|du
z+srCh)$&Fs_KEV_=}k@h);n1h6tAD(oin#PLttU6HzFK5o{qimAKNoD!#r(s>@}Pc
z_Mpb_em^W2Jbpt)Wwl#yLg${Jx(bch5weEylfompA_MC;)*u$K=X5T=6w3hqQVcgr
zo6PT|B!aG8d=%YcKLRywF<*Kl-5%I9<@W$rDH$H*nNkt420<2PdJ)1(&0Zxe3Q@RQ
z^_y}S`Q7j%*|^OJ`?c8Zu1>JcK4WVHBxdCobA!Z1fP=~xfVt}MI@25?kV4yLLQ-9mawo?b+=-!TEP0V(d
zp?Lw%VGG#Q7bhvYkL_w=cnYT|iNwU3T?MmffhO+zP#O<}9>mfrr
z(08-6*k_mJvC^@SO)FMmEOlf`-<;zl+NJCb-y8<$zs;O0t2Z=(DvqHXHd7>;vH;eu
z01*!CSR~}Y6R;a9#beX=h)~SKujH0|BB0U%D=BL|i3Jq|Q>2HWdv_6hVb2L95*yDy
zKu3hsrUWc&o=9Yg#kcjwP^7oE8WNX%i8c_AneJ!9Pb7IcC`TdFMz|{8xF4Ay)&UIM
zruFS*cNR})X^Cp>_HeQ^ATEBZHLIW~M&vnK%QLDS&
zaBx>D7&3-MBB8=Ui`pcR!_W|3^nvIihx>F6UUBRrP|}r-gL-FpG{PTpxLa}$D?5(~
z^1OUtfz^ZENGMzs094B2z12!LQcCn%U;4xLj?1FUAswpf}2X^=6!9UzsZV2rin
zQW!QL5n%EVSXASvFb8AuO(ae|-f)qSO>hn(261k%9w101NRJSM$C6{VE){=anRx%@
zDu$yEV}c=xpuqj5VVhnMewR-r=oNq
zGDe`pZF$g*4Ld-XSS3>>kMgrt7pMfNlT@c~R=1HtAduBB#Q3bZz#Vr*^BVl&$`eeGVHm@3l9-1XQ{j&!?^`(YTdq~qC
z@SZh%)lLn!tB`-_u2O$IP*%$Ooi)ocCRY8A-w*_xH{bdCE)GXm7r422aQ|`&O8pO#
C@ant(
literal 0
HcmV?d00001
diff --git a/test-spring-boot-v23/src/main/resources/application.properties b/test-spring-boot-v23/src/main/resources/application.properties
new file mode 100644
index 0000000..d1af96d
--- /dev/null
+++ b/test-spring-boot-v23/src/main/resources/application.properties
@@ -0,0 +1,7 @@
+server.port=${PORT:8023}
+logging.level.org.atmosphere = warn
+
+# Launch the default browser when starting the application in development mode
+vaadin.launch-browser=true
+
+vaadin.allowed-packages = com.vaadin,org.vaadin,com.example.application
diff --git a/test-spring-boot-v23/src/main/resources/banner.txt b/test-spring-boot-v23/src/main/resources/banner.txt
new file mode 100644
index 0000000..fd8568c
--- /dev/null
+++ b/test-spring-boot-v23/src/main/resources/banner.txt
@@ -0,0 +1 @@
+Add-on Utils - Vaadin 23 Spring-Boot Test
\ No newline at end of file
diff --git a/test-spring-boot-v23/src/test/java/com/example/application/AllowedPackageChecker23IT.java b/test-spring-boot-v23/src/test/java/com/example/application/AllowedPackageChecker23IT.java
new file mode 100644
index 0000000..10bbdde
--- /dev/null
+++ b/test-spring-boot-v23/src/test/java/com/example/application/AllowedPackageChecker23IT.java
@@ -0,0 +1,67 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 23 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.html.testbench.DivElement;
+import com.vaadin.testbench.TestBenchTestCase;
+import java.time.Duration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.logging.LogEntries;
+import org.openqa.selenium.logging.LogEntry;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class AllowedPackageChecker23IT extends TestBenchTestCase {
+
+ @Before
+ public void setup() throws Exception {
+ setDriver(new ChromeDriver());
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ getDriver().quit();
+ }
+
+ @Test
+ public void testBad() {
+ getDriver().get("http://127.0.0.1:8023/bad");
+ WebDriverWait wait = new WebDriverWait(getDriver(), Duration.ofSeconds(1));
+ wait.until(ExpectedConditions.alertIsPresent());
+ getDriver().switchTo().alert().dismiss();
+ $(DivElement.class).first();
+ LogEntries logEntries = getDriver().manage().logs().get("browser");
+ for (LogEntry entry : logEntries) {
+ System.out.println(entry);
+ }
+ }
+
+ @Test
+ public void testGood() {
+ getDriver().get("http://127.0.0.1:8023/good");
+ getCommandExecutor().waitForVaadin();
+ $(DivElement.class).first();
+ }
+
+}
+
diff --git a/test-spring-boot-v24/.gitignore b/test-spring-boot-v24/.gitignore
new file mode 100644
index 0000000..77ff7e1
--- /dev/null
+++ b/test-spring-boot-v24/.gitignore
@@ -0,0 +1,23 @@
+/target/
+.idea/
+.vscode/
+.settings
+.project
+.classpath
+
+*.iml
+.DS_Store
+
+# The following files are generated/updated by vaadin-maven-plugin
+node_modules/
+src/main/frontend/generated/
+pnpmfile.js
+vite.generated.ts
+
+# Browser drivers for local integration tests
+drivers/
+# Error screenshots generated by TestBench for failed integration tests
+error-screenshots/
+webpack.generated.js
+
+src/main/frontend
\ No newline at end of file
diff --git a/test-spring-boot-v24/pom.xml b/test-spring-boot-v24/pom.xml
new file mode 100644
index 0000000..15cc10c
--- /dev/null
+++ b/test-spring-boot-v24/pom.xml
@@ -0,0 +1,147 @@
+
+
+ 4.0.0
+
+ addon-utils-test-spring-boot-v24
+ Add-on Utils - Vaadin 24 Spring-Boot Test
+ jar
+
+
+ 17
+ 17
+ 24.4.12
+ 3.2.10
+
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils-project
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+ com.vaadin
+ vaadin-bom
+ ${vaadin.version}
+ pom
+ import
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+ com.vaadin
+ vaadin-core
+
+
+ com.vaadin
+ vaadin-spring-boot-starter
+
+
+ com.flowingcode.vaadin.addons
+ addon-utils
+ ${project.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ com.vaadin
+ vaadin-testbench-junit5
+ test
+
+
+ io.github.bonigarcia
+ selenium-jupiter
+ 5.1.1
+ test
+
+
+
+
+ spring-boot:run
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ com.vaadin
+ vaadin-maven-plugin
+ ${vaadin.version}
+
+
+
+ prepare-frontend
+
+
+
+
+
+
+
+
+
+
+ it
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ start-spring-boot
+ pre-integration-test
+
+ start
+
+
+
+ stop-spring-boot
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
+ false
+ true
+
+
+
+
+
+
+
+
diff --git a/test-spring-boot-v24/src/main/java/com/example/application/Application.java b/test-spring-boot-v24/src/main/java/com/example/application/Application.java
new file mode 100644
index 0000000..8566e02
--- /dev/null
+++ b/test-spring-boot-v24/src/main/java/com/example/application/Application.java
@@ -0,0 +1,32 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 24 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.page.AppShellConfigurator;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+@SpringBootApplication
+public class Application implements AppShellConfigurator {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/test-spring-boot-v24/src/main/java/com/example/application/BadView.java b/test-spring-boot-v24/src/main/java/com/example/application/BadView.java
new file mode 100644
index 0000000..5319020
--- /dev/null
+++ b/test-spring-boot-v24/src/main/java/com/example/application/BadView.java
@@ -0,0 +1,35 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 24 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.example.disallowed.BadComponent;
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.component.html.Span;
+import com.vaadin.flow.router.Route;
+
+@Route("bad")
+public class BadView extends Div {
+
+ public BadView() {
+ add(new Span("Bad"));
+ add(new BadComponent());
+ }
+
+}
diff --git a/test-spring-boot-v24/src/main/java/com/example/application/GoodComponent.java b/test-spring-boot-v24/src/main/java/com/example/application/GoodComponent.java
new file mode 100644
index 0000000..4e1598c
--- /dev/null
+++ b/test-spring-boot-v24/src/main/java/com/example/application/GoodComponent.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 24 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.html.Div;
+
+@SuppressWarnings("serial")
+@Tag("my-component")
+public class GoodComponent extends Div {
+
+ {
+ AllowedPackageChecker.check(this, GoodComponent.class);
+ }
+
+}
diff --git a/test-spring-boot-v24/src/main/java/com/example/application/GoodView.java b/test-spring-boot-v24/src/main/java/com/example/application/GoodView.java
new file mode 100644
index 0000000..f74bc23
--- /dev/null
+++ b/test-spring-boot-v24/src/main/java/com/example/application/GoodView.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 24 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.component.html.Span;
+import com.vaadin.flow.router.Route;
+
+@Route("good")
+public class GoodView extends Div {
+
+ public GoodView() {
+ add(new Span("Good"));
+ add(new GoodComponent());
+ }
+
+}
diff --git a/test-spring-boot-v24/src/main/java/com/example/disallowed/BadComponent.java b/test-spring-boot-v24/src/main/java/com/example/disallowed/BadComponent.java
new file mode 100644
index 0000000..09b9d2b
--- /dev/null
+++ b/test-spring-boot-v24/src/main/java/com/example/disallowed/BadComponent.java
@@ -0,0 +1,34 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 24 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.disallowed;
+
+import com.flowingcode.vaadin.addons.utils.checker.AllowedPackageChecker;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.html.Div;
+
+@SuppressWarnings("serial")
+@Tag("not-allowed")
+public class BadComponent extends Div {
+
+ {
+ AllowedPackageChecker.check(this, BadComponent.class);
+ }
+
+}
diff --git a/test-spring-boot-v24/src/main/resources/META-INF/resources/icons/icon.png b/test-spring-boot-v24/src/main/resources/META-INF/resources/icons/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..df2ed4bd80778f7141c825ce9275984b4a34a15c
GIT binary patch
literal 2424
zcmb7GYdDl!8(!}_2Xi!xLSytzg|bPKGNKGdQ9{O+Mmf~5kr)bTi+7yjDmC;)Ax){I
z!*)I-hJgV-~m>2#eiJdBKFd<3_8n6Io=hB2qm7CYu9O3
z0zkOu#&z^L08O-tR0RN${3zEeSF8KK#;IF&j$SWAQbB5s2(9EKzB
z^Da35@IY%rH25Kcr3n#9Ea%9Z*qN$1Wn5aY^N2E|+p)g)VbS&ec{7g|RF_7zhQ9P@
z9yJtfd|8OyXCdeydcAzqT!x*f=r2AxXPA(bI&rxlm(Na~g!_06#7yqw%;pP2qxKW0
z6ekI)$kl&X1E*PbcXllP`;=MKDEWH-L1
zJqwMdAhJ)hd_>y^#1AECemZQfh2zWviA$auf@u4!aAZaKRY
zzt3EQ&m*BaGq!6w!#6!QjVp^k`l^OPLIXZE{;(bPC>>2Eal&8cQ!do}fhTbSO8alG
zTtPfKWo;-jt#)^Wq*{>P_TOkrLh~PZD%woFAO$Zs#BP|Ur)%DpWk617z1QQ88-)1z
zQFk^LH&jMod<)$
pvYS!Cl
zlvPo+lA14Ikh02`Kd3WzuPUh}_%2sR*MHp}(E`)QsX$7ijsdr}5}}T|+&tFNw^y4n`en55hinWX3eD
zrUd*`52D}1#C7m44j*)A<+5{qM3hNVlTz@
z&}_OK2K!qbBa5PBOPPX=CQ(E2!EWMGVb#a2*UV*tjHks26w7Xy9k`=g)T?*UXA4b4
zT+JhAiFZeQ3cR-nU$Hz!ynEAZ_JUZS5{D^+Sf89sP>2gBU3NozlO2ymlpmlNk&tU~
z8l21~3~T4hG|t!zM%*4d8-OskJwDtT*uBi_M35oopzFgx(ns+U|Icx(ICfeJMm@NM9
z5gt}L>Y#XDe6ZO!g)yo$zx07wvZcrLBXwYH^QN^Lx3w#Xc@?jfE1P1IcfRh@>{?ug
z(lY8K9SXA&C+~L8obn4DY{A9AxKZWKvZ5KBTwD;466+ydnrO8LzB7|InNWPcjV|du
z+srCh)$&Fs_KEV_=}k@h);n1h6tAD(oin#PLttU6HzFK5o{qimAKNoD!#r(s>@}Pc
z_Mpb_em^W2Jbpt)Wwl#yLg${Jx(bch5weEylfompA_MC;)*u$K=X5T=6w3hqQVcgr
zo6PT|B!aG8d=%YcKLRywF<*Kl-5%I9<@W$rDH$H*nNkt420<2PdJ)1(&0Zxe3Q@RQ
z^_y}S`Q7j%*|^OJ`?c8Zu1>JcK4WVHBxdCobA!Z1fP=~xfVt}MI@25?kV4yLLQ-9mawo?b+=-!TEP0V(d
zp?Lw%VGG#Q7bhvYkL_w=cnYT|iNwU3T?MmffhO+zP#O<}9>mfrr
z(08-6*k_mJvC^@SO)FMmEOlf`-<;zl+NJCb-y8<$zs;O0t2Z=(DvqHXHd7>;vH;eu
z01*!CSR~}Y6R;a9#beX=h)~SKujH0|BB0U%D=BL|i3Jq|Q>2HWdv_6hVb2L95*yDy
zKu3hsrUWc&o=9Yg#kcjwP^7oE8WNX%i8c_AneJ!9Pb7IcC`TdFMz|{8xF4Ay)&UIM
zruFS*cNR})X^Cp>_HeQ^ATEBZHLIW~M&vnK%QLDS&
zaBx>D7&3-MBB8=Ui`pcR!_W|3^nvIihx>F6UUBRrP|}r-gL-FpG{PTpxLa}$D?5(~
z^1OUtfz^ZENGMzs094B2z12!LQcCn%U;4xLj?1FUAswpf}2X^=6!9UzsZV2rin
zQW!QL5n%EVSXASvFb8AuO(ae|-f)qSO>hn(261k%9w101NRJSM$C6{VE){=anRx%@
zDu$yEV}c=xpuqj5VVhnMewR-r=oNq
zGDe`pZF$g*4Ld-XSS3>>kMgrt7pMfNlT@c~R=1HtAduBB#Q3bZz#Vr*^BVl&$`eeGVHm@3l9-1XQ{j&!?^`(YTdq~qC
z@SZh%)lLn!tB`-_u2O$IP*%$Ooi)ocCRY8A-w*_xH{bdCE)GXm7r422aQ|`&O8pO#
C@ant(
literal 0
HcmV?d00001
diff --git a/test-spring-boot-v24/src/main/resources/application.properties b/test-spring-boot-v24/src/main/resources/application.properties
new file mode 100644
index 0000000..edb31a1
--- /dev/null
+++ b/test-spring-boot-v24/src/main/resources/application.properties
@@ -0,0 +1,7 @@
+server.port=${PORT:8024}
+logging.level.org.atmosphere = warn
+
+# Launch the default browser when starting the application in development mode
+vaadin.launch-browser=true
+
+vaadin.allowed-packages = com.vaadin,org.vaadin,com.example.application
diff --git a/test-spring-boot-v24/src/main/resources/banner.txt b/test-spring-boot-v24/src/main/resources/banner.txt
new file mode 100644
index 0000000..95bb58d
--- /dev/null
+++ b/test-spring-boot-v24/src/main/resources/banner.txt
@@ -0,0 +1 @@
+Add-on Utils - Vaadin 24 Spring-Boot Test
\ No newline at end of file
diff --git a/test-spring-boot-v24/src/test/java/com/example/application/AllowedPackageChecker24IT.java b/test-spring-boot-v24/src/test/java/com/example/application/AllowedPackageChecker24IT.java
new file mode 100644
index 0000000..dd34a8c
--- /dev/null
+++ b/test-spring-boot-v24/src/test/java/com/example/application/AllowedPackageChecker24IT.java
@@ -0,0 +1,54 @@
+/*-
+ * #%L
+ * Add-on Utils - Vaadin 24 Spring-Boot Test
+ * %%
+ * Copyright (C) 2024 Flowing Code
+ * %%
+ * 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.
+ * #L%
+ */
+package com.example.application;
+
+import com.vaadin.flow.component.html.testbench.DivElement;
+import com.vaadin.testbench.BrowserTest;
+import com.vaadin.testbench.BrowserTestBase;
+import java.time.Duration;
+import org.openqa.selenium.logging.LogEntries;
+import org.openqa.selenium.logging.LogEntry;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class AllowedPackageChecker24IT extends BrowserTestBase {
+
+ @BrowserTest
+ public void testBad() {
+ getDriver().get("http://127.0.0.1:8024/bad");
+ WebDriverWait wait = new WebDriverWait(getDriver(), Duration.ofSeconds(1));
+ wait.until(ExpectedConditions.alertIsPresent());
+ getDriver().switchTo().alert().dismiss();
+ $(DivElement.class).first();
+ LogEntries logEntries = getDriver().manage().logs().get("browser");
+ for (LogEntry entry : logEntries) {
+ System.out.println(entry);
+ }
+ }
+
+ @BrowserTest
+ public void testGood() {
+ getDriver().get("http://127.0.0.1:8024/good");
+ getCommandExecutor().waitForVaadin();
+ $(DivElement.class).first();
+ }
+
+}
+