Search in sources :

Example 6 with SystemDumpResult

use of com.enonic.xp.dump.SystemDumpResult 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());
}
Also used : Repositories(com.enonic.xp.repository.Repositories) BranchDumpResult(com.enonic.xp.dump.BranchDumpResult) Node(com.enonic.xp.node.Node) SystemDumpResult(com.enonic.xp.dump.SystemDumpResult) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Example 7 with SystemDumpResult

use of com.enonic.xp.dump.SystemDumpResult in project xp by enonic.

the class DumpServiceImplTest method verify_result.

@Test
public void verify_result() 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().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());
}
Also used : BranchDumpResult(com.enonic.xp.dump.BranchDumpResult) Node(com.enonic.xp.node.Node) SystemDumpResult(com.enonic.xp.dump.SystemDumpResult) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Example 8 with SystemDumpResult

use of com.enonic.xp.dump.SystemDumpResult in project xp by enonic.

the class DumpServiceImplTest method dump_long_filename.

@Test
public void dump_long_filename() throws Exception {
    final String nodeName = "this-is-my-node-with-very-long-filename-more-than-100-characters-yes-it-has-to-be-very-long-indeed-sir";
    final Node node = createNode(NodePath.ROOT, nodeName);
    final SystemDumpResult systemDumpResult = NodeHelper.runAsAdmin(() -> this.dumpService.dump(SystemDumpParams.create().dumpName("testDump").build()));
    final BranchDumpResult result = systemDumpResult.get(TEST_REPO_ID).get(WS_DEFAULT);
    assertNotNull(result);
    assertEquals(2, result.getSuccessful());
    NodeHelper.runAsAdmin(() -> dumpDeleteAndLoad(true));
    final Node storedNode = this.nodeService.getById(node.id());
    assertNotNull(storedNode);
    assertEquals(nodeName, storedNode.name().toString());
}
Also used : BranchDumpResult(com.enonic.xp.dump.BranchDumpResult) Node(com.enonic.xp.node.Node) SystemDumpResult(com.enonic.xp.dump.SystemDumpResult) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Aggregations

SystemDumpResult (com.enonic.xp.dump.SystemDumpResult)8 Test (org.junit.jupiter.api.Test)6 BranchDumpResult (com.enonic.xp.dump.BranchDumpResult)4 Node (com.enonic.xp.node.Node)4 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)4 SystemDumpParams (com.enonic.xp.dump.SystemDumpParams)2 SystemDumpListenerImpl (com.enonic.xp.impl.server.rest.task.listener.SystemDumpListenerImpl)2 SystemDumpRequestJson (com.enonic.xp.impl.server.rest.model.SystemDumpRequestJson)1 DumpMeta (com.enonic.xp.repo.impl.dump.model.DumpMeta)1 Repositories (com.enonic.xp.repository.Repositories)1 AbstractRunnableTaskTest (com.enonic.xp.task.AbstractRunnableTaskTest)1 RunnableTask (com.enonic.xp.task.RunnableTask)1 Version (com.enonic.xp.util.Version)1