From 2f8cc9579bde4fd7a0b46788955f1cc43c239c4b Mon Sep 17 00:00:00 2001 From: Erin Schnabel Date: Tue, 1 Jun 2021 12:03:29 -0400 Subject: [PATCH] Use main.java for JBang projects --- .../src/test/java/io/quarkus/cli/CliProjectJBangTest.java | 2 +- .../quarkus-jbang/code/jbang-picocli-code/codestart.yml | 2 +- .../quarkus-jbang/code/jbang-resteasy-code/codestart.yml | 2 +- .../jbang/QuarkusJBangCodestartGenerationTest.java | 4 ++-- .../generateDefaultProject/dir-tree.snapshot | 2 +- .../{src_GreetingResource.java => src_main.java} | 2 +- .../generatePicocliProject/dir-tree.snapshot | 2 +- .../{src_GreetingCommand.java => src_main.java} | 2 +- .../quarkus/devtools/commands/CreateJBangProjectTest.java | 6 +++--- 9 files changed, 12 insertions(+), 12 deletions(-) rename independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/{src_GreetingResource.java => src_main.java} (93%) rename independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/{src_GreetingCommand.java => src_main.java} (94%) diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java index 683e40562fb0b..835b51b1b7d16 100644 --- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java +++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java @@ -106,6 +106,6 @@ Path valdiateJBangSourcePackage(Path project, String name) { Assertions.assertTrue(packagePath.toFile().isDirectory(), "Package directory should be a directory: " + packagePath.toAbsolutePath().toString()); - return packagePath.resolve("GreetingResource.java"); + return packagePath.resolve("main.java"); } } diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-picocli-code/codestart.yml b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-picocli-code/codestart.yml index 166616c962f27..75fb2f98f08d0 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-picocli-code/codestart.yml +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-picocli-code/codestart.yml @@ -5,7 +5,7 @@ language: base: data: command: - class-name: GreetingCommand + class-name: main name: Greeting dependencies: - io.quarkus:quarkus-picocli diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-resteasy-code/codestart.yml b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-resteasy-code/codestart.yml index dd495fc6e7c3d..43a04c5ae5995 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-resteasy-code/codestart.yml +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-jbang/code/jbang-resteasy-code/codestart.yml @@ -5,7 +5,7 @@ language: base: data: resource: - class-name: GreetingResource + class-name: main path: "/hello-resteasy" response: "Hello RESTEasy" dependencies: diff --git a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java index 24b0f63139bab..ee3ec9669f8aa 100644 --- a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java +++ b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/jbang/QuarkusJBangCodestartGenerationTest.java @@ -33,7 +33,7 @@ void generateDefaultProject(TestInfo testInfo) throws Throwable { final Path projectDir = testDirPath.resolve("default"); getCatalog().createProject(input).generate(projectDir); assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir); - assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingResource.java"); + assertThatMatchSnapshot(testInfo, projectDir, "src/main.java"); } @Test @@ -47,7 +47,7 @@ void generatePicocliProject(TestInfo testInfo) throws Throwable { final Path projectDir = testDirPath.resolve("picocli"); getCatalog().createProject(input).generate(projectDir); assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir); - assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingCommand.java"); + assertThatMatchSnapshot(testInfo, projectDir, "src/main.java"); } private QuarkusJBangCodestartCatalog getCatalog() throws IOException { diff --git a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/dir-tree.snapshot b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/dir-tree.snapshot index 55896a02385e8..6e585838bc453 100644 --- a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/dir-tree.snapshot +++ b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/dir-tree.snapshot @@ -4,4 +4,4 @@ README.md jbang jbang.cmd src/ -src/GreetingResource.java \ No newline at end of file +src/main.java \ No newline at end of file diff --git a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_GreetingResource.java b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_main.java similarity index 93% rename from independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_GreetingResource.java rename to independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_main.java index ac7ffd9f86f91..ca73154842dfd 100644 --- a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_GreetingResource.java +++ b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generateDefaultProject/src_main.java @@ -11,7 +11,7 @@ @Path("/hello-resteasy") @ApplicationScoped -public class GreetingResource { +public class main { @GET public String sayHello() { diff --git a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/dir-tree.snapshot b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/dir-tree.snapshot index 77e37b07d9164..6e585838bc453 100644 --- a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/dir-tree.snapshot +++ b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/dir-tree.snapshot @@ -4,4 +4,4 @@ README.md jbang jbang.cmd src/ -src/GreetingCommand.java \ No newline at end of file +src/main.java \ No newline at end of file diff --git a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/src_GreetingCommand.java b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/src_main.java similarity index 94% rename from independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/src_GreetingCommand.java rename to independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/src_main.java index c2f215e4d510f..04372dcffdd86 100644 --- a/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/src_GreetingCommand.java +++ b/independent-projects/tools/devtools-testing/src/test/resources/__snapshots__/QuarkusJBangCodestartGenerationTest/generatePicocliProject/src_main.java @@ -9,7 +9,7 @@ import picocli.CommandLine.Parameters; @Command(name = "Greeting", mixinStandardHelpOptions = true) -public class GreetingCommand { +public class main { @Parameters(paramLabel = "", defaultValue = "picocli", description = "Your name.") diff --git a/integration-tests/devtools/src/test/java/io/quarkus/devtools/commands/CreateJBangProjectTest.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/commands/CreateJBangProjectTest.java index 2ad00735d8211..009b594a48551 100644 --- a/integration-tests/devtools/src/test/java/io/quarkus/devtools/commands/CreateJBangProjectTest.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/commands/CreateJBangProjectTest.java @@ -29,7 +29,7 @@ public void createRESTEasy() throws Exception { assertThat(projectDir.resolve("jbang")).exists(); - assertThat(projectDir.resolve("src/GreetingResource.java")) + assertThat(projectDir.resolve("src/main.java")) .exists() .satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?")) .satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy")); @@ -45,7 +45,7 @@ public void createRESTEasyWithNoJBangWrapper() throws Exception { assertThat(projectDir.resolve("jbang")).doesNotExist(); - assertThat(projectDir.resolve("src/GreetingResource.java")) + assertThat(projectDir.resolve("src/main.java")) .exists() .satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?")) .satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy")); @@ -65,7 +65,7 @@ public void createRESTEasyWithExtensions() throws Exception { assertThat(projectDir.resolve("jbang")).exists(); - assertThat(projectDir.resolve("src/GreetingResource.java")) + assertThat(projectDir.resolve("src/main.java")) .exists() .satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?")) .satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy"))