use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method test_pending_publish_master.
@Test
public void test_pending_publish_master() throws Exception {
authorizedMasterContext().callWith(() -> {
final FindContentIdsByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().plus(Duration.ofDays(1))).build());
assertEquals(0, result.getTotalHits());
return null;
});
}
use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method root_content.
@Test
public void root_content() throws Exception {
createContent(ContentPath.ROOT);
createContent(ContentPath.ROOT);
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentIdsByParentResult result = contentService.findIdsByParent(FindContentByParentParams.create().from(0).size(30).parentPath(null).build());
assertNotNull(result);
assertEquals(2, result.getTotalHits());
}
use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method root_children.
@Test
public void root_children() throws Exception {
final Content parentContent = createContent(ContentPath.ROOT);
final Content content1 = createContent(parentContent.getPath());
final Content content2 = createContent(parentContent.getPath());
final Content content3 = createContent(parentContent.getPath());
final ContentPath parentContentPath = parentContent.getPath();
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(30).parentPath(parentContentPath).build();
final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
assertNotNull(result);
assertEquals(3, result.getTotalHits());
}
use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method params_size_one.
@Test
public void params_size_one() throws Exception {
final Content parentContent = createContent(ContentPath.ROOT);
createContent(parentContent.getPath());
createContent(parentContent.getPath());
createContent(parentContent.getPath());
final ContentPath parentContentPath = parentContent.getPath();
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(1).parentPath(parentContentPath).build();
final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
assertNotNull(result);
assertEquals(1, result.getHits());
assertEquals(3, result.getTotalHits());
assertEquals(1, result.getContentIds().getSize());
}
use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method params_from.
@Test
public void params_from() throws Exception {
final Content parentContent = createContent(ContentPath.ROOT);
createContent(parentContent.getPath());
createContent(parentContent.getPath());
createContent(parentContent.getPath());
createContent(parentContent.getPath());
final ContentPath parentContentPath = parentContent.getPath();
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().from(2).parentPath(parentContentPath).build();
final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
assertNotNull(result);
assertEquals(2, result.getHits());
assertEquals(4, result.getTotalHits());
assertEquals(2, result.getContentIds().getSize());
}
Aggregations