use of com.enonic.xp.content.ContentIds 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.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 UnpublishContentHandlerTest method unpublishByPath.
@Test
public void unpublishByPath() {
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);
UnpublishContentParams unpublishParams = UnpublishContentParams.create().contentIds(ids).unpublishBranch(ContentConstants.BRANCH_MASTER).includeChildren(true).build();
Mockito.when(this.contentService.unpublishContent(unpublishParams)).thenReturn(exampleResult());
runFunction("/test/UnpublishContentHandlerTest.js", "unpublishByPath");
}
Aggregations