use of com.enonic.xp.repository.Repositories in project xp by enonic.
the class DumpServiceImplTest method repositories_loaded.
@Test
public void repositories_loaded() throws Exception {
final Repositories repositoriesBefore = NodeHelper.runAsAdmin(this::doListRepositories);
NodeHelper.runAsAdmin(() -> dumpDeleteAndLoad(true));
final Repositories repositoriesAfter = NodeHelper.runAsAdmin(this::doListRepositories);
assertEquals(repositoriesBefore.getIds(), repositoriesAfter.getIds());
}
use of com.enonic.xp.repository.Repositories in project xp by enonic.
the class DumpServiceImplTest method obsolete_repository_deleted.
@Test
public void obsolete_repository_deleted() throws Exception {
final AccessControlList newRepoACL = AccessControlList.create().add(AccessControlEntry.create().principal(RoleKeys.EVERYONE).allowAll().build()).build();
final Repository newRepoInsideDump = NodeHelper.runAsAdmin(() -> doCreateRepository(RepositoryId.from("new-repo-inside-dump"), newRepoACL, ChildOrder.manualOrder()));
NodeHelper.runAsAdmin(() -> doDump(SystemDumpParams.create().dumpName("myTestDump").build()));
final Repository newRepoOutsideDump = NodeHelper.runAsAdmin(() -> doCreateRepository(RepositoryId.from("new-repo-outside-dump"), newRepoACL, ChildOrder.manualOrder()));
final Repositories oldRepos = NodeHelper.runAsAdmin(this::doListRepositories);
NodeHelper.runAsAdmin(this::doLoad);
final Repositories newRepos = NodeHelper.runAsAdmin(this::doListRepositories);
assertEquals(6, oldRepos.getIds().getSize());
assertEquals(5, newRepos.getIds().getSize());
assertNotNull(newRepos.getRepositoryById(newRepoInsideDump.getId()));
assertNull(newRepos.getRepositoryById(newRepoOutsideDump.getId()));
}
use of com.enonic.xp.repository.Repositories in project xp by enonic.
the class DumpServiceImplTest method zip_unzip.
@Test
public void zip_unzip() throws Exception {
final Node node = createNode(NodePath.ROOT, "myNode");
updateNode(node);
updateNode(node);
updateNode(node);
refresh();
final SystemDumpResult systemDumpResult = NodeHelper.runAsAdmin(() -> this.dumpService.dump(SystemDumpParams.create().archive(true).includeVersions(true).dumpName("testDump").build()));
// 4 of node, 1 of root
assertEquals(5, systemDumpResult.get(TEST_REPO_ID).getVersions());
final BranchDumpResult branchDumpResult = systemDumpResult.get(TEST_REPO_ID).get(WS_DEFAULT);
assertEquals(2, branchDumpResult.getSuccessful());
NodeHelper.runAsAdmin(() -> this.dumpService.load(SystemLoadParams.create().archive(true).includeVersions(true).dumpName("testDump").build()));
final Repositories newRepos = NodeHelper.runAsAdmin(this::doListRepositories);
assertEquals(RepositoryIds.from(RepositoryId.from("com.enonic.cms.test"), RepositoryId.from("system-repo"), RepositoryId.from("system.auditlog"), RepositoryId.from("system.scheduler")), newRepos.getIds());
}
use of com.enonic.xp.repository.Repositories in project xp by enonic.
the class LoadRunnableTask method doLoadFromExport.
private SystemLoadResultJson doLoadFromExport(final Path rootDir) {
final SystemLoadResult.Builder builder = SystemLoadResult.create();
final Repositories repositories = repositoryService.list();
final long branchesCount = repositories.stream().flatMap(repository -> repository.getBranches().stream()).count();
loadDumpListener.totalBranches(branchesCount);
builder.add(importSystemRepo(rootDir));
this.repositoryService.invalidateAll();
for (Repository repository : repositories) {
initializeRepo(repository);
builder.add(importRepoBranches(rootDir, repository));
}
return SystemLoadResultJson.from(builder.build());
}
Aggregations