use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class PublishContentHandlerTest method publishByPath.
@Test
public void publishByPath() {
final Content myContent = exampleContent(PUB_ID_2, "mycontent", "My Content", "/myfolder/mycontent", "myfield", "Hello World");
Mockito.when(this.contentService.getByPath(ContentPath.from("/myfolder/mycontent"))).thenReturn(myContent);
final Content yourContent = exampleContent(PUB_ID_3, "yourcontent", "Your Content", "/yourfolder/yourcontent", "yourfield", "Hello Universe!");
Mockito.when(this.contentService.getByPath(ContentPath.from("/yourfolder/yourcontent"))).thenReturn(yourContent);
ContentIds ids = ContentIds.from(PUB_ID_2, PUB_ID_3);
PushContentParams pushParams = PushContentParams.create().contentIds(ids).target(Branch.from("master")).build();
Mockito.when(this.contentService.publish(pushParams)).thenReturn(exampleResult());
runFunction("/test/PublishContentHandlerTest.js", "publishByPath");
}
use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class AbstractContentServiceTest method assertOrder.
protected void assertOrder(final FindContentByQueryResult result, final Content... expectedOrder) {
final ContentIds contentIds = result.getContents().getIds();
doAssertOrder(contentIds, expectedOrder);
}
use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class ContentServiceImplTest_resolveRequiredDependencies method resolve_with_no_parent.
@Test
public void resolve_with_no_parent() throws Exception {
content1 = createContent(ContentPath.ROOT);
content2 = createContent(ContentPath.ROOT);
content3 = createContent(ContentPath.ROOT);
refresh();
final ContentIds result = this.contentService.resolveRequiredDependencies(ResolveRequiredDependenciesParams.create().contentIds(ContentIds.from(content1.getId(), content2.getId(), content3.getId())).target(WS_OTHER).build());
assertTrue(result.getSize() == 0);
}
use of com.enonic.xp.content.ContentIds 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.ContentIds 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;
});
}
Aggregations