@@ -63,15 +63,24 @@ public List<Option> getOptions() {
6363 return List .of (
6464 Option .builder ("R" )
6565 .desc ("Asserts that we are NOT the root user." )
66- .longOpt ("not-root" )
66+ .deprecated (
67+ DeprecatedAttributes .builder ()
68+ .setForRemoval (true )
69+ .setSince ("9.8" )
70+ .setDescription ("Use --not-root instead" )
71+ .get ())
6772 .build (),
68- Option .builder ("r" ).desc ("Asserts that we are the root user." ).longOpt ("root" ).build (),
69- Option .builder ()
70- .desc ("Asserts that Solr is NOT running on a certain URL. Default timeout is 1000ms." )
71- .longOpt ("not-started" )
72- .hasArg (true )
73- .argName ("url" )
73+ Option .builder ().desc ("Asserts that we are NOT the root user." ).longOpt ("not-root" ).build (),
74+ Option .builder ("r" )
75+ .desc ("Asserts that we are the root user." )
76+ .deprecated (
77+ DeprecatedAttributes .builder ()
78+ .setForRemoval (true )
79+ .setSince ("9.8" )
80+ .setDescription ("Use --root instead" )
81+ .get ())
7482 .build (),
83+ Option .builder ().desc ("Asserts that we are the root user." ).longOpt ("root" ).build (),
7584 Option .builder ("S" )
7685 .desc ("Asserts that Solr is NOT running on a certain URL. Default timeout is 1000ms." )
7786 .deprecated (
@@ -84,8 +93,8 @@ public List<Option> getOptions() {
8493 .argName ("url" )
8594 .build (),
8695 Option .builder ()
87- .desc ("Asserts that Solr is running on a certain URL. Default timeout is 1000ms." )
88- .longOpt ("started" )
96+ .desc ("Asserts that Solr is NOT running on a certain URL. Default timeout is 1000ms." )
97+ .longOpt ("not- started" )
8998 .hasArg (true )
9099 .argName ("url" )
91100 .build (),
@@ -100,52 +109,136 @@ public List<Option> getOptions() {
100109 .hasArg (true )
101110 .argName ("url" )
102111 .build (),
112+ Option .builder ()
113+ .desc ("Asserts that Solr is running on a certain URL. Default timeout is 1000ms." )
114+ .longOpt ("started" )
115+ .hasArg (true )
116+ .argName ("url" )
117+ .build (),
103118 Option .builder ()
104119 .desc ("Asserts that we run as same user that owns <directory>." )
105120 .longOpt ("same-user" )
106121 .hasArg (true )
107122 .argName ("directory" )
108123 .build (),
109124 Option .builder ("x" )
125+ .desc ("Asserts that directory <directory> exists." )
126+ .deprecated (
127+ DeprecatedAttributes .builder ()
128+ .setForRemoval (true )
129+ .setSince ("9.8" )
130+ .setDescription ("Use --exists instead" )
131+ .get ())
132+ .hasArg (true )
133+ .argName ("directory" )
134+ .build (),
135+ Option .builder ()
110136 .desc ("Asserts that directory <directory> exists." )
111137 .longOpt ("exists" )
112138 .hasArg (true )
113139 .argName ("directory" )
114140 .build (),
115141 Option .builder ("X" )
142+ .desc ("Asserts that directory <directory> does NOT exist." )
143+ .deprecated (
144+ DeprecatedAttributes .builder ()
145+ .setForRemoval (true )
146+ .setSince ("9.8" )
147+ .setDescription ("Use --not-exists instead" )
148+ .get ())
149+ .hasArg (true )
150+ .argName ("directory" )
151+ .build (),
152+ Option .builder ()
116153 .desc ("Asserts that directory <directory> does NOT exist." )
117154 .longOpt ("not-exists" )
118155 .hasArg (true )
119156 .argName ("directory" )
120157 .build (),
121158 Option .builder ("c" )
159+ .desc (
160+ "Asserts that Solr is running in cloud mode. Also fails if Solr not running. URL should be for root Solr path." )
161+ .deprecated (
162+ DeprecatedAttributes .builder ()
163+ .setForRemoval (true )
164+ .setSince ("9.8" )
165+ .setDescription ("Use --cloud instead" )
166+ .get ())
167+ .hasArg (true )
168+ .argName ("url" )
169+ .build (),
170+ Option .builder ()
122171 .desc (
123172 "Asserts that Solr is running in cloud mode. Also fails if Solr not running. URL should be for root Solr path." )
124173 .longOpt ("cloud" )
125174 .hasArg (true )
126175 .argName ("url" )
127176 .build (),
128177 Option .builder ("C" )
178+ .desc (
179+ "Asserts that Solr is not running in cloud mode. Also fails if Solr not running. URL should be for root Solr path." )
180+ .deprecated (
181+ DeprecatedAttributes .builder ()
182+ .setForRemoval (true )
183+ .setSince ("9.8" )
184+ .setDescription ("Use --not-cloud instead" )
185+ .get ())
186+ .hasArg (true )
187+ .argName ("url" )
188+ .build (),
189+ Option .builder ()
129190 .desc (
130191 "Asserts that Solr is not running in cloud mode. Also fails if Solr not running. URL should be for root Solr path." )
131192 .longOpt ("not-cloud" )
132193 .hasArg (true )
133194 .argName ("url" )
134195 .build (),
135196 Option .builder ("m" )
197+ .desc ("Exception message to be used in place of the default error message." )
198+ .deprecated (
199+ DeprecatedAttributes .builder ()
200+ .setForRemoval (true )
201+ .setSince ("9.8" )
202+ .setDescription ("Use --message instead" )
203+ .get ())
204+ .hasArg (true )
205+ .argName ("message" )
206+ .build (),
207+ Option .builder ()
136208 .desc ("Exception message to be used in place of the default error message." )
137209 .longOpt ("message" )
138210 .hasArg (true )
139211 .argName ("message" )
140212 .build (),
141213 Option .builder ("t" )
214+ .desc ("Timeout in ms for commands supporting a timeout." )
215+ .deprecated (
216+ DeprecatedAttributes .builder ()
217+ .setForRemoval (true )
218+ .setSince ("9.8" )
219+ .setDescription ("Use --timeout instead" )
220+ .get ())
221+ .hasArg (true )
222+ .type (Long .class )
223+ .argName ("ms" )
224+ .build (),
225+ Option .builder ()
142226 .desc ("Timeout in ms for commands supporting a timeout." )
143227 .longOpt ("timeout" )
144228 .hasArg (true )
145229 .type (Long .class )
146230 .argName ("ms" )
147231 .build (),
148232 Option .builder ("e" )
233+ .desc ("Return an exit code instead of printing error message on assert fail." )
234+ .deprecated (
235+ DeprecatedAttributes .builder ()
236+ .setForRemoval (true )
237+ .setSince ("9.8" )
238+ .setDescription ("Use --exitcode instead" )
239+ .get ())
240+ .build (),
241+ Option .builder ()
149242 .desc ("Return an exit code instead of printing error message on assert fail." )
150243 .longOpt ("exitcode" )
151244 .build (),
@@ -201,53 +294,91 @@ protected int runAssert(CommandLine cli) throws Exception {
201294 if (cli .hasOption ("m" )) {
202295 message = cli .getOptionValue ("m" );
203296 }
297+ if (cli .hasOption ("message" )) {
298+ message = cli .getOptionValue ("message" );
299+ }
204300 if (cli .hasOption ("t" )) {
205301 timeoutMs = Long .parseLong (cli .getOptionValue ("t" ));
206302 }
303+ if (cli .hasOption ("timeout" )) {
304+ timeoutMs = Long .parseLong (cli .getOptionValue ("timeout" ));
305+ }
207306 if (cli .hasOption ("e" )) {
208307 useExitCode = true ;
209308 }
309+ if (cli .hasOption ("exitcode" )) {
310+ useExitCode = true ;
311+ }
210312
211313 int ret = 0 ;
212- if (cli .hasOption ("r" )) {
314+ if (cli .hasOption ("root" ) || cli . hasOption ( " r" )) {
213315 ret += assertRootUser ();
214316 }
215- if (cli .hasOption ("R" )) {
317+ if (cli .hasOption ("not-root" ) || cli . hasOption ( " R" )) {
216318 ret += assertNotRootUser ();
217319 }
218320 if (cli .hasOption ("x" )) {
219321 ret += assertFileExists (cli .getOptionValue ("x" ));
220322 }
323+ if (cli .hasOption ("exists" )) {
324+ ret += assertFileExists (cli .getOptionValue ("exists" ));
325+ }
221326 if (cli .hasOption ("X" )) {
222327 ret += assertFileNotExists (cli .getOptionValue ("X" ));
223328 }
329+ if (cli .hasOption ("not-exists" )) {
330+ ret += assertFileNotExists (cli .getOptionValue ("not-exists" ));
331+ }
224332 if (cli .hasOption ("same-user" )) {
225333 ret += sameUser (cli .getOptionValue ("same-user" ));
226334 }
227- if (cli .hasOption ("s" ) || cli . hasOption ( "started" ) ) {
335+ if (cli .hasOption ("s" )) {
228336 ret +=
229337 assertSolrRunning (
230- SolrCLI .getOptionWithDeprecatedAndDefault (cli , "started" , "s" , null ),
338+ cli .getOptionValue ("s" ), cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
339+ }
340+ if (cli .hasOption ("started" )) {
341+ ret +=
342+ assertSolrRunning (
343+ cli .getOptionValue ("started" ),
231344 cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
232345 }
233- if (cli .hasOption ("S" ) || cli . hasOption ( "not-started" ) ) {
346+ if (cli .hasOption ("S" )) {
234347 ret +=
235348 assertSolrNotRunning (
236349 SolrCLI .getOptionWithDeprecatedAndDefault (cli , "not-started" , "S" , null ),
237350 cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
238351 }
352+ if (cli .hasOption ("not-started" )) {
353+ ret +=
354+ assertSolrNotRunning (
355+ cli .getOptionValue ("not-started" ),
356+ cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
357+ }
239358 if (cli .hasOption ("c" )) {
240359 ret +=
241360 assertSolrRunningInCloudMode (
242361 SolrCLI .normalizeSolrUrl (cli .getOptionValue ("c" )),
243362 cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
244363 }
364+ if (cli .hasOption ("cloud" )) {
365+ ret +=
366+ assertSolrRunningInCloudMode (
367+ SolrCLI .normalizeSolrUrl (cli .getOptionValue ("cloud" )),
368+ cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
369+ }
245370 if (cli .hasOption ("C" )) {
246371 ret +=
247372 assertSolrNotRunningInCloudMode (
248373 SolrCLI .normalizeSolrUrl (cli .getOptionValue ("C" )),
249374 cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
250375 }
376+ if (cli .hasOption ("not-cloud" )) {
377+ ret +=
378+ assertSolrNotRunningInCloudMode (
379+ SolrCLI .normalizeSolrUrl (cli .getOptionValue ("not-cloud" )),
380+ cli .getOptionValue (SolrCLI .OPTION_CREDENTIALS .getLongOpt ()));
381+ }
251382 return ret ;
252383 }
253384
0 commit comments