use of com.enonic.xp.node.Node in project xp by enonic.
the class VersionTableVacuumTaskTest method version_not_deleted_in_all_branches.
@Test
void version_not_deleted_in_all_branches() {
final Node node1 = createNode(NodePath.ROOT, "node1");
pushNodes(NodeIds.from(node1.id()), WS_OTHER);
refresh();
this.nodeService.deleteById(node1.id());
refresh();
assertVersions(node1.id(), 1);
final VacuumTaskResult result = NodeHelper.runAsAdmin(() -> this.task.execute(VacuumTaskParams.create().ageThreshold(NEGATIVE_AGE_THRESHOLD_MILLIS).build()));
refresh();
assertEquals(12, result.getProcessed());
// Old version of CMS repository entry is also delete. Set to 0 when config to specify repository is implemented
assertEquals(1, result.getDeleted());
assertVersions(node1.id(), 1);
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class VersionTableVacuumTaskTest method version_deleted_in_all_branches.
@Test
void version_deleted_in_all_branches() {
final Node node1 = createNode(NodePath.ROOT, "node1");
pushNodes(NodeIds.from(node1.id()), WS_OTHER);
refresh();
this.nodeService.deleteById(node1.id());
ctxOther().runWith(() -> this.nodeService.deleteById(node1.id()));
refresh();
assertVersions(node1.id(), 1);
final VacuumTaskResult result = NodeHelper.runAsAdmin(() -> this.task.execute(VacuumTaskParams.create().ageThreshold(NEGATIVE_AGE_THRESHOLD_MILLIS).build()));
refresh();
assertEquals(12, result.getProcessed());
// Old version of CMS repository entry is also delete. Set to 1 when config to specify repository is implemented
assertEquals(2, result.getDeleted());
assertVersions(node1.id(), 0);
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class VersionTableVacuumTaskTest method age_threshold.
@Test
void age_threshold() {
final Node node1 = createNode(NodePath.ROOT, "node1");
updateNode(node1.id(), 2);
doDeleteNode(node1.id());
refresh();
assertVersions(node1.id(), 3);
final VacuumTaskResult result = NodeHelper.runAsAdmin(() -> this.task.execute(VacuumTaskParams.create().ageThreshold(Duration.of(1, ChronoUnit.HOURS).toMillis()).build()));
refresh();
assertEquals(0, result.getProcessed());
assertEquals(0, result.getDeleted());
assertVersions(node1.id(), 3);
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class ConnectNodeTest method mockCreateNode.
private void mockCreateNode() {
final Node node = createNode();
Mockito.when(this.nodeService.create(Mockito.isA(CreateNodeParams.class))).thenReturn(node);
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class GetBinaryStreamHandlerTest method mockGetBinary.
private void mockGetBinary() {
final Node node = createNode();
Mockito.when(this.nodeService.getByPath(NodePath.create("/myNode").build())).thenReturn(node);
Mockito.when(this.nodeService.getBinary(Mockito.isA(NodeId.class), Mockito.isA(BinaryReference.class))).thenReturn(ByteSource.wrap("this is a binary file".getBytes()));
}
Aggregations