diff --git a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java index e272341bd..ce30c39bb 100644 --- a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java +++ b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java @@ -47,10 +47,10 @@ @DisabledIfSystemProperty(named = "profile.id", matches = "native", disabledReason = "Only for JVM verification") public class QuarkusCliCreateJvmApplicationIT { - static final String RESTEASY_EXTENSION = "quarkus-resteasy"; + static final String RESTEASY_REACTIVE_EXTENSION = "quarkus-resteasy-reactive"; static final String SMALLRYE_HEALTH_EXTENSION = "quarkus-smallrye-health"; static final String SPRING_WEB_EXTENSION = "quarkus-spring-web"; - static final String RESTEASY_JACKSON_EXTENSION = "quarkus-resteasy-jackson"; + static final String RESTEASY_REACTIVE_JACKSON_EXTENSION = "quarkus-resteasy-reactive-jackson"; static final String ROOT_FOLDER = ""; static final String DOCKER_FOLDER = "/src/main/docker"; static final String JDK_11 = "11"; @@ -78,7 +78,6 @@ public void shouldCreateApplicationOnJvm() { @Tag("QUARKUS-1472") @Test - @Disabled("https://github.com/quarkusio/quarkus/issues/24613") public void createAppShouldAutoDetectJavaVersion() { QuarkusCliRestService app = cliClient.createApplication("app", defaultWithFixedStream()); assertExpectedJavaVersion(getFileFromApplication(app, ROOT_FOLDER, "pom.xml"), getSystemJavaVersion()); @@ -152,12 +151,13 @@ public void shouldCreateApplicationOnJvmFromMultipleBoms() { final String kogitoExtension = "kogito-quarkus-rules"; final String prettytimeExtension = "quarkus-prettytime"; QuarkusCliRestService app = cliClient.createApplication("app", defaultWithFixedStream().withExtensions(kogitoExtension, - prettytimeExtension, RESTEASY_EXTENSION, RESTEASY_JACKSON_EXTENSION)); + prettytimeExtension, RESTEASY_REACTIVE_EXTENSION, RESTEASY_REACTIVE_JACKSON_EXTENSION)); // Should build on Jvm Result result = app.buildOnJvm(); assertTrue(result.isSuccessful(), "The application didn't build on JVM. Output: " + result.getOutput()); - assertInstalledExtensions(app, kogitoExtension, prettytimeExtension, RESTEASY_EXTENSION, RESTEASY_JACKSON_EXTENSION); + assertInstalledExtensions(app, kogitoExtension, prettytimeExtension, RESTEASY_REACTIVE_EXTENSION, + RESTEASY_REACTIVE_JACKSON_EXTENSION); } @Tag("QUARKUS-1071") @@ -165,10 +165,10 @@ public void shouldCreateApplicationOnJvmFromMultipleBoms() { public void shouldCreateApplicationWithCodeStarter() { // Create application with Resteasy Jackson + Spring Web (we need both for the app to run) QuarkusCliRestService app = cliClient.createApplication("app", - defaultWithFixedStream().withExtensions(RESTEASY_JACKSON_EXTENSION, SPRING_WEB_EXTENSION)); + defaultWithFixedStream().withExtensions(RESTEASY_REACTIVE_JACKSON_EXTENSION, SPRING_WEB_EXTENSION)); - // Verify By default, it installs only "quarkus-resteasy-jackson" and "quarkus-spring-web" - assertInstalledExtensions(app, RESTEASY_JACKSON_EXTENSION, SPRING_WEB_EXTENSION); + // Verify By default, it installs only "quarkus-resteasy-reactive-jackson" and "quarkus-spring-web" + assertInstalledExtensions(app, RESTEASY_REACTIVE_JACKSON_EXTENSION, SPRING_WEB_EXTENSION); // Start using DEV mode app.start(); @@ -183,14 +183,14 @@ public void shouldAddAndRemoveExtensions() { QuarkusCliRestService app = cliClient.createApplication("app", defaults().withPlatformBom(gav)); // By default, it installs only "quarkus-resteasy" - assertInstalledExtensions(app, RESTEASY_EXTENSION); + assertInstalledExtensions(app, RESTEASY_REACTIVE_EXTENSION); // Let's install Quarkus SmallRye Health Result result = app.installExtension(SMALLRYE_HEALTH_EXTENSION); assertTrue(result.isSuccessful(), SMALLRYE_HEALTH_EXTENSION + " was not installed. Output: " + result.getOutput()); // Verify both extensions now - assertInstalledExtensions(app, RESTEASY_EXTENSION, SMALLRYE_HEALTH_EXTENSION); + assertInstalledExtensions(app, RESTEASY_REACTIVE_EXTENSION, SMALLRYE_HEALTH_EXTENSION); // The health endpoint should be now available app.start(); @@ -210,7 +210,7 @@ public void shouldAddAndRemoveExtensions() { @Test public void shouldCreateJacocoReportsFromApplicationOnJvm() { QuarkusCliRestService app = cliClient.createApplication("app-with-jacoco", - defaultWithFixedStream().withExtensions("jacoco")); + defaultWithFixedStream().withExtensions("resteasy", "jacoco")); Result result = app.buildOnJvm(); assertTrue(result.isSuccessful(), "The application didn't build on JVM. Output: " + result.getOutput()); diff --git a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliExtensionsIT.java b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliExtensionsIT.java index 864f4835e..ec2fd6363 100644 --- a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliExtensionsIT.java +++ b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliExtensionsIT.java @@ -1,6 +1,7 @@ package io.quarkus.ts.quarkus.cli; import static io.quarkus.ts.quarkus.cli.QuarkusCliUtils.getCurrentStreamVersion; +import static io.quarkus.ts.quarkus.cli.QuarkusCliUtils.isUpstream; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; @@ -44,31 +45,39 @@ public class QuarkusCliExtensionsIT { @Test public void shouldListExtensionsUsingDefaults() { - whenGetListExtensions("--stream", getCurrentStreamVersion()); + whenGetListExtensions(getDefaultAppArgs().toArray(new String[0])); assertListDefaultOptionOutput(); } @Test public void shouldListExtensionsUsingName() { - whenGetListExtensions("--stream", getCurrentStreamVersion(), "--name"); + List args = getDefaultAppArgs(); + args.add("--name"); + whenGetListExtensions(args.toArray(new String[0])); assertListNameOptionOutput(); } @Test public void shouldListExtensionsUsingOrigins() { - whenGetListExtensions("--stream", getCurrentStreamVersion(), "--origins"); + List args = getDefaultAppArgs(); + args.add("--origins"); + whenGetListExtensions(args.toArray(new String[0])); assertListOriginsOptionOutput(); } @Test public void shouldListExtensionsUsingConcise() { - whenGetListExtensions("--stream", getCurrentStreamVersion(), "--concise"); + List args = getDefaultAppArgs(); + args.add("--concise"); + whenGetListExtensions(args.toArray(new String[0])); assertListConciseOptionOutput(); } @Test public void shouldListExtensionsUsingFull() { - whenGetListExtensions("--stream", getCurrentStreamVersion(), "--full"); + List args = getDefaultAppArgs(); + args.add("--full"); + whenGetListExtensions(args.toArray(new String[0])); assertListFullOptionOutput(); } @@ -103,7 +112,9 @@ public void shouldListExtensionsUsingStream() { @Test public void shouldListExtensionsUsingInstallable() { - whenGetListExtensions("--stream", getCurrentStreamVersion(), "--installable"); + List args = getDefaultAppArgs(); + args.add("--installable"); + whenGetListExtensions(args.toArray(new String[0])); assertListDefaultOptionOutput(); } @@ -158,4 +169,14 @@ private void assertListFullOptionOutput() { private void assertResultIsSuccessful() { assertTrue(result.isSuccessful(), "Extensions list command didn't work. Output: " + result.getOutput()); } -} \ No newline at end of file + + private List getDefaultAppArgs() { + String version = getCurrentStreamVersion(); + List args = new ArrayList<>(); + if (!isUpstream(version)) { + args.addAll(Arrays.asList("--stream", version)); + } + + return args; + } +} diff --git a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliSpecialCharsIT.java b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliSpecialCharsIT.java index 10a095b8a..a7062bf2a 100644 --- a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliSpecialCharsIT.java +++ b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliSpecialCharsIT.java @@ -1,9 +1,13 @@ package io.quarkus.ts.quarkus.cli; import static io.quarkus.ts.quarkus.cli.QuarkusCliUtils.getCurrentStreamVersion; +import static io.quarkus.ts.quarkus.cli.QuarkusCliUtils.isUpstream; import static org.junit.jupiter.api.Assertions.assertTrue; import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import javax.inject.Inject; @@ -131,8 +135,9 @@ private void whenBuildOnJvmAppAt(String folder) { } private void whenCreateAppAt(String folder) { - result = cliClient.run("create", "app", "--stream", getCurrentStreamVersion(), "--output-directory=" + folder, - ARTIFACT_ID); + List args = getDefaultAppArgs("create", "app"); + args.addAll(List.of("--output-directory=" + folder, ARTIFACT_ID)); + result = cliClient.run(args.toArray(new String[args.size()])); } private void thenResultIsSuccessful() { @@ -148,4 +153,15 @@ private void deleteFolder(String folder) { FileUtils.deletePath(TARGET.resolve(folder)); } + private List getDefaultAppArgs(String... defaultArgs) { + String version = getCurrentStreamVersion(); + List args = new ArrayList<>(); + args.addAll(List.of(defaultArgs)); + if (!isUpstream(version)) { + args.addAll(Arrays.asList("--stream", version)); + } + + return args; + } + } diff --git a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliUtils.java b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliUtils.java index 036167bc6..357d3edbb 100644 --- a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliUtils.java +++ b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliUtils.java @@ -4,21 +4,47 @@ import java.util.regex.Pattern; +import org.jboss.logging.Logger; + import io.quarkus.builder.Version; import io.quarkus.test.bootstrap.QuarkusCliClient; public class QuarkusCliUtils { + public static final String QUARKUS_UPSTREAM_VERSION = "999-SNAPSHOT"; + private static final Logger LOG = Logger.getLogger(QuarkusCliUtils.class); + public static QuarkusCliClient.CreateApplicationRequest defaultWithFixedStream() { - return defaults().withStream(getCurrentStreamVersion()); + String version = getCurrentStreamVersion(); + if (isUpstream(version)) { + LOG.warn("fixed streams are not supported on upstream"); + return defaults(); + } + + return defaults().withStream(version); } public static QuarkusCliClient.CreateExtensionRequest defaultNewExtensionArgsWithFixedStream() { - return QuarkusCliClient.CreateExtensionRequest.defaults().withStream(getCurrentStreamVersion()); + String version = getCurrentStreamVersion(); + if (isUpstream(version)) { + LOG.warn("fixed streams are not supported on upstream"); + return QuarkusCliClient.CreateExtensionRequest.defaults(); + } + + return QuarkusCliClient.CreateExtensionRequest.defaults().withStream(version); + } + + public static boolean isUpstream(String version) { + return version.equalsIgnoreCase(QUARKUS_UPSTREAM_VERSION); } public static String getCurrentStreamVersion() { - String[] version = Version.getVersion().split(Pattern.quote(".")); + String rawVersion = Version.getVersion(); + if (QUARKUS_UPSTREAM_VERSION.equalsIgnoreCase(rawVersion)) { + return QUARKUS_UPSTREAM_VERSION; + } + + String[] version = rawVersion.split(Pattern.quote(".")); return String.format("%s.%s", version[0], version[1]); } }