Search in sources :

Example 31 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method exclude_referencies_in_the_middle.

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

Example 32 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method resolve_with_include_children_a1.

/*
            - S1 (New)
             - A1 (New)
             - A2 (New)
                 - A2_1 - Ref:B2_1 (New)
                   - A2_1_1
            - S2 (New)
             - B1 (New)
             - B2 (New)
                 - B2_1 (New)
            Resolve: S1
        */
@Test
public void resolve_with_include_children_a1() throws Exception {
    createS1S2Tree();
    final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("a1"), true);
    assertEquals(2, result.getSize());
}
Also used : ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 33 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method pending_delete_with_children_and_reference.

/*
    - S1 (New)
      - A1 (New)
      - A2 (New)
         - A2_1 - Ref:B2_1 (New)
    - S2 (New)
      - B1 (New)
      - B2 (New)
         - B2_1 (New)
    - S1d (New)
      - A1d (New)
      - A2d (New)
        - A2_1d - Ref:B2_1 (New)
    */
@Test
public void pending_delete_with_children_and_reference() {
    createS1S2Tree();
    ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), true);
    assertEquals(8, result.getSize());
    pushAllNodesInS1S2Tree();
    markAsDelete(NodeId.from("s1"));
    markAsDelete(NodeId.from("s2"));
    refresh();
    // Since this is pending delete, it should force-include the children even it the commands give "false"
    result = resolveSyncWorkResult(NodeId.from("s1"), false);
    assertNodes(result, ExpectedNodes.create().implicit("s1").child("a1", "a2", "a2_1", "a2_1_1").referred("b2_1"));
    result = resolveSyncWorkResult(NodeId.from("s1"), true);
    assertNodes(result, ExpectedNodes.create().implicit("s1").child("a1", "a2", "a2_1", "a2_1_1").referred("b2_1"));
}
Also used : ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 34 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method exclude_referencies.

@Test
public void exclude_referencies() {
    createS1S2Tree();
    refresh();
    final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.from("b2_1"), true);
    assertNodes(result, ExpectedNodes.create().implicit("s1").child("a1", "a2", "a2_1", "a2_1_1"));
}
Also used : ResolveSyncWorkResult(com.enonic.xp.node.ResolveSyncWorkResult) Test(org.junit.jupiter.api.Test)

Example 35 with ResolveSyncWorkResult

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

the class ResolveSyncWorkCommandTest method exclude_itself.

/*
        - S1
          - A1
          - A2
             - A2_1 - Ref:B2_1
        - S2
          - B1
          - B2
             - B2_1
        - S1d (New)
          - A1d
          - A2d
            - A2_1 - Ref:B2_1
        */
@Test
public void exclude_itself() {
    createS1S2Tree();
    refresh();
    ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.from("s1"), true);
    assertNodes(result, ExpectedNodes.create().child("a1", "a2", "a2_1", "a2_1_1").referred("b2_1").parent("b2", "s2", "s1"));
    result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.from("s1"), false);
    assertNodes(result, ExpectedNodes.create());
}
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