diff --git a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java index dbad8fcf35023..c95fd94facda4 100644 --- a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java @@ -16,7 +16,6 @@ import io.quarkus.devtools.PlatformAwareTestBase; import io.quarkus.devtools.testing.SnapshotTesting; -import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor; class QuarkusJBangCodestartGenerationTest extends PlatformAwareTestBase { @@ -29,25 +28,24 @@ static void setUp() throws IOException { @Test void generateDefaultProject(TestInfo testInfo) throws Throwable { - final QuarkusPlatformDescriptor platformDescriptor = getPlatformDescriptor(); final QuarkusJBangCodestartProjectInput input = QuarkusJBangCodestartProjectInput.builder() - .putData(QUARKUS_BOM_GROUP_ID, platformDescriptor.getBomGroupId()) - .putData(QUARKUS_BOM_ARTIFACT_ID, platformDescriptor.getBomArtifactId()) - .putData(QUARKUS_BOM_VERSION, platformDescriptor.getBomVersion()) + .putData(QUARKUS_BOM_GROUP_ID, "io.quarkus") + .putData(QUARKUS_BOM_ARTIFACT_ID, "quarkus-bom") + .putData(QUARKUS_BOM_VERSION, "999-SNAPSHOT") .build(); final Path projectDir = testDirPath.resolve("default"); getCatalog().createProject(input).generate(projectDir); assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir); + assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingResource.java"); } @Test void generatePicocliProject(TestInfo testInfo) throws Throwable { - final QuarkusPlatformDescriptor platformDescriptor = getPlatformDescriptor(); final QuarkusJBangCodestartProjectInput input = QuarkusJBangCodestartProjectInput.builder() .addCodestart("jbang-picocli-code") - .putData(QUARKUS_BOM_GROUP_ID, platformDescriptor.getBomGroupId()) - .putData(QUARKUS_BOM_ARTIFACT_ID, platformDescriptor.getBomArtifactId()) - .putData(QUARKUS_BOM_VERSION, platformDescriptor.getBomVersion()) + .putData(QUARKUS_BOM_GROUP_ID, "io.quarkus") + .putData(QUARKUS_BOM_ARTIFACT_ID, "quarkus-bom") + .putData(QUARKUS_BOM_VERSION, "999-SNAPSHOT") .build(); final Path projectDir = testDirPath.resolve("picocli"); getCatalog().createProject(input).generate(projectDir); diff --git a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java index 22963341a9e0b..0cfc2ab9dfa7e 100644 --- a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java @@ -3,7 +3,6 @@ import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartData.QuarkusDataKey.*; import static io.quarkus.devtools.testing.SnapshotTesting.assertThatMatchSnapshot; import static io.quarkus.devtools.testing.SnapshotTesting.checkContains; -import static io.quarkus.platform.tools.ToolsUtils.readQuarkusProperties; import static org.assertj.core.api.Assertions.assertThat; import java.nio.file.Path; @@ -11,7 +10,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import java.util.Properties; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -22,9 +20,6 @@ import io.quarkus.devtools.PlatformAwareTestBase; import io.quarkus.devtools.project.BuildTool; import io.quarkus.devtools.testing.SnapshotTesting; -import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor; -import io.quarkus.platform.tools.ToolsConstants; -import io.quarkus.platform.tools.ToolsUtils; class QuarkusCodestartGenerationTest extends PlatformAwareTestBase { @@ -35,36 +30,30 @@ static void setUp() throws Throwable { SnapshotTesting.deleteTestDirectory(testDirPath.toFile()); } - private Map getTestInputData() { - return getTestInputData(null); + private Map getGenerationTestInputData() { + return getGenerationTestInputData(null); } - private Map getTestInputData(final Map override) { - return QuarkusCodestartGenerationTest.getTestInputData(getPlatformDescriptor(), override); - } - - static Map getTestInputData(final QuarkusPlatformDescriptor descriptor, - final Map override) { + private static Map getGenerationTestInputData(final Map override) { final HashMap data = new HashMap<>(); - final Properties quarkusProp = readQuarkusProperties(descriptor); data.put(PROJECT_GROUP_ID.key(), "org.test"); data.put(PROJECT_ARTIFACT_ID.key(), "test-codestart"); data.put(PROJECT_VERSION.key(), "1.0.0-codestart"); - data.put(BOM_GROUP_ID.key(), descriptor.getBomGroupId()); - data.put(BOM_ARTIFACT_ID.key(), descriptor.getBomArtifactId()); - data.put(BOM_VERSION.key(), descriptor.getBomVersion()); - data.put(QUARKUS_VERSION.key(), descriptor.getQuarkusVersion()); - data.put(QUARKUS_MAVEN_PLUGIN_GROUP_ID.key(), ToolsUtils.getMavenPluginGroupId(quarkusProp)); - data.put(QUARKUS_MAVEN_PLUGIN_ARTIFACT_ID.key(), ToolsUtils.getMavenPluginArtifactId(quarkusProp)); - data.put(QUARKUS_MAVEN_PLUGIN_VERSION.key(), ToolsUtils.getMavenPluginVersion(quarkusProp)); - data.put(QUARKUS_GRADLE_PLUGIN_ID.key(), ToolsUtils.getMavenPluginGroupId(quarkusProp)); - data.put(QUARKUS_GRADLE_PLUGIN_VERSION.key(), ToolsUtils.getGradlePluginVersion(quarkusProp)); + data.put(BOM_GROUP_ID.key(), "io.quarkus"); + data.put(BOM_ARTIFACT_ID.key(), "quarkus-bom"); + data.put(BOM_VERSION.key(), "999-SNAPSHOT"); + data.put(QUARKUS_VERSION.key(), "999-SNAPSHOT"); + data.put(QUARKUS_MAVEN_PLUGIN_GROUP_ID.key(), "io.quarkus"); + data.put(QUARKUS_MAVEN_PLUGIN_ARTIFACT_ID.key(), "quarkus-maven-plugin"); + data.put(QUARKUS_MAVEN_PLUGIN_VERSION.key(), "999-SNAPSHOT"); + data.put(QUARKUS_GRADLE_PLUGIN_ID.key(), "io.quarkus"); + data.put(QUARKUS_GRADLE_PLUGIN_VERSION.key(), "999-SNAPSHOT"); data.put(JAVA_VERSION.key(), "11"); - data.put(KOTLIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_KOTLIN_VERSION)); - data.put(SCALA_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_SCALA_VERSION)); - data.put(SCALA_MAVEN_PLUGIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_SCALA_PLUGIN_VERSION)); - data.put(MAVEN_COMPILER_PLUGIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_COMPILER_PLUGIN_VERSION)); - data.put(MAVEN_SUREFIRE_PLUGIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_SUREFIRE_PLUGIN_VERSION)); + data.put(KOTLIN_VERSION.key(), "1.4.28"); + data.put(SCALA_VERSION.key(), "2.12.8"); + data.put(SCALA_MAVEN_PLUGIN_VERSION.key(), "4.1.1"); + data.put(MAVEN_COMPILER_PLUGIN_VERSION.key(), "3.8.1"); + data.put(MAVEN_SUREFIRE_PLUGIN_VERSION.key(), "3.0.0-M5"); if (override != null) data.putAll(override); return data; @@ -76,7 +65,7 @@ void generateDefault(TestInfo testInfo) throws Throwable { .noExamples() .noDockerfiles() .noBuildToolWrapper() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("default"); getCatalog().createProject(input).generate(projectDir); @@ -97,7 +86,7 @@ void generateDefault(TestInfo testInfo) throws Throwable { void generateCommandMode(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addCodestart("commandmode") - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("commandmode"); @@ -115,7 +104,7 @@ void generateCommandMode(TestInfo testInfo) throws Throwable { void generateCommandModeCustom(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addCodestart("commandmode") - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .putData(PROJECT_PACKAGE_NAME.key(), "com.test.andy") .putData(COMMANDMODE_EXAMPLE_RESOURCE_CLASS_NAME.key(), "AndyCommando") .build(); @@ -133,7 +122,7 @@ void generateCommandModeCustom(TestInfo testInfo) throws Throwable { @Test void generateRESTEasyJavaCustom(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .putData(PROJECT_PACKAGE_NAME.key(), "com.andy") .putData(RESTEASY_EXAMPLE_RESOURCE_CLASS_NAME.key(), "BonjourResource") @@ -155,7 +144,7 @@ void generateRESTEasyJavaCustom(TestInfo testInfo) throws Throwable { @Test void generateRESTEasySpringWeb(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-spring-web")) .build(); @@ -188,7 +177,7 @@ void generateRESTEasySpringWeb(TestInfo testInfo) throws Throwable { @Test void generateMavenWithCustomDep(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactCoords.fromString("commons-io:commons-io:2.5")) @@ -212,7 +201,7 @@ void generateMavenWithCustomDep(TestInfo testInfo) throws Throwable { @Test void generateRESTEasyKotlinCustom(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-kotlin")) .putData(PROJECT_PACKAGE_NAME.key(), "com.andy") @@ -245,7 +234,7 @@ void generateRESTEasyKotlinCustom(TestInfo testInfo) throws Throwable { @Test void generateRESTEasyScalaCustom(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-scala")) .putData(PROJECT_PACKAGE_NAME.key(), "com.andy") @@ -278,7 +267,7 @@ void generateRESTEasyScalaCustom(TestInfo testInfo) throws Throwable { @Test void generateMavenDefaultJava(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-default-java"); getCatalog().createProject(input).generate(projectDir); @@ -297,7 +286,7 @@ void generateMavenDefaultJava(TestInfo testInfo) throws Throwable { void generateMavenResteasyJava(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-resteasy-java"); getCatalog().createProject(input).generate(projectDir); @@ -316,7 +305,7 @@ void generateMavenResteasyJava(TestInfo testInfo) throws Throwable { void generateMavenPicocliJava(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-picocli")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-picocli-java"); getCatalog().createProject(input).generate(projectDir); @@ -337,7 +326,7 @@ void generateMavenPicocliKotlin(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-picocli")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-kotlin")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-picocli-kotlin"); getCatalog().createProject(input).generate(projectDir); @@ -357,7 +346,7 @@ void generateMavenPicocliKotlin(TestInfo testInfo) throws Throwable { void generateMavenConfigYamlJava(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-config-yaml")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-yaml-java"); getCatalog().createProject(input).generate(projectDir); @@ -375,7 +364,7 @@ void generateMavenResteasyKotlin(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-kotlin")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-resteasy-kotlin"); getCatalog().createProject(input).generate(projectDir); @@ -395,7 +384,7 @@ void generateMavenResteasyScala(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-scala")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-resteasy-scala"); getCatalog().createProject(input).generate(projectDir); @@ -416,7 +405,7 @@ void generateGradleResteasyJava(TestInfo testInfo) throws Throwable { .buildTool(BuildTool.GRADLE) .addCodestart("gradle") .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("gradle-resteasy-java"); getCatalog().createProject(input).generate(projectDir); @@ -438,7 +427,7 @@ void generateGradleResteasyKotlin(TestInfo testInfo) throws Throwable { .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-kotlin")) .addCodestart("gradle") - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("gradle-resteasy-kotlin"); getCatalog().createProject(input).generate(projectDir); @@ -459,7 +448,7 @@ void generateGradleResteasyScala(TestInfo testInfo) throws Throwable { .buildTool(BuildTool.GRADLE) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-scala")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("gradle-resteasy-scala"); getCatalog().createProject(input).generate(projectDir); @@ -479,7 +468,7 @@ void generateGradleWithKotlinDslResteasyJava(TestInfo testInfo) throws Throwable final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .buildTool(BuildTool.GRADLE_KOTLIN_DSL) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("gradle-kotlin-dsl-resteasy-java"); getCatalog().createProject(input).generate(projectDir); @@ -498,7 +487,7 @@ void generateGradleWithKotlinDslResteasyKotlin(TestInfo testInfo) throws Throwab .buildTool(BuildTool.GRADLE_KOTLIN_DSL) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-kotlin")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("gradle-kotlin-dsl-resteasy-kotlin"); getCatalog().createProject(input).generate(projectDir); @@ -517,7 +506,7 @@ void generateGradleWithKotlinDslResteasyScala(TestInfo testInfo) throws Throwabl .buildTool(BuildTool.GRADLE_KOTLIN_DSL) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-resteasy")) .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-scala")) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("gradle-kotlin-dsl-resteasy-scala"); getCatalog().createProject(input).generate(projectDir); @@ -535,7 +524,7 @@ void generateQute(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addExtension(AppArtifactKey.fromString("io.quarkus:quarkus-qute")) .addCodestart("qute") - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("maven-qute"); getCatalog().createProject(input).generate(projectDir); @@ -554,7 +543,7 @@ void generateWithCustomPackage(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .addCodestart("qute").addCodestart("resteasy").addCodestart("funqy-http") .putData(PROJECT_PACKAGE_NAME.key(), "my.custom.app") - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .build(); final Path projectDir = testDirPath.resolve("custom-package"); getCatalog().createProject(input).generate(projectDir); @@ -584,7 +573,7 @@ void generateWithCustomPackage(TestInfo testInfo) throws Throwable { public void generateGradleWrapperGithubAction(TestInfo testInfo) throws Throwable { final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .buildTool(BuildTool.GRADLE) - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .addCodestarts(Collections.singletonList("github-action")) .build(); Path projectDir = testDirPath.resolve("gradle-github"); @@ -601,7 +590,7 @@ public void generateGradleNoWrapperGithubAction(TestInfo testInfo) throws Throwa final QuarkusCodestartProjectInput input = QuarkusCodestartProjectInput.builder() .buildTool(BuildTool.GRADLE) .noBuildToolWrapper() - .addData(getTestInputData()) + .addData(getGenerationTestInputData()) .addCodestarts(Collections.singletonList("github-action")) .build(); Path projectDir = testDirPath.resolve("gradle-nowrapper-github"); diff --git a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartRunIT.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartRunIT.java index 54db777cab568..8257ceb70a1df 100644 --- a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartRunIT.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartRunIT.java @@ -1,5 +1,7 @@ package io.quarkus.devtools.codestarts.quarkus; +import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartData.QuarkusDataKey.*; +import static io.quarkus.platform.tools.ToolsUtils.readQuarkusProperties; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; @@ -10,6 +12,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; @@ -32,6 +35,9 @@ import io.quarkus.devtools.project.BuildTool; import io.quarkus.devtools.testing.SnapshotTesting; import io.quarkus.devtools.testing.WrapperRunner; +import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor; +import io.quarkus.platform.tools.ToolsConstants; +import io.quarkus.platform.tools.ToolsUtils; @TestInstance(TestInstance.Lifecycle.PER_CLASS) class QuarkusCodestartRunIT extends PlatformAwareTestBase { @@ -48,14 +54,6 @@ static void setUp() throws IOException { SnapshotTesting.deleteTestDirectory(testDirPath.toFile()); } - private Map getTestInputData() { - return getTestInputData(null); - } - - private Map getTestInputData(final Map override) { - return QuarkusCodestartGenerationTest.getTestInputData(getPlatformDescriptor(), override); - } - @Test public void testRunTogetherCodestartsJava() throws Exception { generateProjectRunTests("maven", "java", getRunTogetherExamples(), Collections.emptyMap()); @@ -164,7 +162,6 @@ private void generateProjectRunTests(String buildToolName, String language, List .addCodestarts(codestarts) .addCodestart(language) .addData(data) - .putData(QuarkusDataKey.JAVA_VERSION.key(), System.getProperty("java.specification.version")) .build(); final CodestartProjectDefinition projectDefinition = getCatalog().createProject(input); Path projectDir = testDirPath.resolve(name); @@ -175,6 +172,41 @@ private void generateProjectRunTests(String buildToolName, String language, List assertThat(result).isZero(); } + private Map getTestInputData() { + return getTestInputData(null); + } + + private Map getTestInputData(final Map override) { + return getTestInputData(getPlatformDescriptor(), override); + } + + private static Map getTestInputData(final QuarkusPlatformDescriptor descriptor, + final Map override) { + final HashMap data = new HashMap<>(); + final Properties quarkusProp = readQuarkusProperties(descriptor); + data.put(PROJECT_GROUP_ID.key(), "org.test"); + data.put(PROJECT_ARTIFACT_ID.key(), "test-codestart"); + data.put(PROJECT_VERSION.key(), "1.0.0-codestart"); + data.put(BOM_GROUP_ID.key(), descriptor.getBomGroupId()); + data.put(BOM_ARTIFACT_ID.key(), descriptor.getBomArtifactId()); + data.put(BOM_VERSION.key(), descriptor.getBomVersion()); + data.put(QUARKUS_VERSION.key(), descriptor.getQuarkusVersion()); + data.put(QUARKUS_MAVEN_PLUGIN_GROUP_ID.key(), ToolsUtils.getMavenPluginGroupId(quarkusProp)); + data.put(QUARKUS_MAVEN_PLUGIN_ARTIFACT_ID.key(), ToolsUtils.getMavenPluginArtifactId(quarkusProp)); + data.put(QUARKUS_MAVEN_PLUGIN_VERSION.key(), ToolsUtils.getMavenPluginVersion(quarkusProp)); + data.put(QUARKUS_GRADLE_PLUGIN_ID.key(), ToolsUtils.getMavenPluginGroupId(quarkusProp)); + data.put(QUARKUS_GRADLE_PLUGIN_VERSION.key(), ToolsUtils.getGradlePluginVersion(quarkusProp)); + data.put(JAVA_VERSION.key(), System.getProperty("java.specification.version")); + data.put(KOTLIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_KOTLIN_VERSION)); + data.put(SCALA_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_SCALA_VERSION)); + data.put(SCALA_MAVEN_PLUGIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_SCALA_PLUGIN_VERSION)); + data.put(MAVEN_COMPILER_PLUGIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_COMPILER_PLUGIN_VERSION)); + data.put(MAVEN_SUREFIRE_PLUGIN_VERSION.key(), quarkusProp.getProperty(ToolsConstants.PROP_SUREFIRE_PLUGIN_VERSION)); + if (override != null) + data.putAll(override); + return data; + } + private String genName(String buildtool, String language, List codestarts) { String name = "project-" + buildtool + "-" + language; if (codestarts.isEmpty()) { diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_GreetingResource.java b/integration-tests/devtools/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_GreetingResource.java new file mode 100644 index 0000000000000..c048f8dcb8a54 --- /dev/null +++ b/integration-tests/devtools/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_GreetingResource.java @@ -0,0 +1,24 @@ +//usr/bin/env jbang "$0" "$@" ; exit $? +//DEPS io.quarkus:quarkus-bom:999-SNAPSHOT@pom +//DEPS io.quarkus:quarkus-resteasy + +//JAVAC_OPTIONS -parameters + +import io.quarkus.runtime.Quarkus; +import javax.enterprise.context.ApplicationScoped; +import javax.ws.rs.GET; +import javax.ws.rs.Path; + +@Path("/hello-resteasy") +@ApplicationScoped +public class GreetingResource { + + @GET + public String sayHello() { + return "Hello RESTEasy"; + } + + public static void main(String[] args) { + Quarkus.run(args); + } +} \ No newline at end of file