Search in sources :

Example 21 with ResolveSyncWorkResult

use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.

the class ResolveSyncWorkCommandTest method reference_has_been_moved_push_reference_not_parents_even_if_modified.

/*
    - S1 (E)
        - A1 (E)
 	    - A2 (E)
 	        - A2_1 - Ref:B2_1 (M)
 	          - A2_1_1
    - S2 (E)
        - B1 (E)
        - B2 (E)
 	        - B2_1 (M)

        Resolve: A2_1
     */
@Test
public void reference_has_been_moved_push_reference_not_parents_even_if_modified() throws Exception {
    createS1S2Tree();
    pushAllNodesInS1S2Tree();
    updateNode("a2_1");
    updateNode("b2");
    updateNode("b2_1");
    refresh();
    final ResolveSyncWorkResult result = resolveSyncWorkResult("a2_1");
    assertNodes(result, ExpectedNodes.create().implicit("a2_1").referred("b2_1"));
    assertEquals(2, result.getSize());
}
Also used : ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 22 with ResolveSyncWorkResult

use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.

the class ResolveSyncWorkCommandTest method deleted_child_dont_include_parent_deletion.

/**
 * Tries to resolve one of the nodes in the middle of tree of deleted nodes.
 *
 * @throws Exception
 */
@Test
public void deleted_child_dont_include_parent_deletion() throws Exception {
    final Node node1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1")).parent(NodePath.ROOT).name("node1").build());
    final Node node1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1_1")).parent(node1.path()).name("node1_1").build());
    final Node node1_1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1_1_1")).parent(node1_1.path()).name("node1_1_1").build());
    final Node node1_1_1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1_1_1_1")).parent(node1_1_1.path()).name("node1_1_1_1").build());
    pushNodes(WS_OTHER, node1.id(), node1_1.id(), node1_1_1.id(), node1_1_1_1.id());
    refresh();
    markAsDelete(node1.id());
    markAsDelete(node1_1.id());
    markAsDelete(node1_1_1.id());
    markAsDelete(node1_1_1_1.id());
    refresh();
    final ResolveSyncWorkResult result = ResolveSyncWorkCommand.create().nodeId(node1_1.id()).includeChildren(true).target(WS_OTHER).indexServiceInternal(this.indexServiceInternal).storageService(this.storageService).searchService(this.searchService).build().execute();
    assertEquals(3, result.getSize());
}
Also used : Node(com.enonic.xp.node.Node) ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 23 with ResolveSyncWorkResult

use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.

the class ResolveSyncWorkCommandTest method do_not_publish_dependencies_of_modified_parent.

@Test
public void do_not_publish_dependencies_of_modified_parent() throws Exception {
    createS1S2Tree();
    pushAllNodesInS1S2Tree();
    updateNode("a2_1_1");
    updateNode("a2_1");
    updateNode("b2_1");
    final ResolveSyncWorkResult result = resolveSyncWorkResult("a2_1_1");
    assertNodes(result, ExpectedNodes.create().implicit("a2_1_1"));
}
Also used : ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 24 with ResolveSyncWorkResult

use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.

the class ResolveSyncWorkCommandTest method reference_to_another_branch_with_back_reference.

@Test
public void reference_to_another_branch_with_back_reference() throws Exception {
    final Node node1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1")).parent(NodePath.ROOT).name("node1").build());
    final PropertyTree node1_1_data = new PropertyTree();
    node1_1_data.addReference("myRef", Reference.from("node2_1_1"));
    final Node node1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1_1")).parent(node1.path()).name("node1_1").data(node1_1_data).build());
    final PropertyTree node2_data = new PropertyTree();
    node2_data.addReference("myRef", Reference.from("node1_1"));
    final Node node2 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2")).parent(NodePath.ROOT).name("node2").data(node2_data).build());
    final Node node2_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2_1")).parent(node2.path()).name("node2_1").build());
    final Node node2_1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2_1_1")).parent(node2_1.path()).name("node2_1_1").build());
    createNode(CreateNodeParams.create().setNodeId(NodeId.from("node3")).parent(NodePath.ROOT).name("node3").build());
    final ResolveSyncWorkResult result = ResolveSyncWorkCommand.create().includeChildren(true).nodeId(node1.id()).target(WS_OTHER).indexServiceInternal(this.indexServiceInternal).storageService(this.storageService).searchService(this.searchService).build().execute();
    assertEquals(5, result.getSize());
}
Also used : Node(com.enonic.xp.node.Node) PropertyTree(com.enonic.xp.data.PropertyTree) ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 25 with ResolveSyncWorkResult

use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.

the class ResolveSyncWorkCommandTest method make_sure_referred_nodes_includes_parents_if_missing.

/*
      - S1 (New)
       - A1 (New)
       - A2 (New)
           - A2_1 - Ref:B2_1 (New)
             - A2_1_1
      - S2 (New)
       - B1 (New)
       - B2 (New)
           - B2_1 (New)
      */
@Test
public void make_sure_referred_nodes_includes_parents_if_missing() {
    createS1S2Tree();
    final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("a2_1"), true);
    assertNodes(result, ExpectedNodes.create().implicit("a2_1").child("a2_1_1").parent("a2", "s1").referred("b2_1").parent("b2", "s2"));
}
Also used : ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Aggregations

ResolveSyncWorkResult (com.enonic.xp.node.ResolveSyncWorkResult)44 Test (org.junit.jupiter.api.Test)39 Node (com.enonic.xp.node.Node)14 PropertyTree (com.enonic.xp.data.PropertyTree)3 NodeId (com.enonic.xp.node.NodeId)3 ContentId (com.enonic.xp.content.ContentId)2 NodeIds (com.enonic.xp.node.NodeIds)2 Stopwatch (com.google.common.base.Stopwatch)2 Disabled (org.junit.jupiter.api.Disabled)2 Branch (com.enonic.xp.branch.Branch)1 CompareContentResults (com.enonic.xp.content.CompareContentResults)1 CompareStatus (com.enonic.xp.content.CompareStatus)1 ContentIds (com.enonic.xp.content.ContentIds)1 ResolveSyncWorkResultMapper (com.enonic.xp.lib.node.mapper.ResolveSyncWorkResultMapper)1 NodeComparison (com.enonic.xp.node.NodeComparison)1 NodeNotFoundException (com.enonic.xp.node.NodeNotFoundException)1 PushNodesResult (com.enonic.xp.node.PushNodesResult)1 SyncWorkResolverParams (com.enonic.xp.node.SyncWorkResolverParams)1 JsonMapGenerator (com.enonic.xp.script.serializer.JsonMapGenerator)1 Preconditions (com.google.common.base.Preconditions)1