diff --git a/quarkus-picocli/pom.xml b/quarkus-picocli/pom.xml
index ac4bc4294..e73b511c1 100644
--- a/quarkus-picocli/pom.xml
+++ b/quarkus-picocli/pom.xml
@@ -5,10 +5,15 @@
io.quarkus.ts.qe
parent
1.0.0-SNAPSHOT
+ ..
quarkus-picocli
Quarkus QE TS: Quarkus Picocli
jar
+
+
+ true
+
io.quarkus
diff --git a/quarkus-picocli/src/main/java/io/quarkus/ts/qe/configuration/Config.java b/quarkus-picocli/src/main/java/io/quarkus/ts/qe/configuration/Configuration.java
similarity index 77%
rename from quarkus-picocli/src/main/java/io/quarkus/ts/qe/configuration/Config.java
rename to quarkus-picocli/src/main/java/io/quarkus/ts/qe/configuration/Configuration.java
index 9727de05b..f3c527ced 100644
--- a/quarkus-picocli/src/main/java/io/quarkus/ts/qe/configuration/Config.java
+++ b/quarkus-picocli/src/main/java/io/quarkus/ts/qe/configuration/Configuration.java
@@ -9,19 +9,19 @@
import io.quarkus.ts.qe.command.OtherEntryCommand;
@ApplicationScoped
-public class Config {
+public class Configuration {
+
@Produces
@TopCommand
- @IfBuildProfile("dev")
- public Object devCommand() {
+ @IfBuildProfile("test")
+ public Class devCommand() {
return EntryCommand.class;
}
@Produces
@TopCommand
@IfBuildProfile("prod")
- public Object prodCommand() {
+ public Class prodCommand() {
return OtherEntryCommand.class;
}
-
-}
\ No newline at end of file
+}
diff --git a/quarkus-picocli/src/test/java/PicocliDevIT.java b/quarkus-picocli/src/test/java/PicocliDevIT.java
deleted file mode 100644
index 0885a17d4..000000000
--- a/quarkus-picocli/src/test/java/PicocliDevIT.java
+++ /dev/null
@@ -1,102 +0,0 @@
-import static java.util.concurrent.CompletableFuture.runAsync;
-
-import org.junit.jupiter.api.Test;
-
-import io.quarkus.test.bootstrap.RestService;
-import io.quarkus.test.scenarios.QuarkusScenario;
-import io.quarkus.test.services.QuarkusApplication;
-import io.quarkus.ts.qe.command.AgeCommand;
-import io.quarkus.ts.qe.command.EntryCommand;
-import io.quarkus.ts.qe.command.HelloCommand;
-import io.quarkus.ts.qe.configuration.Config;
-import io.quarkus.ts.qe.services.AgeService;
-import io.quarkus.ts.qe.services.HelloService;
-
-@QuarkusScenario
-public class PicocliDevIT {
-
- @QuarkusApplication(classes = { EntryCommand.class, Config.class, HelloCommand.class, AgeCommand.class, AgeService.class,
- HelloService.class }, properties = "dev.properties")
- static final RestService greetingApp = new RestService()
- .withProperty("quarkus.args", "greeting --name QE")
- .setAutoStart(false);
-
- @QuarkusApplication(classes = { EntryCommand.class, Config.class, HelloCommand.class, AgeCommand.class, AgeService.class,
- HelloService.class }, properties = "dev.properties")
- static final RestService ageApp = new RestService()
- .withProperty("quarkus.args", "age --age 30")
- .setAutoStart(false);
-
- @QuarkusApplication(classes = { EntryCommand.class, Config.class, HelloCommand.class, AgeCommand.class, AgeService.class,
- HelloService.class }, properties = "dev.properties")
- static final RestService greetingBlankArgumentApp = new RestService()
- .withProperty("quarkus.args", " --name QE")
- .setAutoStart(false);
-
- @QuarkusApplication(classes = { EntryCommand.class, Config.class, HelloCommand.class, AgeCommand.class, AgeService.class,
- HelloService.class }, properties = "dev.properties")
- static final RestService greetingInvalidArgumentApp = new RestService()
- .withProperty("quarkus.args", "greeting -x QE")
- .setAutoStart(false);
-
- @QuarkusApplication(classes = { EntryCommand.class, Config.class, HelloCommand.class, AgeCommand.class, AgeService.class,
- HelloService.class }, properties = "dev.properties")
- static final RestService bothTopCommandApp = new RestService()
- .setAutoStart(false);
-
- @Test
- public void verifyErrorForApplicationScopedBeanInPicocliCommand() {
- try {
- runAsync(ageApp::start);
- ageApp.logs().assertContains("CDI: programmatic lookup problem detected");
- } finally {
- ageApp.stop();
- }
- }
-
- @Test
- public void verifyGreetingCommandOutputsExpectedMessage() {
- try {
- runAsync(greetingApp::start);
- greetingApp.logs().assertContains("Hello QE!");
- } finally {
- greetingApp.stop();
- }
- }
-
- @Test
- void verifyErrorForBlankArgumentsInGreetingCommand() {
- try {
- runAsync(greetingBlankArgumentApp::start);
- greetingBlankArgumentApp.logs().assertContains("Unmatched arguments from index 0: '', '--name', 'QE'");
- } finally {
- greetingBlankArgumentApp.stop();
- }
- }
-
- @Test
- void verifyErrorForInvalidArgumentsInGreetingCommand() {
- try {
- runAsync(greetingInvalidArgumentApp::start);
- greetingInvalidArgumentApp.logs().assertContains("Unknown options: '-x', 'QE'");
- } finally {
- greetingInvalidArgumentApp.stop();
- }
- }
-
- /**
- * Chain Commands in a Single Execution is not possible
- */
- @Test
- public void verifyErrorForMultipleCommandsWithoutTopCommand() {
- bothTopCommandApp
- .withProperty("quarkus.args", "greeting --name EEUU age --age 247");
- try {
- runAsync(bothTopCommandApp::start);
- bothTopCommandApp.logs().assertContains("Unmatched arguments from index 3: 'age', '--age', '247'");
- } finally {
- bothTopCommandApp.stop();
- }
- }
-
-}
diff --git a/quarkus-picocli/src/test/java/PicocliProdIT.java b/quarkus-picocli/src/test/java/PicocliProdIT.java
deleted file mode 100644
index 27d95b99e..000000000
--- a/quarkus-picocli/src/test/java/PicocliProdIT.java
+++ /dev/null
@@ -1,31 +0,0 @@
-import static java.util.concurrent.CompletableFuture.runAsync;
-
-import org.junit.jupiter.api.Test;
-
-import io.quarkus.test.bootstrap.RestService;
-import io.quarkus.test.scenarios.QuarkusScenario;
-import io.quarkus.test.services.QuarkusApplication;
-import io.quarkus.ts.qe.command.CommonOptions;
-import io.quarkus.ts.qe.command.OtherCommand;
-import io.quarkus.ts.qe.command.OtherEntryCommand;
-import io.quarkus.ts.qe.configuration.Config;
-
-@QuarkusScenario
-public class PicocliProdIT {
- @QuarkusApplication(classes = { OtherEntryCommand.class, Config.class, OtherCommand.class,
- CommonOptions.class }, properties = "prod.properties")
- static final RestService customized = new RestService()
- .withProperty("quarkus.args", "start -t 60 -v")
- .setAutoStart(false);
-
- @Test
- public void verifyCustomizedCommandLineBehavior() {
- String expectedOutput = "Service started with timeout: 60 and verbosity";
- try {
- runAsync(customized::start);
- customized.logs().assertContains(expectedOutput);
- } finally {
- customized.stop();
- }
- }
-}
\ No newline at end of file
diff --git a/quarkus-picocli/src/test/java/PicocliProfileProdIT.java b/quarkus-picocli/src/test/java/PicocliProfileProdIT.java
new file mode 100644
index 000000000..7fde6d1c2
--- /dev/null
+++ b/quarkus-picocli/src/test/java/PicocliProfileProdIT.java
@@ -0,0 +1,30 @@
+import org.junit.jupiter.api.Test;
+
+import io.quarkus.test.bootstrap.RestService;
+import io.quarkus.test.scenarios.QuarkusScenario;
+import io.quarkus.test.services.QuarkusApplication;
+import io.quarkus.ts.qe.command.AgeCommand;
+import io.quarkus.ts.qe.command.CommonOptions;
+import io.quarkus.ts.qe.command.EntryCommand;
+import io.quarkus.ts.qe.command.HelloCommand;
+import io.quarkus.ts.qe.command.OtherCommand;
+import io.quarkus.ts.qe.command.OtherEntryCommand;
+import io.quarkus.ts.qe.configuration.Configuration;
+import io.quarkus.ts.qe.services.AgeService;
+import io.quarkus.ts.qe.services.HelloService;
+
+@QuarkusScenario
+public class PicocliProfileProdIT {
+
+ @QuarkusApplication(classes = { AgeCommand.class, CommonOptions.class, EntryCommand.class, HelloCommand.class,
+ OtherCommand.class, OtherEntryCommand.class,
+ Configuration.class, AgeService.class, HelloService.class }, properties = "prod.properties")
+ static final RestService customized = new RestService()
+ .withProperty("quarkus.args", "start -t 60 -v");
+
+ @Test
+ public void verifyCustomizedCommandLineBehavior() {
+ String expectedOutput = "Service started with timeout: 60 and verbosity";
+ customized.logs().assertContains(expectedOutput);
+ }
+}
diff --git a/quarkus-picocli/src/test/java/PicocliProfileTestIT.java b/quarkus-picocli/src/test/java/PicocliProfileTestIT.java
new file mode 100644
index 000000000..4efdfb694
--- /dev/null
+++ b/quarkus-picocli/src/test/java/PicocliProfileTestIT.java
@@ -0,0 +1,69 @@
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import io.quarkus.test.bootstrap.RestService;
+import io.quarkus.test.scenarios.QuarkusScenario;
+import io.quarkus.test.services.QuarkusApplication;
+import io.quarkus.ts.qe.command.AgeCommand;
+import io.quarkus.ts.qe.command.CommonOptions;
+import io.quarkus.ts.qe.command.EntryCommand;
+import io.quarkus.ts.qe.command.HelloCommand;
+import io.quarkus.ts.qe.command.OtherCommand;
+import io.quarkus.ts.qe.command.OtherEntryCommand;
+import io.quarkus.ts.qe.configuration.Configuration;
+import io.quarkus.ts.qe.services.AgeService;
+import io.quarkus.ts.qe.services.HelloService;
+
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
+@QuarkusScenario
+public class PicocliProfileTestIT {
+
+ @QuarkusApplication(classes = { AgeCommand.class, CommonOptions.class, EntryCommand.class, HelloCommand.class,
+ OtherCommand.class, OtherEntryCommand.class,
+ Configuration.class, AgeService.class, HelloService.class }, properties = "test.properties")
+ static final RestService app = new RestService().withProperty("quarkus.args", "age --age 30");
+
+ @Order(1)
+ @Test
+ public void verifyErrorForApplicationScopedBeanInPicocliCommand() {
+ app.logs().assertContains("CDI: programmatic lookup problem detected");
+ }
+
+ @Order(2)
+ @Test
+ public void verifyGreetingCommandOutputsExpectedMessage() {
+ app.withProperty("quarkus.args", "greeting --name QE");
+ app.restart();
+ app.logs().assertContains("Hello QE!");
+ }
+
+ @Order(3)
+ @Test
+ void verifyErrorForBlankArgumentsInGreetingCommand() {
+ app.withProperty("quarkus.args", " --name QE");
+ app.restart();
+ app.logs().assertContains("Unmatched arguments from index 0: '', '--name', 'QE'");
+ }
+
+ @Order(4)
+ @Test
+ void verifyErrorForInvalidArgumentsInGreetingCommand() {
+ app.withProperty("quarkus.args", "greeting -x QE");
+ app.restart();
+ app.logs().assertContains("Unknown options: '-x', 'QE'");
+ }
+
+ /**
+ * Chain Commands in a Single Execution is not possible
+ */
+ @Order(5)
+ @Test
+ public void verifyErrorForMultipleCommandsWithoutTopCommand() {
+ app.withProperty("quarkus.args", "greeting --name EEUU age --age 247");
+ app.restart();
+ app.logs().assertContains("Unmatched arguments from index 3: 'age', '--age', '247'");
+ }
+
+}
diff --git a/quarkus-picocli/src/test/resources/dev.properties b/quarkus-picocli/src/test/resources/dev.properties
deleted file mode 100644
index f97416d51..000000000
--- a/quarkus-picocli/src/test/resources/dev.properties
+++ /dev/null
@@ -1 +0,0 @@
-quarkus.profile=dev
\ No newline at end of file
diff --git a/quarkus-picocli/src/test/resources/test.properties b/quarkus-picocli/src/test/resources/test.properties
new file mode 100644
index 000000000..76cc5d61f
--- /dev/null
+++ b/quarkus-picocli/src/test/resources/test.properties
@@ -0,0 +1 @@
+quarkus.profile=test
\ No newline at end of file