RepositoryBackupChain bch = backup.startBackup(config);
waitEndOfBackup(bch);
backup.stopBackup(bch);
// restore with RepositoryCreatorService
RepositoryCreationService creatorService =
(RepositoryCreationService)container.getComponentInstanceOfType(RepositoryCreationService.class);
assertNotNull(creatorService);
String tenantName = "tenant_4";
String repoToken = creatorService.reserveRepositoryName(tenantName);
// restore
RepositoryEntry newRE =
helper.createRepositoryEntry(false, repository.getConfiguration().getSystemWorkspaceName(), tenantName);
newRE.setName(tenantName);
WorkspaceEntry newWSEntry = helper.createWorkspaceEntry(false, tenantName);
newWSEntry.setName(wsEntry.getName());
newRE.addWorkspace(newWSEntry);
creatorService.createRepository(bch.getBackupId(), newRE, repoToken, creationProps);
// check
ManageableRepository restoredRepository = repositoryService.getRepository(tenantName);
assertNotNull(restoredRepository);
checkConent(restoredRepository, wsEntry.getName());
//check repositoryConfiguration
RepositoryService repoService = (RepositoryService)this.container.getComponentInstance(RepositoryService.class);
assertNotNull(repoService.getConfig().getRepositoryConfiguration(tenantName));
log.info("Node1: Repository has been created");
Thread.sleep(60000);
// remove repository
try
{
creatorService.removeRepository(tenantName, false);
fail("Exception should be thrown");
}
catch (RepositoryCreationException e)
{
// repository in use
}
// remove repository
creatorService.removeRepository(tenantName, true);
try
{
repoService.getRepository(tenantName);
fail("Exception should be thrown");