From 434c8601d950d2b7a6052e51d5eb99286ef6ee1c Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Tue, 30 Dec 2025 13:45:04 -0300 Subject: [PATCH 1/2] build: set version to 1.5.0-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0a090c7..c4bbb18 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.flowingcode.vaadin.test testbench-rpc - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT TestBenchRPC Remote procedure calls for Vaadin TestBench https://www.flowingcode.com/en/open-source/ From 5b3edd8522678ac953517ebe24fa3a4eab2d274c Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Tue, 30 Dec 2025 13:50:17 -0300 Subject: [PATCH 2/2] feat: add serializable Version DTO --- .../vaadin/testbench/rpc/Version.java | 56 ++++++++++++++++ .../testbench/rpc/ViewInitializerImpl.java | 2 + .../rpc/integration/VersionView.java | 66 +++++++++++++++++++ .../rpc/integration/VersionViewCallables.java | 37 +++++++++++ .../rpc/integration/VersionViewIT.java | 58 ++++++++++++++++ 5 files changed, 219 insertions(+) create mode 100644 src/main/java/com/flowingcode/vaadin/testbench/rpc/Version.java create mode 100644 src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionView.java create mode 100644 src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewCallables.java create mode 100644 src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewIT.java diff --git a/src/main/java/com/flowingcode/vaadin/testbench/rpc/Version.java b/src/main/java/com/flowingcode/vaadin/testbench/rpc/Version.java new file mode 100644 index 0000000..8ca7b06 --- /dev/null +++ b/src/main/java/com/flowingcode/vaadin/testbench/rpc/Version.java @@ -0,0 +1,56 @@ +package com.flowingcode.vaadin.testbench.rpc; + +import java.io.Serializable; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.experimental.FieldDefaults; + +/** + * A serializable snapshot of the Vaadin framework version information. + * + * @see com.vaadin.flow.server.Version + */ +@Getter +@SuppressWarnings("javadoc") +@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true) +public class Version implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Gets the full version, in format {@literal x.y.z} or {@literal x.y.z.qualifier}. + * + * @return the full version number + */ + String fullVersion; + + /** + * Gets the major version, {@literal y} in {@literal x.y.z}. + * + * @return the major version number + */ + int majorVersion; + + /** + * Gets the minor version, {@literal y} in {@literal x.y.z}. + * + * @return the minor version number + */ + int minorVersion; + + /** + * Gets the revision, {@literal z} in {@literal x.y.z}. + * + * @return the revision number + */ + int revision; + + public Version() { + fullVersion = com.vaadin.flow.server.Version.getFullVersion(); + majorVersion = com.vaadin.flow.server.Version.getMajorVersion(); + minorVersion = com.vaadin.flow.server.Version.getMinorVersion(); + revision = com.vaadin.flow.server.Version.getRevision(); + } + + +} diff --git a/src/test/java/com/flowingcode/vaadin/testbench/rpc/ViewInitializerImpl.java b/src/test/java/com/flowingcode/vaadin/testbench/rpc/ViewInitializerImpl.java index 34da7f9..276b87f 100644 --- a/src/test/java/com/flowingcode/vaadin/testbench/rpc/ViewInitializerImpl.java +++ b/src/test/java/com/flowingcode/vaadin/testbench/rpc/ViewInitializerImpl.java @@ -23,6 +23,7 @@ import com.flowingcode.vaadin.testbench.rpc.integration.IntegrationView; import com.flowingcode.vaadin.testbench.rpc.integration.IntegrationViewRmi; import com.flowingcode.vaadin.testbench.rpc.integration.RmiIntegrationView; +import com.flowingcode.vaadin.testbench.rpc.integration.VersionView; import com.vaadin.flow.server.ServiceInitEvent; @SuppressWarnings("serial") @@ -33,6 +34,7 @@ public void serviceInit(ServiceInitEvent event) { registerInstrumentedRoute(IntegrationView.class); registerInstrumentedRoute(IntegrationViewRmi.class); registerInstrumentedRoute(RmiIntegrationView.class); + registerInstrumentedRoute(VersionView.class); } } diff --git a/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionView.java b/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionView.java new file mode 100644 index 0000000..2c5cedf --- /dev/null +++ b/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionView.java @@ -0,0 +1,66 @@ +/*- + * #%L + * RPC for Vaadin TestBench + * %% + * Copyright (C) 2021 - 2025 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.testbench.rpc.integration; + +import com.flowingcode.vaadin.jsonmigration.InstrumentedRoute; +import com.flowingcode.vaadin.jsonmigration.LegacyClientCallable; +import com.flowingcode.vaadin.testbench.rpc.Version; +import com.vaadin.flow.component.html.Div; +import elemental.json.JsonObject; +import elemental.json.JsonValue; + +@SuppressWarnings("serial") +@InstrumentedRoute(VersionView.ROUTE) +public class VersionView extends Div implements VersionViewCallables { + + public static final String ROUTE = "it/version"; + + @Override + @LegacyClientCallable + public JsonValue $call(JsonObject invocation) { + return VersionViewCallables.super.$call(invocation); + } + + @Override + public Version getVersion() { + return new Version(); + } + + @Override + public String getFullVersion() { + return com.vaadin.flow.server.Version.getFullVersion(); + } + + @Override + public int getMajorVersion() { + return com.vaadin.flow.server.Version.getMajorVersion(); + } + + @Override + public int getMinorVersion() { + return com.vaadin.flow.server.Version.getMinorVersion(); + } + + @Override + public int getRevision() { + return com.vaadin.flow.server.Version.getRevision(); + } + +} diff --git a/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewCallables.java b/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewCallables.java new file mode 100644 index 0000000..a873115 --- /dev/null +++ b/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewCallables.java @@ -0,0 +1,37 @@ +/*- + * #%L + * RPC for Vaadin TestBench + * %% + * Copyright (C) 2021 - 2025 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.testbench.rpc.integration; + +import com.flowingcode.vaadin.testbench.rpc.RmiCallable; +import com.flowingcode.vaadin.testbench.rpc.Version; + +public interface VersionViewCallables extends RmiCallable { + + Version getVersion(); + + String getFullVersion(); + + int getMajorVersion(); + + int getMinorVersion(); + + int getRevision(); + +} diff --git a/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewIT.java b/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewIT.java new file mode 100644 index 0000000..3605f19 --- /dev/null +++ b/src/test/java/com/flowingcode/vaadin/testbench/rpc/integration/VersionViewIT.java @@ -0,0 +1,58 @@ +/*- + * #%L + * RPC for Vaadin TestBench + * %% + * Copyright (C) 2021 - 2025 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.testbench.rpc.integration; + +import static org.junit.Assert.assertEquals; +import com.flowingcode.vaadin.testbench.rpc.AbstractViewTest; +import com.flowingcode.vaadin.testbench.rpc.HasRpcSupport; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class VersionViewIT extends AbstractViewTest implements HasRpcSupport { + + public VersionViewIT() { + super(VersionView.ROUTE); + } + + VersionViewCallables $server = createCallableProxy(VersionViewCallables.class); + + @Test + public void test_getFullVersion() { + assertEquals($server.getFullVersion(), $server.getVersion().getFullVersion()); + } + + @Test + public void test_getMajorVersion() { + assertEquals($server.getMajorVersion(), $server.getVersion().getMajorVersion()); + } + + @Test + public void test_getMinorVersion() { + assertEquals($server.getMinorVersion(), $server.getVersion().getMinorVersion()); + } + + @Test + public void test_getRevision() { + assertEquals($server.getRevision(), $server.getVersion().getRevision()); + } +}