use of com.enonic.xp.content.PushContentParams in project xp by enonic.
the class ContentServiceImplTest_publish method push_with_children.
@Test
public void push_with_children() throws Exception {
createContentTree();
final PushContentParams pushParams = PushContentParams.create().contentIds(ContentIds.from(content1.getId())).target(WS_OTHER).build();
final PublishContentResult result = this.contentService.publish(pushParams);
assertEquals(3, result.getPushedContents().getSize());
}
use of com.enonic.xp.content.PushContentParams in project xp by enonic.
the class ContentServiceImplTest_publish method push_deleted.
@Test
public void push_deleted() throws Exception {
final Content content = this.contentService.create(CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my content").parent(ContentPath.ROOT).type(ContentTypeName.folder()).build());
final PushContentParams pushParams = PushContentParams.create().contentIds(ContentIds.from(content.getId())).target(WS_OTHER).build();
final PublishContentResult push = this.contentService.publish(pushParams);
assertEquals(1, push.getPushedContents().getSize());
contentService.deleteWithoutFetch(DeleteContentParams.create().contentPath(content.getPath()).build());
final PublishContentResult pushWithDeleted = this.contentService.publish(pushParams);
assertEquals(1, pushWithDeleted.getDeletedContents().getSize());
}
use of com.enonic.xp.content.PushContentParams in project xp by enonic.
the class PublishContentHandlerTest method publishById.
@Test
public void publishById() {
ContentIds ids = ContentIds.from(PUB_ID_2, DEL_ID, FAIL_ID);
PushContentParams pushParams = PushContentParams.create().contentIds(ids).target(Branch.from("draft")).build();
Mockito.when(this.contentService.publish(pushParams)).thenReturn(exampleResult());
runFunction("/test/PublishContentHandlerTest.js", "publishById");
}
use of com.enonic.xp.content.PushContentParams 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");
}
Aggregations