use of com.enonic.xp.content.FindContentByParentParams in project xp by enonic.
the class ContentServiceImplTest_findByParent method hasChildResolved.
@Test
public void hasChildResolved() throws Exception {
final Content parentContent = createContent(ContentPath.ROOT);
final Content content1 = createContent(parentContent.getPath());
createContent(content1.getPath());
final ContentPath parentContentPath = parentContent.getPath();
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(30).parentPath(parentContentPath).build();
final FindContentByParentResult result = contentService.findByParent(params);
assertNotNull(result);
assertEquals(1, result.getTotalHits());
final Content content1Result = result.getContents().getContentById(content1.getId());
assertTrue(content1Result.hasChildren());
}
use of com.enonic.xp.content.FindContentByParentParams in project xp by enonic.
the class ContentServiceImplTest_findByParent 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 FindContentByParentResult result = contentService.findByParent(params);
assertNotNull(result);
assertEquals(2, result.getHits());
assertEquals(4, result.getTotalHits());
assertEquals(2, result.getContents().getSize());
}
use of com.enonic.xp.content.FindContentByParentParams in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method hasChildResolved.
@Test
public void hasChildResolved() throws Exception {
final Content parentContent = createContent(ContentPath.ROOT);
final Content content1 = createContent(parentContent.getPath());
createContent(content1.getPath());
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(30).parentId(parentContent.getId()).build();
final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
assertNotNull(result);
assertEquals(1, result.getTotalHits());
final Content content1Result = this.contentService.getById(result.getContentIds().first());
assertTrue(content1Result.hasChildren());
}
use of com.enonic.xp.content.FindContentByParentParams in project xp by enonic.
the class ContentServiceImplTest_findByParent method createAndFindContent.
private FindContentByParentResult createAndFindContent(final ContentPublishInfo publishInfo) throws Exception {
createContent(ContentPath.ROOT, publishInfo);
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().parentPath(ContentPath.ROOT).build();
return contentService.findByParent(params);
}
use of com.enonic.xp.content.FindContentByParentParams in project xp by enonic.
the class ContentServiceImplTest_findByParent 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 FindContentByParentResult result = contentService.findByParent(params);
assertNotNull(result);
assertEquals(0, result.getTotalHits());
}
Aggregations