use of com.enonic.xp.content.Contents in project xp by enonic.
the class ContentServiceImplTest_getByPaths method multiple.
@Test
public void multiple() throws Exception {
final Content content1 = createContent(ContentPath.ROOT);
final Content content2 = createContent(content1.getPath());
final Content content3 = createContent(content2.getPath());
final Contents contents = this.contentService.getByPaths(ContentPaths.from(content1.getPath(), content2.getPath(), content3.getPath()));
assertNotNull(contents);
assertEquals(3, contents.getSize());
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class ContentServiceImplTest_getByIds method test_published_draft.
@Test
public void test_published_draft() throws Exception {
final Content content1 = createContent(ContentPath.ROOT);
final Content content2 = createContent(ContentPath.ROOT, ContentPublishInfo.create().from(Instant.now().minus(Duration.ofDays(1))).to(Instant.now().plus(Duration.ofDays(1))).build());
final ContentIds ids = ContentIds.from(content1.getId(), content2.getId());
final Contents contents = this.contentService.getByIds(new GetContentByIdsParams(ids));
assertEquals(contents.getSize(), 2);
assertTrue(contents.contains(content1));
assertTrue(contents.contains(content2));
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class ContentServiceImplTest_getByIds method test_pending_publish_master.
@Test
public void test_pending_publish_master() throws Exception {
authorizedMasterContext().callWith(() -> {
final Content content1 = createContent(ContentPath.ROOT);
final Content content2 = createContent(ContentPath.ROOT, ContentPublishInfo.create().from(Instant.now().plus(Duration.ofDays(1))).build());
final ContentIds ids = ContentIds.from(content1.getId(), content2.getId());
final Contents contents = this.contentService.getByIds(new GetContentByIdsParams(ids));
assertEquals(contents.getSize(), 1);
assertTrue(contents.contains(content1));
assertFalse(contents.contains(content2));
return null;
});
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class ContentServiceImplTest_getByIds method test_published_master.
@Test
public void test_published_master() throws Exception {
authorizedMasterContext().callWith(() -> {
final Content content1 = createContent(ContentPath.ROOT);
final Content content2 = createContent(ContentPath.ROOT, ContentPublishInfo.create().from(Instant.now().minus(Duration.ofDays(1))).to(Instant.now().plus(Duration.ofDays(1))).build());
final ContentIds ids = ContentIds.from(content1.getId(), content2.getId());
final Contents contents = this.contentService.getByIds(new GetContentByIdsParams(ids));
assertEquals(contents.getSize(), 2);
assertTrue(contents.contains(content1));
assertTrue(contents.contains(content2));
return null;
});
}
use of com.enonic.xp.content.Contents in project xp by enonic.
the class ContentServiceImplTest_getByIds method test_pending_publish_draft.
@Test
public void test_pending_publish_draft() throws Exception {
final Content content1 = createContent(ContentPath.ROOT);
final Content content2 = createContent(ContentPath.ROOT, ContentPublishInfo.create().from(Instant.now().plus(Duration.ofDays(1))).build());
final ContentIds ids = ContentIds.from(content1.getId(), content2.getId());
final Contents contents = this.contentService.getByIds(new GetContentByIdsParams(ids));
assertEquals(contents.getSize(), 2);
assertTrue(contents.contains(content1));
assertTrue(contents.contains(content2));
}
Aggregations