use of com.enonic.xp.content.PushContentParams in project xp by enonic.
the class PublishContentHandlerTest method testExample.
@Test
public void testExample() {
final Content content = exampleContent(PUB_ID_1, "mycontent", "My Content", "/mysite/somepage", "myfield", "Hello World");
Mockito.when(this.contentService.getByPath(ContentPath.from("/mysite/somepage"))).thenReturn(content);
ContentIds ids = ContentIds.from(PUB_ID_1, FAIL_ID);
PushContentParams pushParams = PushContentParams.create().contentIds(ids).target(Branch.from("master")).includeDependencies(false).message("My first publish").build();
Mockito.when(this.contentService.publish(pushParams)).thenReturn(exampleResult());
runScript("/lib/xp/examples/content/publish.js");
}
use of com.enonic.xp.content.PushContentParams 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.PushContentParams in project xp by enonic.
the class PublishContentHandlerTest method publishWithMessage.
@Test
public void publishWithMessage() {
ContentIds ids = ContentIds.from(PUB_ID_2, DEL_ID, FAIL_ID);
PushContentParams pushParams = PushContentParams.create().contentIds(ids).target(Branch.from("draft")).message("My first publish").build();
Mockito.when(this.contentService.publish(pushParams)).thenReturn(exampleResult());
runFunction("/test/PublishContentHandlerTest.js", "publishWithMessage");
}
use of com.enonic.xp.content.PushContentParams in project xp by enonic.
the class ContentServiceImplTest_publish method push_dependencies.
@Test
public void push_dependencies() throws Exception {
createContentTree();
final PushContentParams pushParams = PushContentParams.create().contentIds(ContentIds.from(content2.getId())).target(WS_OTHER).build();
final PublishContentResult result = this.contentService.publish(pushParams);
assertEquals(4, result.getPushedContents().getSize());
}
use of com.enonic.xp.content.PushContentParams in project xp by enonic.
the class ContentServiceImplTest_publish method push_exclude_empty.
@Disabled("This test is not correct; it should not be allowed to exclude parent if new")
@Test
public void push_exclude_empty() throws Exception {
createContentTree();
final PushContentParams pushParams = PushContentParams.create().contentIds(ContentIds.from(content1.getId())).excludedContentIds(ContentIds.from(content1.getId())).target(WS_OTHER).build();
refresh();
final PublishContentResult result = this.contentService.publish(pushParams);
assertEquals(0, result.getPushedContents().getSize());
}
Aggregations