use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method invalid_parent_path.
@Test
public void invalid_parent_path() throws Exception {
final Content rootContent = createContent(ContentPath.ROOT);
final Content childrenLevel1 = createContent(rootContent.getPath());
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(30).parentPath(ContentPath.from("/test_invalid_path")).build();
final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
assertNotNull(result);
assertEquals(0, result.getTotalHits());
}
use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method root_no_content.
@Test
public void root_no_content() throws Exception {
final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(30).parentPath(null).build();
final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
assertNotNull(result);
assertEquals(0, result.getTotalHits());
}
use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method deep_children.
@Test
public void deep_children() throws Exception {
final Content rootContent = createContent(ContentPath.ROOT);
final Content childrenLevel1 = createContent(rootContent.getPath());
final Content childrenLevel2_1 = createContent(childrenLevel1.getPath());
final Content childrenLevel2_2 = createContent(childrenLevel1.getPath());
final Content childrenLevel2_3 = createContent(childrenLevel1.getPath());
final ContentPath parentContentPath = childrenLevel1.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_from_beyond.
@Test
public void params_from_beyond() throws Exception {
final Content parentContent = createContent(ContentPath.ROOT);
createContent(parentContent.getPath());
createContent(parentContent.getPath());
createContent(parentContent.getPath());
refresh();
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentIdsByParentResult result = contentService.findIdsByParent(FindContentByParentParams.create().from(10).parentPath(parentContent.getPath()).build());
assertNotNull(result);
assertEquals(0, result.getHits());
assertEquals(3, result.getTotalHits());
assertTrue(result.getContentIds().isEmpty());
}
use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method test_published_master.
@Test
public void test_published_master() throws Exception {
authorizedMasterContext().callWith(() -> {
final FindContentIdsByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().minus(Duration.ofDays(1))).to(Instant.now().plus(Duration.ofDays(1))).build());
assertEquals(1, result.getTotalHits());
return null;
});
}
Aggregations