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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkBackupDeletionSuccess(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.String
checkBackupSuccess()
Does a single check of the replication handler's status to determine if the mostrecently completed backup was a success.String
checkBackupSuccess(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.void
waitForBackupDeletionSuccess(String backupName, int timeLimitInSeconds)
Convinience wrappervoid
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 thetimeOut
expires (in either case an assertion is thrown)String
waitForBackupSuccess(String backupName, int timeLimitInSeconds)
Convinience wrapperString
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 thetimeOut
expires (in either case an assertion is thrown)String
waitForDifferentBackupDir(String directoryName, int timeLimitInSeconds)
Convinience wrapperString
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 thetimeOut
expires (in either case an assertion is thrown)
-
-
-
Constructor Detail
-
BackupStatusChecker
public BackupStatusChecker(org.apache.solr.client.solrj.SolrClient client, String path)
- Parameters:
client
- the client to use in all requests, will not be closedpath
- 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:
BackupStatusChecker(SolrClient,String)
-
-
Method Detail
-
waitForBackupSuccess
public String waitForBackupSuccess(String backupName, int timeLimitInSeconds) throws Exception
Convinience wrapper- Throws:
Exception
- See Also:
waitForBackupSuccess(String,TimeOut)
-
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 thetimeOut
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 fortimeOut
- limiting how long we wait- Returns:
- the (new) directoryName of the specified backup
- Throws:
Exception
- See Also:
checkBackupSuccess(String)
-
waitForDifferentBackupDir
public String waitForDifferentBackupDir(String directoryName, int timeLimitInSeconds) throws Exception
Convinience wrapper- Throws:
Exception
- See Also:
waitForDifferentBackupDir(String,TimeOut)
-
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 thetimeOut
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 the most recently reported status to the a particular backup request.
- Parameters:
directoryName
- to compare to, may be nulltimeOut
- limiting how long we wait- Returns:
- the (new) directoryName of the latests successful backup
- Throws:
Exception
- See Also:
checkBackupSuccess()
-
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 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:
waitForBackupSuccess(String,TimeOut)
-
waitForBackupDeletionSuccess
public void waitForBackupDeletionSuccess(String backupName, int timeLimitInSeconds) throws Exception
Convinience wrapper- Throws:
Exception
- See Also:
waitForBackupDeletionSuccess(String,TimeOut)
-
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 thetimeOut
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 statustimeOut
- limiting how long we wait- Throws:
Exception
- See Also:
checkBackupSuccess(String)
-
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:
waitForBackupDeletionSuccess(String,TimeOut)
-
-