|
26 | 26 | import java.util.List; |
27 | 27 | import java.util.concurrent.TimeUnit; |
28 | 28 | import org.apache.commons.cli.CommandLine; |
| 29 | +import org.apache.commons.cli.DeprecatedAttributes; |
29 | 30 | import org.apache.commons.cli.Option; |
30 | 31 | import org.apache.solr.client.solrj.SolrClient; |
31 | 32 | import org.apache.solr.client.solrj.SolrServerException; |
@@ -65,18 +66,40 @@ public List<Option> getOptions() { |
65 | 66 | .longOpt("not-root") |
66 | 67 | .build(), |
67 | 68 | Option.builder("r").desc("Asserts that we are the root user.").longOpt("root").build(), |
68 | | - Option.builder("S") |
| 69 | + Option.builder() |
69 | 70 | .desc("Asserts that Solr is NOT running on a certain URL. Default timeout is 1000ms.") |
70 | 71 | .longOpt("not-started") |
71 | 72 | .hasArg(true) |
72 | 73 | .argName("url") |
73 | 74 | .build(), |
74 | | - Option.builder("s") |
| 75 | + Option.builder("S") |
| 76 | + .desc("Asserts that Solr is NOT running on a certain URL. Default timeout is 1000ms.") |
| 77 | + .deprecated( |
| 78 | + DeprecatedAttributes.builder() |
| 79 | + .setForRemoval(true) |
| 80 | + .setSince("9.8") |
| 81 | + .setDescription("Use --not-started instead") |
| 82 | + .get()) |
| 83 | + .hasArg(true) |
| 84 | + .argName("url") |
| 85 | + .build(), |
| 86 | + Option.builder() |
75 | 87 | .desc("Asserts that Solr is running on a certain URL. Default timeout is 1000ms.") |
76 | 88 | .longOpt("started") |
77 | 89 | .hasArg(true) |
78 | 90 | .argName("url") |
79 | 91 | .build(), |
| 92 | + Option.builder("s") |
| 93 | + .desc("Asserts that Solr is running on a certain URL. Default timeout is 1000ms.") |
| 94 | + .deprecated( |
| 95 | + DeprecatedAttributes.builder() |
| 96 | + .setForRemoval(true) |
| 97 | + .setSince("9.8") |
| 98 | + .setDescription("Use --started instead") |
| 99 | + .get()) |
| 100 | + .hasArg(true) |
| 101 | + .argName("url") |
| 102 | + .build(), |
80 | 103 | Option.builder() |
81 | 104 | .desc("Asserts that we run as same user that owns <directory>.") |
82 | 105 | .longOpt("same-user") |
@@ -201,15 +224,17 @@ protected int runAssert(CommandLine cli) throws Exception { |
201 | 224 | if (cli.hasOption("same-user")) { |
202 | 225 | ret += sameUser(cli.getOptionValue("same-user")); |
203 | 226 | } |
204 | | - if (cli.hasOption("s")) { |
| 227 | + if (cli.hasOption("s") || cli.hasOption("started")) { |
205 | 228 | ret += |
206 | 229 | assertSolrRunning( |
207 | | - cli.getOptionValue("s"), cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt())); |
| 230 | + SolrCLI.getOptionWithDeprecatedAndDefault(cli, "started", "s", null), |
| 231 | + cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt())); |
208 | 232 | } |
209 | | - if (cli.hasOption("S")) { |
| 233 | + if (cli.hasOption("S") || cli.hasOption("not-started")) { |
210 | 234 | ret += |
211 | 235 | assertSolrNotRunning( |
212 | | - cli.getOptionValue("S"), cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt())); |
| 236 | + SolrCLI.getOptionWithDeprecatedAndDefault(cli, "not-started", "S", null), |
| 237 | + cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt())); |
213 | 238 | } |
214 | 239 | if (cli.hasOption("c")) { |
215 | 240 | ret += |
|
0 commit comments