Package org.apache.solr.cli
Class AssertTool
java.lang.Object
org.apache.solr.cli.ToolBase
org.apache.solr.cli.AssertTool
- All Implemented Interfaces:
Tool
Supports assert command in the bin/solr script. Asserts various conditions and exists with error
code if there are failures, else continues with no output.
-
Nested Class Summary
Nested Classes -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intassertFileExists(String directory) static intassertFileNotExists(String directory) static intstatic intintassertSolrNotRunning(String url, String credentials) intassertSolrNotRunningInCloudMode(String url, String credentials) intassertSolrRunning(String url, String credentials) intassertSolrRunningInCloudMode(String url, String credentials) static StringgetName()Defines the interface to a Solr tool that can be run from this command-line app.org.apache.commons.cli.OptionsRetrieve theOptionssupported by this tool.protected intrunAssert(org.apache.commons.cli.CommandLine cli) Custom run method which may return exit codevoidrunImpl(org.apache.commons.cli.CommandLine cli) intrunTool(org.apache.commons.cli.CommandLine cli) Returns 100 error code for a true "error", otherwise returns the number of tests that failed.static intstatic StringuserForDir(Path pathToDir) Methods inherited from class org.apache.solr.cli.ToolBase
echo, echoIfVerbose, getConnectionOptions, getRuntime, isVerbose
-
Constructor Details
-
AssertTool
-
-
Method Details
-
getName
Description copied from interface:ToolDefines the interface to a Solr tool that can be run from this command-line app. -
getOptions
public org.apache.commons.cli.Options getOptions()Description copied from interface:ToolRetrieve theOptionssupported by this tool.- Specified by:
getOptionsin interfaceTool- Overrides:
getOptionsin classToolBase- Returns:
- The
Optionsthis tool supports.
-
runTool
Returns 100 error code for a true "error", otherwise returns the number of tests that failed. Otherwise, very similar to the parent runTool method. -
runImpl
-
runAssert
Custom run method which may return exit code- Parameters:
cli- the command line object- Returns:
- 0 on success, or a number corresponding to number of tests that failed
- Throws:
Exception- if a tool failed, e.g. authentication failure
-
assertSolrRunning
- Throws:
Exception
-
assertSolrNotRunning
- Throws:
Exception
-
assertSolrRunningInCloudMode
- Throws:
Exception
-
assertSolrNotRunningInCloudMode
- Throws:
Exception
-
sameUser
- Throws:
Exception
-
assertFileExists
- Throws:
Exception
-
assertFileNotExists
- Throws:
Exception
-
assertRootUser
- Throws:
Exception
-
assertNotRootUser
- Throws:
Exception
-
currentUser
-
userForDir
-