@@ -99,7 +99,7 @@ public void testBootstrapInvalidCredentials(LaunchResult result) {
9999 public void testBootstrapInvalidArguments (LaunchResult result ) {
100100 assertThat (result .getErrorOutput ())
101101 .contains (
102- "Error: (-r=<realm> [-r=<realm>]... [-c=<realm,clientId,clientSecret>]...) "
102+ "Error: (-r=<realm> [-r=<realm>]... [-c=<realm,clientId,clientSecret>]... [-p] ) "
103103 + "and -f=<file> are mutually exclusive (specify only one)" );
104104 }
105105
@@ -132,6 +132,45 @@ public void testBootstrapFromInvalidFile(QuarkusMainLauncher launcher) {
132132 .contains ("Bootstrap encountered errors during operation." );
133133 }
134134
135+ @ Test
136+ @ Launch (
137+ value = {"bootstrap" , "-r" , "realm1" , "-c" , "realm1,client1d,s3cr3t" , "--print-credentials" })
138+ public void testPrintCredentials (LaunchResult result ) {
139+ assertThat (result .getOutput ()).contains ("Bootstrap completed successfully." );
140+ assertThat (result .getOutput ()).contains ("realm: realm1 root principal credentials: client1d:" );
141+ }
142+
143+ @ Test
144+ @ Launch (value = {"bootstrap" , "-r" , "realm1" , "--print-credentials" })
145+ public void testPrintCredentialsSystemGenerated (LaunchResult result ) {
146+ assertThat (result .getOutput ()).contains ("Bootstrap completed successfully." );
147+ assertThat (result .getOutput ()).contains ("realm: realm1 root principal credentials: " );
148+ }
149+
150+ @ Test
151+ @ Launch (
152+ value = {"bootstrap" , "-r" , "realm1" },
153+ exitCode = EXIT_CODE_BOOTSTRAP_ERROR )
154+ public void testNoPrintCredentialsSystemGenerated (LaunchResult result ) {
155+ assertThat (result .getErrorOutput ()).contains ("--credentials" );
156+ assertThat (result .getErrorOutput ()).contains ("--print-credentials" );
157+ }
158+
159+ @ Test
160+ @ Launch (
161+ value = {
162+ "bootstrap" ,
163+ "-r" ,
164+ "realm1" ,
165+ "--not-real-arg" ,
166+ },
167+ exitCode = EXIT_CODE_USAGE )
168+ public void testBootstrapInvalidArg (LaunchResult result ) {
169+ assertThat (result .getErrorOutput ())
170+ .contains ("Unknown option: '--not-real-arg'" )
171+ .contains ("Usage:" );
172+ }
173+
135174 private static Path copyResource (Path temp , String resource ) throws IOException {
136175 URL source = Objects .requireNonNull (BootstrapCommandTest .class .getResource (resource ));
137176 Path dest = temp .resolve (resource );
0 commit comments