use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method publish_duplicate_of_original_do_not_publish_original.
/*
- S1 (New)
- A1 (New)
- A2 (New)
- A2_1 - Ref:B2_1 (New)
- A2_1_1
- S2 (New)
- B1 (New)
- B2 (New)
- B2_1 (New)
- S1d (New)
- A1d (New)
- A2d (New)
- A2_1d - Ref:B2_1 (New)
*/
@Test
public void publish_duplicate_of_original_do_not_publish_original() throws Exception {
createS1S2Tree();
final Node s1d = duplicateNode(getNodeById(NodeId.from("s1")));
getNodeByPath(NodePath.create("/s1-copy/a1").build());
getNodeByPath(NodePath.create("/s1-copy/a2").build());
getNodeByPath(NodePath.create("/s1-copy/a2/a2_1").build());
refresh();
final ResolveSyncWorkResult result = resolveSyncWorkResult(s1d.id(), true);
assertEquals(8, result.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method reference_moved_must_be_pushed.
/*
- S1 (E)
- A1 (E)
- A2 (M)
- A2_1 - Ref:B2_1 (M)
- S2 (Moved)
- B1 (E)
- B2 (E)
- B2_1 (Moved to S2)
Resolve A2_1
*/
@Test
public void reference_moved_must_be_pushed() throws Exception {
createS1S2Tree();
pushAllNodesInS1S2Tree();
updateNode("a2_1");
moveNode("b2_1", NodePath.create("/s2").build(), "b2_1");
final ResolveSyncWorkResult result = resolveSyncWorkResult("a2_1");
assertEquals(2, result.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method resolveDependenciesOfMovedNodes2.
/**
* 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 node1_1_1 and two of its parents 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 resolveDependenciesOfMovedNodes2() {
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.id(), true);
final ResolveSyncWorkResult resultChildrenNotIncluded = resolveSyncWorkResult(node1_1_1.id(), false);
assertEquals(4, resultChildrenIncluded.getSize());
// Should be 4 IMO. Has been discussed internally and left as it is for now
assertEquals(3, resultChildrenNotIncluded.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method exclude_child_with_refs.
/*
- 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_child_with_refs() {
createS1S2Tree();
refresh();
final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.from("a2_1_1", "a2_1"), true);
assertNodes(result, ExpectedNodes.create().implicit("s1").child("a1", "a2"));
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method publish_root_all_new.
/*
- S1 (N)
- A1 (N)
- A2 (N)
- A2_1 - Ref:B2_1 (N)
- S2 (N)
- B1 (N)
- B2 (N)
- B2_1 (N)
Resolve: Root
*/
@Test
public void publish_root_all_new() {
createS1S2Tree();
final ResolveSyncWorkResult results = resolveSyncWorkResult(getNodeByPath(NodePath.ROOT).id(), true);
assertEquals(10, results.getSize());
/*
final String rootNodeId = RootNode.UUID.toString();
assertRequested( requests, rootNodeId );
assertChildOf( requests, "s1", rootNodeId );
assertChildOf( requests, "a1", "s1" );
assertChildOf( requests, "a2", "s1" );
assertChildOf( requests, "a2_1", "a2" );
assertChildOf( requests, "s2", rootNodeId );
assertChildOf( requests, "b1", "s2" );
assertChildOf( requests, "b2", "s2" );
assertChildOf( requests, "b2_1", "b2" );
*/
}
Aggregations