use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method reference_to_another_branch_with_another_branch_reference.
/*
- Node1
- Node1_1 -> Ref2_1_1
- Node2 -> Ref3
- Node2_1
- Node2_1_1
- Node3 -> Ref:2_1
*/
@Test
public void reference_to_another_branch_with_another_branch_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("node3"));
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());
final PropertyTree node3_data = new PropertyTree();
node1_1_data.addReference("myRef", Reference.from("node2_1"));
final Node node3 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node3")).parent(NodePath.ROOT).name("node3").data(node3_data).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();
assertNodes(result, ExpectedNodes.create().implicit(node1.id()).child(node1_1.id()).referred(node2_1_1.id(), node3.id()).parent(node2_1.id(), node2.id()));
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method ignore_nodes_without_diff.
@Test
public void ignore_nodes_without_diff() 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 node2 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2")).parent(NodePath.ROOT).name("node2").build());
final Node node2_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2_1")).parent(node2.path()).name("node2_1").build());
final Node node3 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node3")).parent(NodePath.ROOT).name("node3").build());
pushNodes(WS_OTHER, node1.id(), node2.id(), node3.id());
final ResolveSyncWorkResult result = ResolveSyncWorkCommand.create().includeChildren(true).nodeId(getNodeByPath(NodePath.ROOT).id()).target(WS_OTHER).indexServiceInternal(this.indexServiceInternal).storageService(this.storageService).searchService(this.searchService).build().execute();
assertEquals(3, result.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method detect_children_marked_for_deletion.
@Test
public void detect_children_marked_for_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 node2 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2")).parent(NodePath.ROOT).name("node2").build());
final Node node2_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node2_1")).parent(node2.path()).name("node2_1").build());
final Node node3 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node3")).parent(NodePath.ROOT).name("node3").build());
pushNodes(WS_OTHER, node1.id(), node1_1.id(), node2.id(), node2_1.id(), node3.id());
markAsDelete(node2_1.id());
markAsDelete(node3.id());
final ResolveSyncWorkResult result = ResolveSyncWorkCommand.create().nodeId(ROOT_UUID).includeChildren(true).target(WS_OTHER).indexServiceInternal(this.indexServiceInternal).storageService(this.storageService).searchService(this.searchService).build().execute();
assertEquals(3, result.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method exclude_all.
@Test
public void exclude_all() {
createS1S2Tree();
refresh();
ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.from("s1", "a1", "a2", "a2_1", "a2_1_1", "b2_1", "b2", "s2"), true);
assertEquals(0, result.getNodeComparisons().getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method do_publish_new_dependencies_of_moved_parent.
@Test
public void do_publish_new_dependencies_of_moved_parent() throws Exception {
createS1S2Tree();
pushAllNodesInS1S2Tree();
updateNode("a2_1_1");
renameNode("a2_1", "newName");
createNode(NodePath.ROOT, "s3");
// Update parent node with new reference
updateNode(UpdateNodeParams.create().id(NodeId.from("a2_1")).editor((node) -> {
node.data.addReference("newRef", Reference.from("s3"));
}).build());
updateNode("b2_1");
final ResolveSyncWorkResult result = resolveSyncWorkResult("a2_1_1");
assertNodes(result, ExpectedNodes.create().parent("a2_1").referred("s3").implicit("a2_1_1"));
}
Aggregations