use of com.enonic.xp.content.FindContentByParentResult in project xp by enonic.
the class ContentServiceImplTest_findByParent method test_publish_expired_draft.
@Test
public void test_publish_expired_draft() throws Exception {
final FindContentByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().minus(Duration.ofDays(1))).to(Instant.now().minus(Duration.ofDays(1))).build());
assertEquals(1, result.getTotalHits());
}
use of com.enonic.xp.content.FindContentByParentResult 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.FindContentByParentResult in project xp by enonic.
the class ContentServiceImplTest_findByParent method params_size_zero.
@Test
public void params_size_zero() throws Exception {
final Content parentContent = createContent(ContentPath.ROOT);
createContent(parentContent.getPath());
createContent(parentContent.getPath());
createContent(parentContent.getPath());
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(0).parentPath(parentContent.getPath()).build();
final FindContentByParentResult result = contentService.findByParent(params);
assertNotNull(result);
assertEquals(0, result.getHits());
assertEquals(3, result.getTotalHits());
assertTrue(result.getContents().isEmpty());
}
use of com.enonic.xp.content.FindContentByParentResult in project xp by enonic.
the class ContentServiceImplTest_findByParent method root_content.
@Test
public void root_content() throws Exception {
createContent(ContentPath.ROOT);
createContent(ContentPath.ROOT);
this.nodeService.refresh(RefreshMode.SEARCH);
final FindContentByParentResult result = contentService.findByParent(FindContentByParentParams.create().from(0).size(30).parentPath(null).build());
assertNotNull(result);
assertEquals(2, result.getTotalHits());
}
use of com.enonic.xp.content.FindContentByParentResult in project xp by enonic.
the class ContentServiceImplTest_findByParent method test_pending_publish_master.
@Test
public void test_pending_publish_master() throws Exception {
authorizedMasterContext().callWith(() -> {
final FindContentByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().plus(Duration.ofDays(1))).build());
assertEquals(0, result.getTotalHits());
return null;
});
}
Aggregations