use of com.enonic.xp.dump.VersionsLoadResult in project xp by enonic.
the class AbstractDumpReader method loadVersions.
@Override
public VersionsLoadResult loadVersions(final RepositoryId repositoryId, final LineProcessor<EntryLoadResult> processor) {
final PathRef tarFile = filePaths.versionMetaPath(repositoryId);
listener.loadingVersions(repositoryId);
final VersionsLoadResult.Builder builder = VersionsLoadResult.create();
if (!exists(tarFile)) {
return builder.build();
}
final EntriesLoadResult result = doLoadEntries(processor, tarFile);
return builder.successful(result.getSuccessful()).errors(result.getErrors().stream().map(error -> LoadError.error(error.getMessage())).collect(Collectors.toList())).build();
}
use of com.enonic.xp.dump.VersionsLoadResult 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());
}
Aggregations