use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method not_include_dependencies.
/*
* s1
** a1
** a2
*** a2_1 -> b2_1
**** a2_1_1
* s2
** b1
** b2
*** b2_1
*/
@Test
public void not_include_dependencies() {
createS1S2Tree();
refresh();
final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.empty(), true, false);
assertNodes(result, ExpectedNodes.create().implicit("s1").child("a1", "a2", "a2_1", "a2_1_1"));
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommand method execute.
public ResolveSyncWorkResult execute() {
RefreshCommand.create().indexServiceInternal(this.indexServiceInternal).refreshMode(RefreshMode.ALL).build().execute();
getAllPossibleNodesToBePublished();
final ResolveSyncWorkResult result = this.result.build();
return result;
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method publish_original_with_duplicate_do_not_publish_duplicate.
/*
- S1 (New) s
- 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)
Duplicate S1, then publish S1
Should publish S1, A1, A2, A2_1, B2_1, B2, S2
*/
@Test
public void publish_original_with_duplicate_do_not_publish_duplicate() throws Exception {
createS1S2Tree();
duplicateNode(getNodeById(NodeId.from("s1")));
final ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), true);
assertEquals(8, result.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method resolveDependenciesOfMovedNodes3.
/**
* node1 (Equal)
* .....|
* .....node1_1 (Equal)
* node2 (Equal)
* .....|
* .....node1_1_1 (Moved)
* ..............|
* ..............node1_1_1_1 (Moved)
* <p>
* Contents created below look like pic above.
* ResolveSyncWorkCommand will return node1_1_1 for node1_1_1.id() 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 resolveDependenciesOfMovedNodes3() {
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_1_1, node2.path());
refresh();
final ResolveSyncWorkResult resultChildrenIncluded = resolveSyncWorkResult(node1_1_1.id(), true);
final ResolveSyncWorkResult resultChildrenNotIncluded = resolveSyncWorkResult(node1_1_1.id(), false);
assertEquals(2, resultChildrenIncluded.getSize());
// Should be 2 IMO. Has been discussed internally and left as it is for now
assertEquals(1, resultChildrenNotIncluded.getSize());
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method exclude_empty.
@Test
public void exclude_empty() {
createS1S2Tree();
refresh();
ResolveSyncWorkResult result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.empty(), false);
assertEquals(1, result.getSize());
assertNodes(result, ExpectedNodes.create().implicit("s1"));
result = resolveSyncWorkResult(NodeId.from("s1"), NodeIds.empty(), true);
assertEquals(8, result.getSize());
}
Aggregations