use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method make_missing_parents_references_parents_nodes_included.
/*
- 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_missing_parents_references_parents_nodes_included() {
createS1S2Tree();
final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("a2_1_1"), true);
assertNodes(result, ExpectedNodes.create().implicit("a2_1_1").parent("a2_1", "a2", "s1").referred("b2_1").parent("b2", "s2"));
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method exclude_all_children.
@Test
public void exclude_all_children() {
createS1S2Tree();
refresh();
final NodeIds children = NodeIds.from("a1", "a2", "a2_1", "a2_1_1", "b2_1", "b2", "s2");
ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), children, false);
assertNodes(result, ExpectedNodes.create().implicit("s1"));
result = resolveSyncWorkResult(NodeId.from("s1"), children, true);
assertNodes(result, ExpectedNodes.create().implicit("s1"));
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method resolve_with_include_children_a_2.
/*
- 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: A1
*/
@Test
public void resolve_with_include_children_a_2() throws Exception {
createS1S2Tree();
final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("a2"), true);
assertEquals(7, result.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method resolveDependenciesOfMovedNodes.
/**
* node2
* .....|
* .....node1 (Moved)
* ..........|
* ..........node1_1 (Moved)
* .................|
* ..................node1_1_1 (Moved)
* ...........................|
* ............................node1_1_1_1 (Moved)
*
* <p>
* Contents created below look like pic above.
* ResolveSyncWorkCommand will return all four when called both with includeChildren=true and with includeChildren=false
* 1) FindNodesWithVersionDifferenceCommand will returns only actual nodes that have Moved status (such like node1)...
* 2) ... though CompareContentCommand will return status Moved for all children of Moved content.
* 3) When includeChildren=false ResolveSyncWorkCommand will resolve all parents against the passed node.
* So ResolveSyncWorkCommand will return only "Moved" parents of passed node and passed node itself when includeChildren=false
*/
@Test
public void resolveDependenciesOfMovedNodes() {
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());
final Node node2 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2")).parent(NodePath.ROOT).name("node2").build());
pushNodes(WS_OTHER, node1.id(), node2.id(), node1_1.id(), node1_1_1.id(), node1_1_1_1.id());
moveNode(node1, node2.path());
final ResolveSyncWorkResult resultChildrenIncluded = resolveSyncWorkResult(node1_1_1_1.id(), true);
final ResolveSyncWorkResult resultChildrenNotIncluded = resolveSyncWorkResult(node1_1_1_1.id(), false);
assertEquals(resultChildrenIncluded.getSize(), 4);
assertEquals(resultChildrenNotIncluded.getSize(), 4);
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method resolve_with_include_children.
/*
- 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() throws Exception {
createS1S2Tree();
final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), true);
assertEquals(8, result.getSize());
}
Aggregations