use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class DiffBranchesHandler method execute.
@Override
public Object execute() {
final NodeId nodeId = getNodeId(this.nodeKey);
if (nodeId == null) {
throw new NodeNotFoundException("Node with key [" + this.nodeKey + "] not found");
}
final ResolveSyncWorkResult result = this.nodeService.resolveSyncWork(SyncWorkResolverParams.create().includeChildren(includeChildren).nodeId(nodeId).branch(targetBranch).build());
return new ResolveSyncWorkResultMapper(result);
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkPerformanceTest method testReferencePerformance.
@Disabled
@Test
public void testReferencePerformance() throws Exception {
final Node rootNode = createNode(CreateNodeParams.create().name("rootNode").parent(NodePath.ROOT).build(), false);
createNodes(rootNode, 40, 3, 1);
refresh();
final Stopwatch started = Stopwatch.createStarted();
final ResolveSyncWorkResult resolvedNodes = ResolveSyncWorkCommand.create().nodeId(rootNode.id()).target(WS_OTHER).indexServiceInternal(this.indexServiceInternal).storageService(this.storageService).searchService(this.searchService).build().execute();
started.stop();
System.out.println(resolvedNodes.getSize() + " in " + started);
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class PushNodesCommandPerformanceTest method testReferencePerformance.
@Disabled
@Test
public void testReferencePerformance() throws Exception {
final Node rootNode = createNode(CreateNodeParams.create().name("rootNode").parent(NodePath.ROOT).build(), false);
createNodes(rootNode, 20, 3, 1);
refresh();
final ResolveSyncWorkResult syncWork = ResolveSyncWorkCommand.create().nodeId(rootNode.id()).target(WS_OTHER).indexServiceInternal(this.indexServiceInternal).storageService(this.storageService).searchService(this.searchService).build().execute();
final Stopwatch started = Stopwatch.createStarted();
final PushNodesResult result = PushNodesCommand.create().ids(syncWork.getNodeComparisons().getNodeIds()).target(WS_OTHER).indexServiceInternal(this.indexServiceInternal).storageService(this.storageService).searchService(this.searchService).build().execute();
started.stop();
final long elapsed = started.elapsed(TimeUnit.SECONDS);
final int number = result.getSuccessful().getSize();
System.out.println("Pushed : " + number + " in " + started + ", " + (elapsed == 0 ? "n/a" : (number / elapsed) + "/s"));
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method do_not_publish_other_children_of_dependent_parent.
/*
- S1 (New)
- A1 (New)
- A2 (New)
- A2_1 - Ref:B2_1 (New)
- A2_1_1
- S2 (New)
- B1 (New)
- B2 (New)
- B2_1 (New)
- B2_2 (New)
Resolve: A2_1
*/
@Test
public void do_not_publish_other_children_of_dependent_parent() throws Exception {
createS1S2Tree();
// Add child-node to B2
createNode(CreateNodeParams.create().setNodeId(NodeId.from("b2_2")).parent(NodePath.create("/s2/b2").build()).name("b2_2").build());
final ResolveSyncWorkResult result = resolveSyncWorkResult("a2_1");
assertEquals(6, result.getSize());
assertNodes(result, ExpectedNodes.create().implicit("a2_1").parent("a2", "s1").referred("b2_1").parent("b2", "s2"));
}
use of com.enonic.xp.node.ResolveSyncWorkResult in project xp by enonic.
the class ResolveSyncWorkCommandTest method include_referred_nodes.
@Test
public void include_referred_nodes() 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"));
final Node node1_1 = createNode(CreateNodeParams.create().setNodeId(NodeId.from("node1_1")).parent(node1.path()).name("node1_1").data(node1_1_data).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 ResolveSyncWorkResult result = resolveSyncWorkResult(node1_1.id(), false);
assertNodes(result, ExpectedNodes.create().implicit(node1_1.id()).parent(node1.id()).referred(node2.id()));
}
Aggregations