Search in sources :

Example 1 with RepoLoadResult

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());
}
Also used : BundleContext(org.osgi.framework.BundleContext) Context(com.enonic.xp.context.Context) InternalContext(com.enonic.xp.repo.impl.InternalContext) Repository(com.enonic.xp.repository.Repository) SystemLoadResult(com.enonic.xp.dump.SystemLoadResult) Node(com.enonic.xp.node.Node) VersionsLoadResult(com.enonic.xp.dump.VersionsLoadResult) RepoLoadResult(com.enonic.xp.dump.RepoLoadResult) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Example 2 with RepoLoadResult

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();
}
Also used : BranchLoadResult(com.enonic.xp.dump.BranchLoadResult) RepoLoadResult(com.enonic.xp.dump.RepoLoadResult) NodeImportResult(com.enonic.xp.export.NodeImportResult)

Example 3 with RepoLoadResult

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();
}
Also used : Branch(com.enonic.xp.branch.Branch) RepoLoadResult(com.enonic.xp.dump.RepoLoadResult) NodeImportResult(com.enonic.xp.export.NodeImportResult)

Aggregations

RepoLoadResult (com.enonic.xp.dump.RepoLoadResult)3 NodeImportResult (com.enonic.xp.export.NodeImportResult)2 Branch (com.enonic.xp.branch.Branch)1 Context (com.enonic.xp.context.Context)1 BranchLoadResult (com.enonic.xp.dump.BranchLoadResult)1 SystemLoadResult (com.enonic.xp.dump.SystemLoadResult)1 VersionsLoadResult (com.enonic.xp.dump.VersionsLoadResult)1 Node (com.enonic.xp.node.Node)1 InternalContext (com.enonic.xp.repo.impl.InternalContext)1 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)1 Repository (com.enonic.xp.repository.Repository)1 Test (org.junit.jupiter.api.Test)1 BundleContext (org.osgi.framework.BundleContext)1