Class BackupStatusChecker

java.lang.Object
org.apache.solr.handler.BackupStatusChecker

public final class BackupStatusChecker extends Object
Helper class for validating when the replication handler has finished a backup.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BackupStatusChecker(org.apache.solr.client.solrj.SolrClient client)
    Defaults to a path of /replication (ie: assumes client is configured with a core specific solr URL).
    BackupStatusChecker(org.apache.solr.client.solrj.SolrClient client, String path)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Does a single check of the replication handler's status to determine if the specified name matches the most recently deleted backup, and if deleting that backup was a success.
    Does a single check of the replication handler's status to determine if the mostrecently completed backup was a success.
    Does a single check of the replication handler's status to determine if the specified name matches the most recently completed backup, and if that backup was a success.
    void
    waitForBackupDeletionSuccess(String backupName, int timeLimitInSeconds)
    Convinience wrapper
    void
    waitForBackupDeletionSuccess(String backupName, org.apache.solr.util.TimeOut timeOut)
    Polls the replication handler's status until the it reports that the specified backupName is deleted or either "Unable to delete" status is reported or the timeOut expires (in either case an assertion is thrown)
    waitForBackupSuccess(String backupName, int timeLimitInSeconds)
    Convinience wrapper
    waitForBackupSuccess(String backupName, org.apache.solr.util.TimeOut timeOut)
    Polls the replication handler's status until the it reports that the specified backupName is completed as a "success" (in which case the method returns the directoryName of the backup) or either "exception" is reported or the timeOut expires (in either case an assertion is thrown)
    waitForDifferentBackupDir(String directoryName, int timeLimitInSeconds)
    Convinience wrapper
    waitForDifferentBackupDir(String directoryName, org.apache.solr.util.TimeOut timeOut)
    Polls the replication handler's status until the it reports that any backup has completed as a "success" with a different "directoryName" then the one specified (in which case the method returns the new directoryName) or either an "exception" is reported or the timeOut expires (in either case an assertion is thrown)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BackupStatusChecker

      public BackupStatusChecker(org.apache.solr.client.solrj.SolrClient client, String path)
      Parameters:
      client - the client to use in all requests, will not be closed
      path - the path to use for accessing the /replication handle when using the client
    • BackupStatusChecker

      public BackupStatusChecker(org.apache.solr.client.solrj.SolrClient client)
      Defaults to a path of /replication (ie: assumes client is configured with a core specific solr URL).
      See Also:
  • Method Details

    • waitForBackupSuccess

      public String waitForBackupSuccess(String backupName, int timeLimitInSeconds) throws Exception
      Convinience wrapper
      Throws:
      Exception
      See Also:
    • waitForBackupSuccess

      public String waitForBackupSuccess(String backupName, org.apache.solr.util.TimeOut timeOut) throws Exception
      Polls the replication handler's status until the it reports that the specified backupName is completed as a "success" (in which case the method returns the directoryName of the backup) or either "exception" is reported or the timeOut expires (in either case an assertion is thrown)

      NOTE: this method is NOT suitable/safe to use in a test where multiple backups are being taken/deleted concurrently, because the replication handler API provides no reliable way to check the results of a specific backup before the results of another backup may overwrite them internally.

      Parameters:
      backupName - to look for
      timeOut - limiting how long we wait
      Returns:
      the (new) directoryName of the specified backup
      Throws:
      Exception
      See Also:
    • waitForDifferentBackupDir

      public String waitForDifferentBackupDir(String directoryName, int timeLimitInSeconds) throws Exception
      Convinience wrapper
      Throws:
      Exception
      See Also:
    • waitForDifferentBackupDir

      public String waitForDifferentBackupDir(String directoryName, org.apache.solr.util.TimeOut timeOut) throws Exception
      Polls the replication handler's status until the it reports that any backup has completed as a "success" with a different "directoryName" then the one specified (in which case the method returns the new directoryName) or either an "exception" is reported or the timeOut expires (in either case an assertion is thrown)

      NOTE: this method is NOT suitable/safe to use in a test where multiple backups are being taken/deleted concurrently, because the replication handler API provides no reliable way to determine if the most recently reported status to the a particular backup request.

      Parameters:
      directoryName - to compare to, may be null
      timeOut - limiting how long we wait
      Returns:
      the (new) directoryName of the latests successful backup
      Throws:
      Exception
      See Also:
    • checkBackupSuccess

      public String checkBackupSuccess() throws Exception
      Does a single check of the replication handler's status to determine if the mostrecently completed backup was a success. Throws a test assertion failure if any "exception" message is ever encountered (The Replication Handler API does not make it possible to know which backup this exception was related to)

      NOTE: this method is NOT suitable/safe to use in a test where multiple backups are being taken/deleted concurrently, because the replication handler API provides no reliable way to determine if the most recently reported status to the a particular backup request.

      Returns:
      the "directoryName" of the backup if the response indicates that a is completed successfully, otherwise null
      Throws:
      Exception
    • checkBackupSuccess

      public String checkBackupSuccess(String backupName) throws Exception
      Does a single check of the replication handler's status to determine if the specified name matches the most recently completed backup, and if that backup was a success. Throws a test assertion failure if any "exception" message is ever encountered (The Replication Handler API does not make it possible to know which backup this exception was related to)
      Returns:
      the "directoryName" of the backup if the response indicates that the specified backupName is completed successfully, otherwise null
      Throws:
      Exception
      See Also:
    • waitForBackupDeletionSuccess

      public void waitForBackupDeletionSuccess(String backupName, int timeLimitInSeconds) throws Exception
      Convinience wrapper
      Throws:
      Exception
      See Also:
    • waitForBackupDeletionSuccess

      public void waitForBackupDeletionSuccess(String backupName, org.apache.solr.util.TimeOut timeOut) throws Exception
      Polls the replication handler's status until the it reports that the specified backupName is deleted or either "Unable to delete" status is reported or the timeOut expires (in either case an assertion is thrown)

      NOTE: this method is NOT suitable/safe to use in a test where multiple backups are being taken/deleted concurrently, because the replication handler API provides no reliable way to check the results of a specific backup before the results of another backup may overwrite them internally.

      Parameters:
      backupName - to look for in status
      timeOut - limiting how long we wait
      Throws:
      Exception
      See Also:
    • checkBackupDeletionSuccess

      public boolean checkBackupDeletionSuccess(String backupName) throws Exception
      Does a single check of the replication handler's status to determine if the specified name matches the most recently deleted backup, and if deleting that backup was a success. Throws a test assertion failure if the status is about this backupName but the starts message with "Unable to delete"
      Returns:
      true if the replication status info indicates the backup was deleted, false otherwise
      Throws:
      Exception
      See Also: