protected void repositoryBackupRestoreDirectlyOverJobExistingRepositoryRestore(String repositoryName)
throws Exception
{
addConent(repositoryName);
BackupManagerImpl backupManagerImpl = (BackupManagerImpl)getBackupManager();
backupManagerImpl.start();
File backDir = new File("target/backup/" + repositoryName);
backDir.mkdirs();
RepositoryBackupConfig config = new RepositoryBackupConfig();
config.setRepository(repositoryName);
config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
config.setBackupDir(backDir);
RepositoryBackupChain bch = backupManagerImpl.startBackup(config);
// wait till full backup will stop
while (bch.getState() != BackupJob.FINISHED)
{
Thread.yield();
Thread.sleep(30);
}
if (bch != null)
{
backupManagerImpl.stopBackup(bch);
}
// restore
RepositoryBackupChainLog rblog = new RepositoryBackupChainLog(new File(bch.getLogFilePath()));