use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent 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 FindContentIdsByParentResult result = contentService.findIdsByParent(params);
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_publish_expired_draft.
@Test
public void test_publish_expired_draft() throws Exception {
final FindContentIdsByParentResult 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.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method test_publish_expired_master.
@Test
public void test_publish_expired_master() throws Exception {
authorizedMasterContext().callWith(() -> {
final FindContentIdsByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().minus(Duration.ofDays(1))).to(Instant.now().minus(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 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.FindContentIdsByParentResult in project xp by enonic.
the class ContentServiceImplTest_findIdsByParent method test_pending_publish_draft.
@Test
public void test_pending_publish_draft() throws Exception {
final FindContentIdsByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().plus(Duration.ofDays(1))).build());
assertEquals(1, result.getTotalHits());
}
Aggregations