Skip to content

Commit

Permalink
Reorder parameters to put credentials next to solrUrl.
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Sep 26, 2023
1 parent 7f9988f commit e72d691
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions solr/core/src/java/org/apache/solr/cli/AssertTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ protected int runAssert(CommandLine cli) throws Exception {
public static int assertSolrRunning(String url, String credentials) throws Exception {
StatusTool status = new StatusTool();
try {
status.waitToSeeSolrUp(url, timeoutMs, TimeUnit.MILLISECONDS, credentials);
status.waitToSeeSolrUp(url, credentials, timeoutMs, TimeUnit.MILLISECONDS);
} catch (Exception se) {
if (SolrCLI.exceptionIsAuthRelated(se)) {
throw se;
Expand Down Expand Up @@ -248,7 +248,7 @@ public static int assertSolrNotRunning(String url, String credentials) throws Ex
}
while (System.nanoTime() < timeout) {
try {
status.waitToSeeSolrUp(url, 1, TimeUnit.SECONDS, credentials);
status.waitToSeeSolrUp(url, credentials, 1, TimeUnit.SECONDS);
try {
log.debug("Solr still up. Waiting before trying again to see if it was stopped");
Thread.sleep(1000L);
Expand Down Expand Up @@ -286,7 +286,8 @@ public static int assertSolrRunningInCloudMode(String url, String credentials) t
return 0;
}

public static int assertSolrNotRunningInCloudMode(String url, String credentials) throws Exception {
public static int assertSolrNotRunningInCloudMode(String url, String credentials)
throws Exception {
if (!isSolrRunningOn(url, credentials)) {
return exitOrException(
"Solr is not running on url "
Expand Down Expand Up @@ -367,7 +368,7 @@ private static int exitOrException(String msg) throws AssertionFailureException
private static boolean isSolrRunningOn(String url, String credentials) throws Exception {
StatusTool status = new StatusTool();
try {
status.waitToSeeSolrUp(url, timeoutMs, TimeUnit.MILLISECONDS, credentials);
status.waitToSeeSolrUp(url, credentials, timeoutMs, TimeUnit.MILLISECONDS);
return true;
} catch (Exception se) {
if (SolrCLI.exceptionIsAuthRelated(se)) {
Expand Down
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ protected Map<String, Object> getNodeStatus(String solrUrl, String credentials,

URL solrURL = new URL(solrUrl);
Map<String, Object> nodeStatus =
statusTool.waitToSeeSolrUp(solrUrl, maxWaitSecs, TimeUnit.SECONDS, credentials);
statusTool.waitToSeeSolrUp(solrUrl, credentials, maxWaitSecs, TimeUnit.SECONDS);
nodeStatus.put("baseUrl", solrUrl);
CharArr arr = new CharArr();
new JSONWriter(arr, 2).write(nodeStatus);
Expand Down
4 changes: 2 additions & 2 deletions solr/core/src/java/org/apache/solr/cli/StatusTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void runImpl(CommandLine cli) throws Exception {
int solrPort = (new URL(solrUrl)).getPort();
echo("Waiting up to " + maxWaitSecs + " seconds to see Solr running on port " + solrPort);
try {
waitToSeeSolrUp(solrUrl, maxWaitSecs, TimeUnit.SECONDS, cli.getOptionValue("credentials"));
waitToSeeSolrUp(solrUrl, cli.getOptionValue("credentials"), maxWaitSecs, TimeUnit.SECONDS);
echo("Started Solr server on port " + solrPort + ". Happy searching!");
} catch (TimeoutException timeout) {
throw new Exception(
Expand All @@ -124,7 +124,7 @@ public void runImpl(CommandLine cli) throws Exception {
}

public Map<String, Object> waitToSeeSolrUp(
String solrUrl, long maxWait, TimeUnit unit, String credentials) throws Exception {
String solrUrl, String credentials, long maxWait, TimeUnit unit) throws Exception {
long timeout = System.nanoTime() + TimeUnit.NANOSECONDS.convert(maxWait, unit);
while (System.nanoTime() < timeout) {

Expand Down

0 comments on commit e72d691

Please sign in to comment.