use of com.enonic.xp.content.Contents in project xp by enonic.
the class GetChildContentHandlerTest method getChildrenByPath.
@Test
public void getChildrenByPath() throws Exception {
final Contents contents = TestDataFixtures.newContents(3);
final FindContentByParentResult findResult = FindContentByParentResult.create().hits(contents.getSize()).totalHits(20).contents(contents).build();
Mockito.when(this.contentService.findByParent(Mockito.isA(FindContentByParentParams.class))).thenReturn(findResult);
runFunction("/test/GetChildContentHandlerTest.js", "getChildrenByPath");
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class PublishContentHandlerTest method publishWithoutChildrenOrDependencies.
@Test
public void publishWithoutChildrenOrDependencies() {
Contents published = Contents.from(exampleContent(PUB_ID_3, "mycontent", "My Content", "/mysite/somepage", "myfield", "Hello World"));
PublishContentResult exampleResult = PublishContentResult.create().setPushed(published.getIds()).build();
ContentIds ids = ContentIds.from(PUB_ID_3);
PushContentParams pushParams = PushContentParams.create().contentIds(ids).target(Branch.from("master")).excludeChildrenIds(ids).includeDependencies(false).build();
Mockito.when(this.contentService.publish(pushParams)).thenReturn(exampleResult);
runFunction("/test/PublishContentHandlerTest.js", "publishWithoutChildrenOrDependencies");
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class QueryContentHandler method convert.
private ContentsResultMapper convert(final FindContentIdsByQueryResult findQueryResult) {
final ContentIds contentIds = findQueryResult.getContentIds();
final Contents contents;
if (contentIds.isEmpty()) {
contents = Contents.empty();
} else {
contents = this.contentService.getByIds(new GetContentByIdsParams(contentIds));
}
return new ContentsResultMapper(contents, findQueryResult.getTotalHits(), findQueryResult.getAggregations(), findQueryResult.getHighlight(), findQueryResult.getSort(), findQueryResult.getScore());
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class GetChildContentHandlerTest method getChildrenByPath_allParameters.
@Test
public void getChildrenByPath_allParameters() throws Exception {
final Contents contents = TestDataFixtures.newContents(3);
final FindContentByParentResult findResult = FindContentByParentResult.create().hits(contents.getSize()).totalHits(20).contents(contents).build();
final FindContentByParentParams expectedFindParams = FindContentByParentParams.create().parentPath(ContentPath.from("/a/b/mycontent")).from(5).size(3).childOrder(ChildOrder.from("_modifiedTime ASC")).build();
Mockito.when(this.contentService.findByParent(Mockito.eq(expectedFindParams))).thenReturn(findResult);
runFunction("/test/GetChildContentHandlerTest.js", "getChildrenByPath_allParameters");
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class GetChildContentHandlerTest method getChildrenById.
@Test
public void getChildrenById() throws Exception {
final Contents contents = TestDataFixtures.newContents(3);
final FindContentByParentResult findResult = FindContentByParentResult.create().hits(contents.getSize()).totalHits(20).contents(contents).build();
Mockito.when(this.contentService.findByParent(Mockito.isA(FindContentByParentParams.class))).thenReturn(findResult);
runFunction("/test/GetChildContentHandlerTest.js", "getChildrenById");
}
Aggregations