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 SummaryConstructors 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 SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckBackupDeletionSuccess(String backupName)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.StringcheckBackupSuccess()Does a single check of the replication handler's status to determine if the mostrecently completed backup was a success.StringcheckBackupSuccess(String backupName)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.voidwaitForBackupDeletionSuccess(String backupName, int timeLimitInSeconds)Convinience wrappervoidwaitForBackupDeletionSuccess(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 thetimeOutexpires (in either case an assertion is thrown)StringwaitForBackupSuccess(String backupName, int timeLimitInSeconds)Convinience wrapperStringwaitForBackupSuccess(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 thetimeOutexpires (in either case an assertion is thrown)StringwaitForDifferentBackupDir(String directoryName, int timeLimitInSeconds)Convinience wrapperStringwaitForDifferentBackupDir(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 thetimeOutexpires (in either case an assertion is thrown)
 
- 
- 
- 
Constructor Detail- 
BackupStatusCheckerpublic 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
 
 - 
BackupStatusCheckerpublic 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:
- BackupStatusChecker(SolrClient,String)
 
 
- 
 - 
Method Detail- 
waitForBackupSuccesspublic String waitForBackupSuccess(String backupName, int timeLimitInSeconds) throws Exception Convinience wrapper- Throws:
- Exception
- See Also:
- waitForBackupSuccess(String,TimeOut)
 
 - 
waitForBackupSuccesspublic 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 thetimeOutexpires (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:
- checkBackupSuccess(String)
 
 - 
waitForDifferentBackupDirpublic String waitForDifferentBackupDir(String directoryName, int timeLimitInSeconds) throws Exception Convinience wrapper- Throws:
- Exception
- See Also:
- waitForDifferentBackupDir(String,TimeOut)
 
 - 
waitForDifferentBackupDirpublic 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 thetimeOutexpires (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 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()
 
 - 
checkBackupSuccesspublic 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 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
 
 - 
checkBackupSuccesspublic 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:
- waitForBackupSuccess(String,TimeOut)
 
 - 
waitForBackupDeletionSuccesspublic void waitForBackupDeletionSuccess(String backupName, int timeLimitInSeconds) throws Exception Convinience wrapper- Throws:
- Exception
- See Also:
- waitForBackupDeletionSuccess(String,TimeOut)
 
 - 
waitForBackupDeletionSuccesspublic 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 thetimeOutexpires (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:
- checkBackupSuccess(String)
 
 - 
checkBackupDeletionSuccesspublic 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:
- waitForBackupDeletionSuccess(String,TimeOut)
 
 
- 
 
-