use of com.enonic.xp.dump.RepoLoadResult in project xp by enonic.
the class DumpServiceImplTest method number_of_versions_in_other_repo.
@Test
public void number_of_versions_in_other_repo() {
final Repository myRepo = NodeHelper.runAsAdmin(() -> doCreateRepository(RepositoryId.from("myrepo"), AccessControlList.create().add(AccessControlEntry.create().principal(ctxDefault().getAuthInfo().getUser().getKey()).allowAll().build()).build(), null));
final Context myRepoContext = ContextBuilder.from(ContextAccessor.current()).repositoryId(myRepo.getId()).branch(RepositoryConstants.MASTER_BRANCH).build();
final Node myNode = myRepoContext.callWith(() -> createNode(NodePath.ROOT, "myNode"));
myRepoContext.runWith(() -> updateNode(myNode));
myRepoContext.runWith(() -> updateNode(myNode));
myRepoContext.runWith(() -> updateNode(myNode));
final SystemLoadResult dumpResult = NodeHelper.runAsAdmin(() -> dumpDeleteAndLoad(true, SystemDumpParams.create().dumpName("myTestDump").build()));
final RepoLoadResult repoLoadResult = getRepoLoadResult(dumpResult, myRepo.getId());
final VersionsLoadResult versionsLoadResult = repoLoadResult.getVersionsLoadResult();
assertNotNull(versionsLoadResult);
// One for root, 4 for myNode
assertEquals(5, versionsLoadResult.getSuccessful());
}
use of com.enonic.xp.dump.RepoLoadResult in project xp by enonic.
the class LoadRunnableTask method importSystemRepo.
private RepoLoadResult importSystemRepo(final Path rootDir) {
final RepoLoadResult.Builder builder = RepoLoadResult.create(SystemConstants.SYSTEM_REPO_ID);
final NodeImportResult systemRepoImport = importRepoBranch(SystemConstants.SYSTEM_REPO_ID.toString(), SystemConstants.BRANCH_SYSTEM.toString(), rootDir);
final BranchLoadResult branchLoadResult = NodeImportResultTranslator.translate(systemRepoImport, SystemConstants.BRANCH_SYSTEM);
builder.add(branchLoadResult);
return builder.build();
}
use of com.enonic.xp.dump.RepoLoadResult in project xp by enonic.
the class LoadRunnableTask method importRepoBranches.
private RepoLoadResult importRepoBranches(final Path rootDir, final Repository repository) {
final RepoLoadResult.Builder builder = RepoLoadResult.create(repository.getId());
for (Branch branch : repository.getBranches()) {
if (isSystemRepoMaster(repository, branch)) {
continue;
}
final NodeImportResult nodeImportResult = importRepoBranch(repository.getId().toString(), branch.getValue(), rootDir);
builder.add(NodeImportResultTranslator.translate(nodeImportResult, branch));
}
return builder.build();
}
Aggregations