diff --git a/devtools/project-core-extension-codestarts/pom.xml b/devtools/project-core-extension-codestarts/pom.xml index 788cb54e75182..d5e1f30f4d239 100644 --- a/devtools/project-core-extension-codestarts/pom.xml +++ b/devtools/project-core-extension-codestarts/pom.xml @@ -17,13 +17,6 @@ ${project.basedir}/../gradle gradlew - - - io.quarkus - quarkus-devtools-testing - test - - diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_java_ilove_quark_us_config_ConfigResource.java b/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_java_ilove_quark_us_config_ConfigResource.java deleted file mode 100644 index 9134cd531ab03..0000000000000 --- a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_java_ilove_quark_us_config_ConfigResource.java +++ /dev/null @@ -1,41 +0,0 @@ -package ilove.quark.us.config; - -import org.eclipse.microprofile.config.inject.ConfigProperty; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.math.BigDecimal; -import java.util.Optional; - -@Path("/config") -public class ConfigResource { - - @ConfigProperty(name = "constant.speed-of-sound-in-meter-per-second", defaultValue = "343") - int speedOfSound; - - @ConfigProperty(name = "display.mach") - Optional displayMach; - - @ConfigProperty(name = "display.unit.name") - String displayUnitName; - - @ConfigProperty(name = "display.unit.factor") - BigDecimal displayUnitFactor; - - @GET - @Path("supersonic") - @Produces(MediaType.TEXT_PLAIN) - public String supersonic() { - final int mach = displayMach.orElse(1); - final BigDecimal speed = BigDecimal.valueOf(speedOfSound) - .multiply(displayUnitFactor) - .multiply(BigDecimal.valueOf(mach)); - return String.format("Mach %d is %.3f %s", - mach, - speed, - displayUnitName - ); - } -} diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_kotlin_ilove_quark_us_config_ConfigResource.kt b/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_kotlin_ilove_quark_us_config_ConfigResource.kt deleted file mode 100644 index 046d4ecb94345..0000000000000 --- a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_kotlin_ilove_quark_us_config_ConfigResource.kt +++ /dev/null @@ -1,39 +0,0 @@ -package ilove.quark.us.config - -import org.eclipse.microprofile.config.inject.ConfigProperty -import java.math.BigDecimal -import java.util.* -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.Produces -import javax.ws.rs.core.MediaType - -@Path("/config") -class ConfigResource { - @ConfigProperty(name = "constant.speed-of-sound-in-meter-per-second", defaultValue = "343") - var speedOfSound = 0 - - @ConfigProperty(name = "display.mach") - lateinit var displayMach: Optional - - @ConfigProperty(name = "display.unit.name") - lateinit var displayUnitName: String - - @ConfigProperty(name = "display.unit.factor") - lateinit var displayUnitFactor: BigDecimal - - @GET - @Path("supersonic") - @Produces(MediaType.TEXT_PLAIN) - fun supersonic(): String { - val mach = displayMach.orElse(1) - val speed = BigDecimal.valueOf(speedOfSound.toLong()) - .multiply(displayUnitFactor) - .multiply(BigDecimal.valueOf(mach.toLong())) - return String.format("Mach %d is %.3f %s", - mach, - speed, - displayUnitName - ) - } -} diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_picocli_EntryCommand.java b/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_picocli_EntryCommand.java deleted file mode 100644 index fc8bc63461200..0000000000000 --- a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_picocli_EntryCommand.java +++ /dev/null @@ -1,9 +0,0 @@ -package ilove.quark.us.picocli; - -import io.quarkus.picocli.runtime.annotations.TopCommand; -import picocli.CommandLine; - -@TopCommand -@CommandLine.Command(mixinStandardHelpOptions = true, subcommands = { HelloCommand.class, GoodbyeCommand.class }) -public class EntryCommand { -} diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_picocli_GoodbyeCommand.java b/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_picocli_GoodbyeCommand.java deleted file mode 100644 index 1cef24670bf4b..0000000000000 --- a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_picocli_GoodbyeCommand.java +++ /dev/null @@ -1,21 +0,0 @@ -package ilove.quark.us.picocli; - -import picocli.CommandLine.Command; -import picocli.CommandLine.Option; - -@Command(name = "goodbye") -public class GoodbyeCommand implements Runnable { - - @Option(names = {"--name"}, description = "Guest name") - String name; - - @Option(names = {"--times", "-t"}, defaultValue = "1", description = "How many time should we say goodbye") - int times; - - @Override - public void run() { - for (int i = 0;i quarks = Collections.synchronizedList(new ArrayList<>()); - - @Inject - Template page; - - public QuteResource() { - for (int i = 0; i < 3; i++) { - this.addQuark(); - } - } - - @GET - @Produces(MediaType.TEXT_HTML) - public TemplateInstance get() { - return page.data("quarks", new ArrayList<>(quarks)); - } - - @POST - @Path("add") - public void addQuark() { - final Random random = new Random(); - final Quark.Flavor flavor = Quark.Flavor.values()[random.nextInt(Quark.Flavor.values().length)]; - final Quark.Color color = Quark.Color.values()[random.nextInt(Quark.Color.values().length)]; - quarks.add(new Quark(flavor, color)); - } - - /** - * This template extension method implements the "position" computed property. - */ - @TemplateExtension - static int position(Quark quark) { - return new Random().nextInt(100); - } - -} diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_SomePage.kt b/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_SomePage.kt deleted file mode 100644 index 367550a571035..0000000000000 --- a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_SomePage.kt +++ /dev/null @@ -1,23 +0,0 @@ -package ilove.quark.us - -import io.quarkus.qute.Template -import io.quarkus.qute.TemplateInstance -import javax.inject.Inject -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.Produces -import javax.ws.rs.QueryParam -import javax.ws.rs.core.MediaType - -@Path("/some-page") -class SomePage { - - @Inject - lateinit var page: Template - - @GET - @Produces(MediaType.TEXT_HTML) - operator fun get(@QueryParam("name") name: String?): TemplateInstance { - return page.data("name", name) - } -} \ No newline at end of file diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_resteasyqute_Quark.kt b/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_resteasyqute_Quark.kt deleted file mode 100644 index a292aeba294cb..0000000000000 --- a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_resteasyqute_Quark.kt +++ /dev/null @@ -1,11 +0,0 @@ -package ilove.quark.us.resteasyqute - -class Quark(val flavor: Flavor, val color: Color) { - enum class Flavor { - DOWN, UP, STRANGE, CHARM, BOTTOM, TOP - } - - enum class Color(val hex: String) { - RED("#ff6961"), GREEN("#77dd77"), BLUE("#aec6cf"); - } -} diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_resteasyqute_QuteResource.kt b/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_resteasyqute_QuteResource.kt deleted file mode 100644 index 2b49e82833d86..0000000000000 --- a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_resteasyqute_QuteResource.kt +++ /dev/null @@ -1,54 +0,0 @@ -package ilove.quark.us.resteasyqute - -import io.quarkus.qute.Template -import io.quarkus.qute.TemplateExtension -import io.quarkus.qute.TemplateInstance -import java.util.* -import javax.inject.Inject -import javax.ws.rs.GET -import javax.ws.rs.POST -import javax.ws.rs.Path -import javax.ws.rs.Produces -import javax.ws.rs.core.MediaType - -@Path("/qute/quarks") -class QuteResource { - private val quarks = Collections.synchronizedList(ArrayList()) - - init { - for (i in 0..2) { - addQuark() - } - } - - @Inject - lateinit var page: Template - - @GET - @Produces(MediaType.TEXT_HTML) - fun get(): TemplateInstance { - return page.data("quarks", ArrayList(quarks)) - } - - @POST - @Path("add") - fun addQuark() { - val random = Random() - val flavor = Quark.Flavor.values()[random.nextInt(Quark.Flavor.values().size)] - val color = Quark.Color.values()[random.nextInt(Quark.Color.values().size)] - quarks.add(Quark(flavor, color)) - } - - @TemplateExtension - class QuarkExtension { - companion object { - /** - * This template extension method implements the "position" computed property. - */ - @JvmStatic - fun position(quark: Quark): Int { - return Random().nextInt(100) - } - } - } -} diff --git a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartData.java b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartData.java index 3af957579dfed..1936afe2f28d2 100644 --- a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartData.java +++ b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartData.java @@ -34,11 +34,11 @@ public static Optional getBuildtool(final Map data) { public static Map buildCodestartData(final Codestart codestart, final String languageName, final Map data) { final Optional> value = NestedMaps.getValue(data, codestart.getName()); - Map codestartData = new HashMap<>(); - codestartData.putAll(data); - NestedMaps.deepMerge(codestartData, codestart.getLocalData(languageName)); - value.ifPresent(map -> NestedMaps.deepMerge(codestartData, map)); - return codestartData; + Map withLocalCodestartData = NestedMaps.deepMerge(data, codestart.getLocalData(languageName)); + if (!value.isPresent()) { + return withLocalCodestartData; + } + return NestedMaps.deepMerge(withLocalCodestartData, value.get()); } public static Map buildCodestartProjectData(Collection baseCodestarts, diff --git a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/SmartConfigMergeCodestartFileStrategyHandler.java b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/SmartConfigMergeCodestartFileStrategyHandler.java index ddcff3407db85..432b7d207aa01 100644 --- a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/SmartConfigMergeCodestartFileStrategyHandler.java +++ b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/SmartConfigMergeCodestartFileStrategyHandler.java @@ -36,8 +36,8 @@ public void process(Path targetDirectory, String relativePath, List for (TargetFile codestartFile : codestartFiles) { final String content = codestartFile.getContent(); if (!content.trim().isEmpty()) { - final Map o = YAML_MAPPER.readerFor(Map.class).readValue(content); - NestedMaps.deepMerge(config, o); + final Map o = YAML_MAPPER.readerFor(Map.class).readValue(content); + config.putAll(NestedMaps.deepMerge(config, o)); } } final Path targetPath = targetDirectory.resolve(relativePath); diff --git a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/utils/NestedMaps.java b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/utils/NestedMaps.java index 535ed649dc1af..042fe93b2c248 100644 --- a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/utils/NestedMaps.java +++ b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/utils/NestedMaps.java @@ -29,18 +29,25 @@ public static Optional getValue(Map data, String path) { public static Map deepMerge(final Stream> mapStream) { final Map out = new HashMap<>(); - mapStream.forEach(m -> deepMerge(out, m)); + mapStream.forEach(m -> internalDeepMerge(out, m)); + return out; + } + + public static Map deepMerge(final Map left, final Map right) { + final Map out = new HashMap<>(); + internalDeepMerge(out, left); + internalDeepMerge(out, right); return out; } @SuppressWarnings({ "rawtypes", "unchecked" }) - public static void deepMerge(Map left, Map right) { + private static void internalDeepMerge(Map left, Map right) { for (Object key : right.keySet()) { Object rightValue = right.get(key); Object leftValue = left.get(key); if (rightValue instanceof Map && leftValue instanceof Map) { - deepMerge((Map) leftValue, (Map) rightValue); + internalDeepMerge((Map) leftValue, (Map) rightValue); } else if (rightValue instanceof Collection && leftValue instanceof Collection) { Collection c = new LinkedHashSet(); c.addAll((Collection) leftValue); @@ -48,7 +55,7 @@ public static void deepMerge(Map left, Map right) { left.put(key, c); } else if (rightValue instanceof Map) { final Map map = new HashMap(); - deepMerge(map, (Map) rightValue); + internalDeepMerge(map, (Map) rightValue); left.put(key, map); } else if (rightValue instanceof Collection) { left.put(key, new LinkedHashSet((Collection) rightValue)); @@ -57,11 +64,13 @@ public static void deepMerge(Map left, Map right) { || rightValue instanceof Float || rightValue instanceof Long || rightValue instanceof Double - || rightValue instanceof String) { + || rightValue instanceof String + || rightValue == null) { // Override left.put(key, rightValue); + } else { + throw new IllegalArgumentException("Invalid value type for deepMerge: " + rightValue.getClass()); } - // else ignore } } diff --git a/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/utils/NestedMapsTest.java b/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/utils/NestedMapsTest.java index 55b6a977ddb0e..e5c8a970b2830 100644 --- a/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/utils/NestedMapsTest.java +++ b/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/utils/NestedMapsTest.java @@ -9,6 +9,7 @@ import java.io.UncheckedIOException; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -23,12 +24,12 @@ class NestedMapsTest { @Test void testDeepMerge() { - final HashMap target = new HashMap<>(); - - NestedMaps.deepMerge(target, NESTED_MAP_1); - NestedMaps.deepMerge(target, NESTED_MAP_2); + final Map target = NestedMaps.deepMerge(NESTED_MAP_1, NESTED_MAP_2); checkTargetMap(target); + ((Map) target.get("hello")).put("world", "changed"); + final Map targetAgain = NestedMaps.deepMerge(NESTED_MAP_1, NESTED_MAP_2); + checkTargetMap(targetAgain); } @Test @@ -67,7 +68,7 @@ private void checkTargetMap(Map target) { assertThat(NestedMaps.getValue(target, "bar.foo.bar.foo")).hasValue("bar"); assertThat(NestedMaps.getValue(target, "bar.foo.bar.baz")).hasValue("foo"); - assertThat(NestedMaps.getValue(target, "hello")).hasValue("world"); + assertThat(NestedMaps.getValue(target, "hello.world")).hasValue("helloworld"); assertThat((Collection) NestedMaps.getValue(target, "list").get()).containsExactly("foo", "bar", "baz"); } @@ -82,7 +83,7 @@ void testUnflatten() { data.put("baz", "bar"); data.put("bar.foo.bar.foo", "bar"); data.put("bar.foo.bar.baz", "foo"); - data.put("hello", "world"); + data.put("hello", Collections.singletonMap("world", "helloworld")); data.put("list", Arrays.asList("foo", "bar", "baz")); final Map target = NestedMaps.unflatten(data); diff --git a/independent-projects/tools/codestarts/src/test/resources/nested-map-2.yml b/independent-projects/tools/codestarts/src/test/resources/nested-map-2.yml index 5e00644f49c21..77ba8a322ff92 100644 --- a/independent-projects/tools/codestarts/src/test/resources/nested-map-2.yml +++ b/independent-projects/tools/codestarts/src/test/resources/nested-map-2.yml @@ -8,6 +8,6 @@ bar: foo: bar baz: foo hello: - world + world: helloworld list: - baz diff --git a/independent-projects/tools/devtools-testing/src/test/resources/fake-catalog.json b/independent-projects/tools/devtools-testing/src/test/resources/fake-catalog.json index 801fd9dea3fae..46076e7052458 100644 --- a/independent-projects/tools/devtools-testing/src/test/resources/fake-catalog.json +++ b/independent-projects/tools/devtools-testing/src/test/resources/fake-catalog.json @@ -1,7 +1,7 @@ { - "id": "io.quarkus:quarkus-bom-quarkus-platform-descriptor:999-SNAPSHOT:json:999-SNAPSHOT", + "id": "io.quarkus:quarkus-fake-bom:999-FAKE:json:999-FAKE", "platform": true, - "bom": "io.quarkus:quarkus-bom::pom:999-SNAPSHOT", + "bom": "io.quarkus:quarkus-bom::pom:999-FAKE", "derived-from": [], "extensions": [ { @@ -26,13 +26,13 @@ "kotlin", "scala" ], - "artifact": "io.quarkus:quarkus-descriptor-json" + "artifact": "io.quarkus:fake-artifact" }, - "built-with-quarkus-core": "999-SNAPSHOT" + "built-with-quarkus-core": "999-FAKE" }, - "artifact": "io.quarkus:quarkus-resteasy-reactive::jar:999-SNAPSHOT", + "artifact": "io.quarkus:quarkus-resteasy-reactive::jar:999-FAKE", "origins": [ - "io.quarkus:quarkus-bom-quarkus-platform-descriptor:999-SNAPSHOT:json:999-SNAPSHOT" + "io.quarkus:quarkus-fake-bom:999-FAKE:json:999-FAKE" ] }, { @@ -56,13 +56,13 @@ "java", "kotlin" ], - "artifact": "io.quarkus:quarkus-descriptor-json" + "artifact": "io.quarkus:fake-artifact" }, - "built-with-quarkus-core": "999-SNAPSHOT" + "built-with-quarkus-core": "999-FAKE" }, - "artifact": "io.quarkus:quarkus-config-yaml::jar:999-SNAPSHOT", + "artifact": "io.quarkus:quarkus-config-yaml::jar:999-FAKE", "origins": [ - "io.quarkus:quarkus-bom-quarkus-platform-descriptor:999-SNAPSHOT:json:999-SNAPSHOT" + "io.quarkus:quarkus-fake-bom:999-FAKE:json:999-FAKE" ] }, { @@ -88,13 +88,13 @@ "kotlin", "scala" ], - "artifact": "io.quarkus:quarkus-descriptor-json" + "artifact": "io.quarkus:fake-artifact" }, - "built-with-quarkus-core": "999-SNAPSHOT" + "built-with-quarkus-core": "999-FAKE" }, - "artifact": "io.quarkus:quarkus-resteasy::jar:999-SNAPSHOT", + "artifact": "io.quarkus:quarkus-resteasy::jar:999-FAKE", "origins": [ - "io.quarkus:quarkus-bom-quarkus-platform-descriptor:999-SNAPSHOT:json:999-SNAPSHOT" + "io.quarkus:quarkus-fake-bom:999-FAKE:json:999-FAKE" ] }, { @@ -117,13 +117,13 @@ "kotlin", "scala" ], - "artifact": "io.quarkus:quarkus-descriptor-json" + "artifact": "io.quarkus:fake-artifact" }, - "built-with-quarkus-core": "999-SNAPSHOT" + "built-with-quarkus-core": "999-FAKE" }, - "artifact": "io.quarkus:quarkus-spring-web::jar:999-SNAPSHOT", + "artifact": "io.quarkus:quarkus-spring-web::jar:999-FAKE", "origins": [ - "io.quarkus:quarkus-bom-quarkus-platform-descriptor:999-SNAPSHOT:json:999-SNAPSHOT" + "io.quarkus:quarkus-fake-bom:999-FAKE:json:999-FAKE" ] }, { @@ -141,13 +141,13 @@ "codestart": { "name": "kotlin", "kind": "core", - "artifact": "io.quarkus:quarkus-descriptor-json" + "artifact": "io.quarkus:fake-artifact" }, - "built-with-quarkus-core": "999-SNAPSHOT" + "built-with-quarkus-core": "999-FAKE" }, - "artifact": "io.quarkus:quarkus-kotlin::jar:999-SNAPSHOT", + "artifact": "io.quarkus:quarkus-kotlin::jar:999-FAKE", "origins": [ - "io.quarkus:quarkus-bom-quarkus-platform-descriptor:999-SNAPSHOT:json:999-SNAPSHOT" + "io.quarkus:quarkus-fake-bom:999-FAKE:json:999-FAKE" ] }, { @@ -164,13 +164,13 @@ "codestart": { "name": "scala", "kind": "core", - "artifact": "io.quarkus:quarkus-descriptor-json" + "artifact": "io.quarkus:fake-artifact" }, - "built-with-quarkus-core": "999-SNAPSHOT" + "built-with-quarkus-core": "999-FAKE" }, - "artifact": "io.quarkus:quarkus-scala::jar:999-SNAPSHOT", + "artifact": "io.quarkus:quarkus-scala::jar:999-FAKE", "origins": [ - "io.quarkus:quarkus-bom-quarkus-platform-descriptor:999-SNAPSHOT:json:999-SNAPSHOT" + "io.quarkus:quarkus-fake-bom:999-FAKE:json:999-FAKE" ] } ], @@ -305,12 +305,12 @@ "kotlin-version": "1.4.31", "scala-version": "2.12.13", "scala-plugin-version": "4.4.0", - "quarkus-core-version": "999-SNAPSHOT", + "quarkus-core-version": "999-FAKE", "maven-plugin-groupId": "io.quarkus", "maven-plugin-artifactId": "quarkus-maven-plugin", - "maven-plugin-version": "999-SNAPSHOT", + "maven-plugin-version": "999-FAKE", "gradle-plugin-id": "io.quarkus", - "gradle-plugin-version": "999-SNAPSHOT", + "gradle-plugin-version": "999-FAKE", "supported-maven-versions": "[3.6.2,)", "proposed-maven-version": "3.6.3", "maven-wrapper-version": "0.7.7", @@ -318,8 +318,8 @@ } }, "codestarts-artifacts": [ - "io.quarkus:quarkus-platform-descriptor-json::jar:999-SNAPSHOT" + "io.quarkus:fake-artifact::jar:999-FAKE" ] }, - "quarkus-core-version": "999-SNAPSHOT" + "quarkus-core-version": "999-FAKE" } \ No newline at end of file diff --git a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/ConfigYamlCodestartTest.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/ConfigYamlCodestartTest.java similarity index 77% rename from devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/ConfigYamlCodestartTest.java rename to integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/ConfigYamlCodestartTest.java index d6952d49e6aca..1551f86c9dc55 100644 --- a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/ConfigYamlCodestartTest.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/ConfigYamlCodestartTest.java @@ -4,6 +4,7 @@ import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.KOTLIN; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; @@ -20,7 +21,12 @@ public class ConfigYamlCodestartTest { void testContent() throws Throwable { codestartTest.checkGeneratedSource("org.acme.GreetingConfig"); codestartTest.assertThatGeneratedFileMatchSnapshot(JAVA, "src/main/resources/application.yml"); - //codestartTest.buildAllProjects(); + } + + @Test + @EnabledIfSystemProperty(named = "build-projects", matches = "true") + void buildAllProjectsForLocalUse() throws Throwable { + codestartTest.buildAllProjects(); } } diff --git a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/FunqyHttpCodestartTest.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/FunqyHttpCodestartTest.java similarity index 76% rename from devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/FunqyHttpCodestartTest.java rename to integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/FunqyHttpCodestartTest.java index 52e192c2c83b1..e160321462d42 100644 --- a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/FunqyHttpCodestartTest.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/FunqyHttpCodestartTest.java @@ -3,6 +3,7 @@ import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.JAVA; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; @@ -20,7 +21,12 @@ void testContent() throws Throwable { codestartTest.checkGeneratedSource("org.acme.MyFunctions"); codestartTest.checkGeneratedTestSource("org.acme.MyFunctionsTest"); codestartTest.checkGeneratedTestSource("org.acme.MyFunctionsIT"); - //codestartTest.buildAllProjects(); + } + + @Test + @EnabledIfSystemProperty(named = "build-projects", matches = "true") + void buildAllProjectsForLocalUse() throws Throwable { + codestartTest.buildAllProjects(); } } diff --git a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/PicocliCodestartTest.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/PicocliCodestartTest.java similarity index 85% rename from devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/PicocliCodestartTest.java rename to integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/PicocliCodestartTest.java index f331290d8260f..607617de02e8d 100644 --- a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/PicocliCodestartTest.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/PicocliCodestartTest.java @@ -5,6 +5,7 @@ import static io.quarkus.devtools.testing.SnapshotTesting.checkContains; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.devtools.project.BuildTool; @@ -34,7 +35,11 @@ void testContent() throws Throwable { codestartGradleTest.assertThatGeneratedFile(JAVA, "README.md") .satisfies(checkContains("./gradlew quarkusDev --quarkus-args='Quarky'")); + } - //codestartTest.buildAllProjects(); + @Test + @EnabledIfSystemProperty(named = "build-projects", matches = "true") + void buildAllProjectsForLocalUse() throws Throwable { + codestartTest.buildAllProjects(); } } diff --git a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/RESTEasyQuteCodestartTest.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/RESTEasyQuteCodestartTest.java similarity index 77% rename from devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/RESTEasyQuteCodestartTest.java rename to integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/RESTEasyQuteCodestartTest.java index 5fa10cfe06324..f8e2fb686db8e 100644 --- a/devtools/project-core-extension-codestarts/src/test/java/io/quarkus/devtools/codestarts/quarkus/RESTEasyQuteCodestartTest.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/RESTEasyQuteCodestartTest.java @@ -4,6 +4,7 @@ import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.KOTLIN; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; @@ -20,6 +21,11 @@ public class RESTEasyQuteCodestartTest { void testContent() throws Throwable { codestartTest.checkGeneratedSource("org.acme.SomePage"); codestartTest.assertThatGeneratedFileMatchSnapshot(JAVA, "src/main/resources/templates/page.qute.html"); - //codestartTest.buildAllProjects(); + } + + @Test + @EnabledIfSystemProperty(named = "build-projects", matches = "true") + void buildAllProjectsForLocalUse() throws Throwable { + codestartTest.buildAllProjects(); } } diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingConfig.java b/integration-tests/devtools/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingConfig.java similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingConfig.java rename to integration-tests/devtools/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingConfig.java diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingConfig.kt b/integration-tests/devtools/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingConfig.kt similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingConfig.kt rename to integration-tests/devtools/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingConfig.kt diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_resources_application.yml b/integration-tests/devtools/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_resources_application.yml similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_resources_application.yml rename to integration-tests/devtools/src/test/resources/__snapshots__/ConfigYamlCodestartTest/testContent/src_main_resources_application.yml diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_main_java_ilove_quark_us_MyFunctions.java b/integration-tests/devtools/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_main_java_ilove_quark_us_MyFunctions.java similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_main_java_ilove_quark_us_MyFunctions.java rename to integration-tests/devtools/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_main_java_ilove_quark_us_MyFunctions.java diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsIT.java b/integration-tests/devtools/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsIT.java similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsIT.java rename to integration-tests/devtools/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsIT.java diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsTest.java b/integration-tests/devtools/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsTest.java similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsTest.java rename to integration-tests/devtools/src/test/resources/__snapshots__/FunqyHttpCodestartTest/testContent/src_test_java_ilove_quark_us_MyFunctionsTest.java diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingCommand.java b/integration-tests/devtools/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingCommand.java similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingCommand.java rename to integration-tests/devtools/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_java_ilove_quark_us_GreetingCommand.java diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingCommand.kt b/integration-tests/devtools/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingCommand.kt similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingCommand.kt rename to integration-tests/devtools/src/test/resources/__snapshots__/PicocliCodestartTest/testContent/src_main_kotlin_ilove_quark_us_GreetingCommand.kt diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_java_ilove_quark_us_SomePage.java b/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_java_ilove_quark_us_SomePage.java index 67c59b69d8e42..b38e25e600637 100644 --- a/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_java_ilove_quark_us_SomePage.java +++ b/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_java_ilove_quark_us_SomePage.java @@ -7,18 +7,19 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; @Path("/some-page") public class SomePage { @Inject - Template somePage; + Template page; @GET @Produces(MediaType.TEXT_HTML) - public TemplateInstance get(String name) { - return somePage.data("name", name); + public TemplateInstance get(@QueryParam("name") String name) { + return page.data("name", name); } } diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_SomePage.kt b/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_SomePage.kt index 088fe55771cf5..367550a571035 100644 --- a/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_SomePage.kt +++ b/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_kotlin_ilove_quark_us_SomePage.kt @@ -6,17 +6,18 @@ import javax.inject.Inject import javax.ws.rs.GET import javax.ws.rs.Path import javax.ws.rs.Produces +import javax.ws.rs.QueryParam import javax.ws.rs.core.MediaType @Path("/some-page") class SomePage { @Inject - lateinit var somePage: Template + lateinit var page: Template @GET @Produces(MediaType.TEXT_HTML) - operator fun get(name: String?): TemplateInstance { - return somePage.data("name", name) + operator fun get(@QueryParam("name") name: String?): TemplateInstance { + return page.data("name", name) } } \ No newline at end of file diff --git a/devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_resources_templates_page.qute.html b/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_resources_templates_page.qute.html similarity index 100% rename from devtools/project-core-extension-codestarts/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_resources_templates_page.qute.html rename to integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_resources_templates_page.qute.html diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_resources_templates_some-page.qute.html b/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_resources_templates_some-page.qute.html deleted file mode 100644 index 46c12a74b617c..0000000000000 --- a/integration-tests/devtools/src/test/resources/__snapshots__/RESTEasyQuteCodestartTest/testContent/src_main_resources_templates_some-page.qute.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Hello {name ?: Qute} - - - -

Hello {name ?: Qute}

- -

Create your web page using Quarkus RESTEasy & Qute

- -