Fix vaadin14 latest dep test (#7893)
Looks similar to what we had for vaadin 16 recently. Pinning https://www.npmjs.com/package/@types/node to 18.11.9
This commit is contained in:
parent
7e187f78e7
commit
fe263edecf
|
@ -5,6 +5,58 @@
|
|||
|
||||
package test.io.opentelemetry.javaagent.instrumentation.vaadin;
|
||||
|
||||
import io.opentelemetry.javaagent.instrumentation.vaadin.AbstractVaadin14Test;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
||||
public class Vaadin14LatestTest extends AbstractVaadin14Test {}
|
||||
import io.opentelemetry.javaagent.instrumentation.vaadin.AbstractVaadin14Test;
|
||||
import java.io.File;
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.net.URISyntaxException;
|
||||
import net.bytebuddy.agent.ByteBuddyAgent;
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class Vaadin14LatestTest extends AbstractVaadin14Test {
|
||||
|
||||
static class UpdatePackageAdvice {
|
||||
@Advice.OnMethodEnter(skipOn = Advice.OnDefaultValue.class)
|
||||
public static Object onEnter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedVariable")
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(@Advice.Return(readOnly = false) boolean result) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
@Override
|
||||
protected void setup() throws URISyntaxException {
|
||||
// Prevent vaadin from regenerating package.json & pnpm-lock.yaml
|
||||
// Vaadin adds a hash to package.json that includes path to node_modules directory, so it won't
|
||||
// be same on all computers. To avoid vaadin replacing our provided package.json we suppress the
|
||||
// package.json modification check.
|
||||
Instrumentation instrumentation = ByteBuddyAgent.install();
|
||||
new AgentBuilder.Default()
|
||||
.type(named("com.vaadin.flow.server.frontend.TaskUpdatePackages"))
|
||||
.transform(
|
||||
new AgentBuilder.Transformer.ForAdvice()
|
||||
.advice(
|
||||
named("updatePackageJsonDependencies"), UpdatePackageAdvice.class.getName()))
|
||||
.installOn(instrumentation);
|
||||
|
||||
super.setup();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("checkstyle:SystemOut")
|
||||
protected void prepareVaadinBaseDir(File baseDir) {
|
||||
copyResource("/pnpm/package.json", baseDir);
|
||||
copyResource("/pnpm/pnpm-lock.yaml", baseDir);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
{
|
||||
"name": "no-name",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@polymer/iron-icon": "3.0.1",
|
||||
"@polymer/iron-list": "3.1.0",
|
||||
"@polymer/polymer": "3.2.0",
|
||||
"@vaadin/vaadin-accordion": "1.2.0",
|
||||
"@vaadin/vaadin-app-layout": "2.2.0",
|
||||
"@vaadin/vaadin-avatar": "1.0.4",
|
||||
"@vaadin/vaadin-button": "2.4.0",
|
||||
"@vaadin/vaadin-checkbox": "2.5.1",
|
||||
"@vaadin/vaadin-combo-box": "5.4.12",
|
||||
"@vaadin/vaadin-context-menu": "4.6.0",
|
||||
"@vaadin/vaadin-core-shrinkwrap": "14.9.6",
|
||||
"@vaadin/vaadin-custom-field": "1.3.1",
|
||||
"@vaadin/vaadin-date-picker": "4.4.5",
|
||||
"@vaadin/vaadin-date-time-picker": "1.4.0",
|
||||
"@vaadin/vaadin-details": "1.2.1",
|
||||
"@vaadin/vaadin-dialog": "2.6.0",
|
||||
"@vaadin/vaadin-form-layout": "2.3.0",
|
||||
"@vaadin/vaadin-grid": "5.9.7",
|
||||
"@vaadin/vaadin-icons": "4.3.2",
|
||||
"@vaadin/vaadin-item": "2.3.0",
|
||||
"@vaadin/vaadin-list-box": "1.4.0",
|
||||
"@vaadin/vaadin-login": "1.2.0",
|
||||
"@vaadin/vaadin-lumo-styles": "1.6.1",
|
||||
"@vaadin/vaadin-material-styles": "1.3.2",
|
||||
"@vaadin/vaadin-menu-bar": "1.3.0",
|
||||
"@vaadin/vaadin-messages": "1.0.2",
|
||||
"@vaadin/vaadin-notification": "1.6.2",
|
||||
"@vaadin/vaadin-ordered-layout": "1.4.0",
|
||||
"@vaadin/vaadin-progress-bar": "1.3.0",
|
||||
"@vaadin/vaadin-radio-button": "1.5.4",
|
||||
"@vaadin/vaadin-select": "2.4.4",
|
||||
"@vaadin/vaadin-split-layout": "4.3.1",
|
||||
"@vaadin/vaadin-tabs": "3.2.0",
|
||||
"@vaadin/vaadin-text-field": "2.9.2",
|
||||
"@vaadin/vaadin-time-picker": "2.4.0",
|
||||
"@vaadin/vaadin-upload": "4.4.3",
|
||||
"@webcomponents/webcomponentsjs": "^2.2.10",
|
||||
"construct-style-sheets-polyfill": "3.0.4",
|
||||
"lit-element": "2.5.1",
|
||||
"lit-html": "1.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-loader": "8.2.2",
|
||||
"chokidar": "^3.5.0",
|
||||
"compression-webpack-plugin": "4.0.1",
|
||||
"copy-webpack-plugin": "5.1.2",
|
||||
"css-loader": "5.2.7",
|
||||
"extra-watch-webpack-plugin": "1.0.3",
|
||||
"extract-loader": "5.1.0",
|
||||
"file-loader": "6.1.0",
|
||||
"html-webpack-plugin": "4.5.2",
|
||||
"lit-css-loader": "0.0.4",
|
||||
"loader-utils": "2.0.4",
|
||||
"raw-loader": "3.1.0",
|
||||
"ts-loader": "8.0.12",
|
||||
"typescript": "4.0.3",
|
||||
"webpack": "4.42.0",
|
||||
"webpack-babel-multi-target-plugin": "2.5.0",
|
||||
"webpack-cli": "3.3.11",
|
||||
"webpack-dev-server": "3.11.0",
|
||||
"webpack-merge": "4.2.2"
|
||||
},
|
||||
"vaadin": {
|
||||
"dependencies": {
|
||||
"@polymer/iron-icon": "3.0.1",
|
||||
"@polymer/iron-list": "3.1.0",
|
||||
"@polymer/polymer": "3.2.0",
|
||||
"@vaadin/vaadin-accordion": "1.2.0",
|
||||
"@vaadin/vaadin-app-layout": "2.2.0",
|
||||
"@vaadin/vaadin-avatar": "1.0.4",
|
||||
"@vaadin/vaadin-button": "2.4.0",
|
||||
"@vaadin/vaadin-checkbox": "2.5.1",
|
||||
"@vaadin/vaadin-combo-box": "5.4.12",
|
||||
"@vaadin/vaadin-context-menu": "4.6.0",
|
||||
"@vaadin/vaadin-core-shrinkwrap": "14.9.6",
|
||||
"@vaadin/vaadin-custom-field": "1.3.1",
|
||||
"@vaadin/vaadin-date-picker": "4.4.5",
|
||||
"@vaadin/vaadin-date-time-picker": "1.4.0",
|
||||
"@vaadin/vaadin-details": "1.2.1",
|
||||
"@vaadin/vaadin-dialog": "2.6.0",
|
||||
"@vaadin/vaadin-form-layout": "2.3.0",
|
||||
"@vaadin/vaadin-grid": "5.9.7",
|
||||
"@vaadin/vaadin-icons": "4.3.2",
|
||||
"@vaadin/vaadin-item": "2.3.0",
|
||||
"@vaadin/vaadin-list-box": "1.4.0",
|
||||
"@vaadin/vaadin-login": "1.2.0",
|
||||
"@vaadin/vaadin-lumo-styles": "1.6.1",
|
||||
"@vaadin/vaadin-material-styles": "1.3.2",
|
||||
"@vaadin/vaadin-menu-bar": "1.3.0",
|
||||
"@vaadin/vaadin-messages": "1.0.2",
|
||||
"@vaadin/vaadin-notification": "1.6.2",
|
||||
"@vaadin/vaadin-ordered-layout": "1.4.0",
|
||||
"@vaadin/vaadin-progress-bar": "1.3.0",
|
||||
"@vaadin/vaadin-radio-button": "1.5.4",
|
||||
"@vaadin/vaadin-select": "2.4.4",
|
||||
"@vaadin/vaadin-split-layout": "4.3.1",
|
||||
"@vaadin/vaadin-tabs": "3.2.0",
|
||||
"@vaadin/vaadin-text-field": "2.9.2",
|
||||
"@vaadin/vaadin-time-picker": "2.4.0",
|
||||
"@vaadin/vaadin-upload": "4.4.3",
|
||||
"@webcomponents/webcomponentsjs": "^2.2.10",
|
||||
"construct-style-sheets-polyfill": "3.0.4",
|
||||
"lit-element": "2.5.1",
|
||||
"lit-html": "1.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-loader": "8.2.2",
|
||||
"chokidar": "^3.5.0",
|
||||
"compression-webpack-plugin": "4.0.1",
|
||||
"copy-webpack-plugin": "5.1.2",
|
||||
"css-loader": "5.2.7",
|
||||
"extra-watch-webpack-plugin": "1.0.3",
|
||||
"extract-loader": "5.1.0",
|
||||
"file-loader": "6.1.0",
|
||||
"html-webpack-plugin": "4.5.2",
|
||||
"lit-css-loader": "0.0.4",
|
||||
"loader-utils": "2.0.4",
|
||||
"raw-loader": "3.1.0",
|
||||
"ts-loader": "8.0.12",
|
||||
"typescript": "4.0.3",
|
||||
"webpack": "4.42.0",
|
||||
"webpack-babel-multi-target-plugin": "2.5.0",
|
||||
"webpack-cli": "3.3.11",
|
||||
"webpack-dev-server": "3.11.0",
|
||||
"webpack-merge": "4.2.2"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -6,48 +6,12 @@
|
|||
package io.opentelemetry.javaagent.instrumentation.vaadin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Vaadin16Test extends AbstractVaadin16Test {
|
||||
|
||||
@Override
|
||||
protected void prepareVaadinBaseDir(File baseDir) {
|
||||
URL lockFile = AbstractVaadin16Test.class.getResource("/pnpm-lock.yaml");
|
||||
if (lockFile == null) {
|
||||
return;
|
||||
}
|
||||
URI uri;
|
||||
try {
|
||||
uri = lockFile.toURI();
|
||||
} catch (URISyntaxException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
Path sourceDirectory = Paths.get(uri).getParent();
|
||||
String sourcePath = sourceDirectory.toString();
|
||||
Path destinationDirectory = Paths.get(baseDir.toURI());
|
||||
String destinationPath = destinationDirectory.toString();
|
||||
try (Stream<Path> stream = Files.walk(sourceDirectory)) {
|
||||
stream.forEach(
|
||||
source -> {
|
||||
Path destination =
|
||||
Paths.get(destinationPath, source.toString().substring(sourcePath.length()));
|
||||
if (!Files.exists(destination)) {
|
||||
try {
|
||||
Files.copy(source, destination);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
copyResource("/pnpm/package.json", baseDir);
|
||||
copyResource("/pnpm/pnpm-lock.yaml", baseDir);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,13 @@ import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumenta
|
|||
import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -65,7 +70,7 @@ public abstract class AbstractVaadinTest
|
|||
}
|
||||
|
||||
@BeforeAll
|
||||
void setup() throws URISyntaxException {
|
||||
protected void setup() throws URISyntaxException {
|
||||
startServer();
|
||||
|
||||
Testcontainers.exposeHostPorts(port);
|
||||
|
@ -89,9 +94,23 @@ public abstract class AbstractVaadinTest
|
|||
|
||||
protected void prepareVaadinBaseDir(File baseDir) {}
|
||||
|
||||
protected static void copyResource(String resource, File destinationDirectory) {
|
||||
int lastSlash = resource.lastIndexOf('/');
|
||||
String fileName = lastSlash == -1 ? resource : resource.substring(lastSlash + 1);
|
||||
Path destination = Paths.get(destinationDirectory.toURI()).resolve(fileName);
|
||||
if (!Files.exists(destination)) {
|
||||
try (InputStream inputStream = AbstractVaadinTest.class.getResourceAsStream(resource)) {
|
||||
Files.copy(inputStream, destination);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ConfigurableApplicationContext setupServer() {
|
||||
File baseDir = new File("build/vaadin-" + Version.getFullVersion());
|
||||
baseDir.mkdirs();
|
||||
prepareVaadinBaseDir(baseDir);
|
||||
|
||||
// set directory for files generated by vaadin development mode
|
||||
|
|
Loading…
Reference in New Issue