Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.flowingcode.vaadin.test</groupId>
<artifactId>testbench-rpc</artifactId>
<version>1.4.1-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>
<name>TestBenchRPC</name>
<description>Remote procedure calls for Vaadin TestBench</description>
<url>https://www.flowingcode.com/en/open-source/</url>
Expand Down
56 changes: 56 additions & 0 deletions src/main/java/com/flowingcode/vaadin/testbench/rpc/Version.java
Original file line number Diff line number Diff line change
@@ -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();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -33,6 +34,7 @@ public void serviceInit(ServiceInitEvent event) {
registerInstrumentedRoute(IntegrationView.class);
registerInstrumentedRoute(IntegrationViewRmi.class);
registerInstrumentedRoute(RmiIntegrationView.class);
registerInstrumentedRoute(VersionView.class);
}

}
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -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();

}
Original file line number Diff line number Diff line change
@@ -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());
}
}