Search in sources :

Example 6 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method do_not_publish_dependencies_of_equal_parent.

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

      Resolve: A2_1
    */
@Test
public void do_not_publish_dependencies_of_equal_parent() throws Exception {
    createS1S2Tree();
    pushAllNodesInS1S2Tree();
    updateNode("a2_1_1");
    moveNode("b2_1", NodePath.create("/s2/b2").build(), "b2_1_renamed");
    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 7 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method modified_parent_should_not_be_pushed.

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

Example 8 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method change_child_order_manual_yields_children_changed.

@Test
public void change_child_order_manual_yields_children_changed() {
    final Node node1 = createNode(NodePath.ROOT, "node1");
    createNode(node1.path(), "node1_1");
    createNode(node1.path(), "node1_2");
    createNode(node1.path(), "node1_3");
    createNode(node1.path(), "node1_4");
    pushNodes(NodeIds.from(ROOT_UUID.toString(), "node1", "node1_1", "node1_2", "node1_3", "node1_4"), WS_OTHER);
    SetNodeChildOrderCommand.create().nodeId(node1.id()).childOrder(ChildOrder.manualOrder()).indexServiceInternal(this.indexServiceInternal).searchService(this.searchService).storageService(this.storageService).build().execute();
    final ResolveSyncWorkResult result = resolveSyncWorkResult(node1.id(), NodeIds.empty(), true, false);
    assertNodes(result, ExpectedNodes.create().implicit(node1.id()).child("node1_1", "node1_2", "node1_3", "node1_4"));
}
Also used : Node(com.enonic.xp.node.Node) ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 9 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method reference_and_parents_has_been_moved_must_push_reference_and_parents.

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

        Resolve: a2_1
 	 */
@Test
public void reference_and_parents_has_been_moved_must_push_reference_and_parents() throws Exception {
    createS1S2Tree();
    pushAllNodesInS1S2Tree();
    updateNode("a2_1");
    moveNode("s2", NodePath.ROOT, "s2edit");
    final ResolveSyncWorkResult result = resolveSyncWorkResult("a2_1");
    assertNodes(result, ExpectedNodes.create().implicit("a2_1").referred("b2_1").parent("b2", "s2"));
}
Also used : ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 10 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method duplicate_node_with_reference_then_resolve.

@Test
public void duplicate_node_with_reference_then_resolve() throws Exception {
    final Node node1 = createNode(CreateNodeParams.create().parent(NodePath.ROOT).name("node1").data(createDataWithReferences(Reference.from("node1_1-id"), Reference.from("node1_1_1-id"))).build());
    final Node node1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1_1-id")).parent(node1.path()).name("node1_1").data(createDataWithReferences(Reference.from("node1_1_1-id"))).build());
    final Node node_1_1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1_1_1-id")).parent(node1_1.path()).name("node1_1_1").build());
    refresh();
    final Node node1Duplicate = duplicateNode(node1);
    refresh();
    final ResolveSyncWorkResult result = ResolveSyncWorkCommand.create().includeChildren(true).nodeId(node1Duplicate.id()).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)

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