org.apache.solr.util

## Class SolrCLI.AssertTool

- java.lang.Object
- - org.apache.solr.util.SolrCLI.ToolBase
  - - org.apache.solr.util.SolrCLI.AssertTool

- All Implemented Interfaces:
    SolrCLI.Tool
  Enclosing class:
    SolrCLI

      public static class SolrCLI.AssertTool
      extends SolrCLI.ToolBase

  Asserts various conditions and exists with error code if fails, else continues with no output

- - ### Field Summary

    - ### Fields inherited from class org.apache.solr.util.SolrCLI.ToolBase

      `stdout, verbose`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssertTool()`
    `AssertTool(PrintStream stdout)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `assertFileExists(String directory)`
    `static int` | `assertFileNotExists(String directory)`
    `static int` | `assertNotRootUser()`
    `static int` | `assertRootUser()`
    `static int` | `assertSolrNotRunning(String url)`
    `static int` | `assertSolrRunning(String url)`
    `static String` | `currentUser()`
    `String` | `getName()`
    `org.apache.commons.cli.Option[]` | `getOptions()`
    `protected int` | `runAssert(org.apache.commons.cli.CommandLine cli)` Custom run method which may return exit code
    `protected void` | `runImpl(org.apache.commons.cli.CommandLine cli)`
    `int` | `runTool(org.apache.commons.cli.CommandLine cli)`
    `static int` | `sameUser(String directory)`
    `static String` | `userForDir(Path pathToDir)`

    - ### Methods inherited from class org.apache.solr.util.SolrCLI.ToolBase

      `echo`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AssertTool

          public AssertTool()

    - #### AssertTool

          public AssertTool(PrintStream stdout)

  - ### Method Detail

    - #### getName

          public String getName()

    - #### getOptions

          public org.apache.commons.cli.Option[] getOptions()

    - #### runTool

          public int runTool(org.apache.commons.cli.CommandLine cli)
                      throws Exception

      Specified by:
        `runTool` in interface `SolrCLI.Tool`
      Overrides:
        `runTool` in class `SolrCLI.ToolBase`
      Throws:
        `Exception`

    - #### runImpl

          protected void runImpl(org.apache.commons.cli.CommandLine cli)
                          throws Exception

      Specified by:
        `runImpl` in class `SolrCLI.ToolBase`
      Throws:
        `Exception`

    - #### runAssert

          protected int runAssert(org.apache.commons.cli.CommandLine cli)
                           throws Exception

      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

          public static int assertSolrRunning(String url)
                                       throws Exception

      Throws:
        `Exception`

    - #### assertSolrNotRunning

          public static int assertSolrNotRunning(String url)
                                          throws Exception

      Throws:
        `Exception`

    - #### sameUser

          public static int sameUser(String directory)
                              throws Exception

      Throws:
        `Exception`

    - #### assertFileExists

          public static int assertFileExists(String directory)
                                      throws Exception

      Throws:
        `Exception`

    - #### assertFileNotExists

          public static int assertFileNotExists(String directory)
                                         throws Exception

      Throws:
        `Exception`

    - #### assertRootUser

          public static int assertRootUser()
                                    throws Exception

      Throws:
        `Exception`

    - #### assertNotRootUser

          public static int assertNotRootUser()
                                       throws Exception

      Throws:
        `Exception`

    - #### currentUser

          public static String currentUser()

    - #### userForDir

          public static String userForDir(Path pathToDir)

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.