From 6d121e4c924676e2a49769e8498f2a5813d97dfe Mon Sep 17 00:00:00 2001 From: Bryan Varner <1652015+bvarner@users.noreply.github.com> Date: Thu, 3 Jun 2021 12:41:09 -0400 Subject: [PATCH] Adds argLine to instrument Integration Tests * Fix #7536 by adding the ability to specify an argLine property when running tests. For Example, in a project I'm building: ``` maven-failsafe-plugin ${surefire-plugin.version} integration-test verify org.jboss.logmanager.LogManager ${maven.home} it ${argLine} ``` --- .../src/main/java/io/quarkus/test/common/JarLauncher.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/JarLauncher.java b/test-framework/common/src/main/java/io/quarkus/test/common/JarLauncher.java index 28ab29b542d47..2e606355c2a8a 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/JarLauncher.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/JarLauncher.java @@ -26,6 +26,7 @@ public class JarLauncher implements ArtifactLauncher { private final Path jarPath; private final String profile; + private final String argLine; private Process quarkusProcess; private final int httpPort; private final int httpsPort; @@ -39,6 +40,7 @@ private JarLauncher(Path jarPath, Config config) { config.getValue("quarkus.http.test-port", OptionalInt.class).orElse(DEFAULT_PORT), config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT), config.getValue("quarkus.test.jar-wait-time", OptionalLong.class).orElse(DEFAULT_JAR_WAIT_TIME), + config.getOptionalValue("quarkus.test.argLine", String.class).orElse(null), config.getOptionalValue("quarkus.test.native-image-profile", String.class) .orElse(null)); } @@ -47,11 +49,12 @@ public JarLauncher(Path jarPath) { this(jarPath, installAndGetSomeConfig()); } - public JarLauncher(Path jarPath, int httpPort, int httpsPort, long jarWaitTime, String profile) { + public JarLauncher(Path jarPath, int httpPort, int httpsPort, long jarWaitTime, String argLine, String profile) { this.jarPath = jarPath; this.httpPort = httpPort; this.httpsPort = httpsPort; this.jarWaitTime = jarWaitTime; + this.argLine = argLine; this.profile = profile; } @@ -61,6 +64,9 @@ public void start() throws IOException { List args = new ArrayList<>(); args.add("java"); + if (argLine != null) { + args.add(argLine); + } args.add("-Dquarkus.http.port=" + httpPort); args.add("-Dquarkus.http.ssl-port=" + httpsPort); // this won't be correct when using the random port but it's really only used by us for the rest client tests