Search in sources :

Example 36 with ContentIds

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");
}
Also used : ContentIds(com.enonic.xp.content.ContentIds) PushContentParams(com.enonic.xp.content.PushContentParams) Test(org.junit.jupiter.api.Test)

Example 37 with ContentIds

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");
}
Also used : Content(com.enonic.xp.content.Content) ContentIds(com.enonic.xp.content.ContentIds) PushContentParams(com.enonic.xp.content.PushContentParams) Test(org.junit.jupiter.api.Test)

Example 38 with ContentIds

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");
}
Also used : Content(com.enonic.xp.content.Content) UnpublishContentParams(com.enonic.xp.content.UnpublishContentParams) ContentIds(com.enonic.xp.content.ContentIds) Test(org.junit.jupiter.api.Test)

Aggregations

ContentIds (com.enonic.xp.content.ContentIds)38 Test (org.junit.jupiter.api.Test)27 Content (com.enonic.xp.content.Content)22 Contents (com.enonic.xp.content.Contents)11 GetContentByIdsParams (com.enonic.xp.content.GetContentByIdsParams)10 PropertyTree (com.enonic.xp.data.PropertyTree)8 ContentId (com.enonic.xp.content.ContentId)6 PushContentParams (com.enonic.xp.content.PushContentParams)6 UnpublishContentParams (com.enonic.xp.content.UnpublishContentParams)4 NodeIds (com.enonic.xp.node.NodeIds)4 DeleteContentsResult (com.enonic.xp.content.DeleteContentsResult)3 CreateContentParams (com.enonic.xp.content.CreateContentParams)2 DeleteContentParams (com.enonic.xp.content.DeleteContentParams)2 PublishContentResult (com.enonic.xp.content.PublishContentResult)2 UnpublishContentsResult (com.enonic.xp.content.UnpublishContentsResult)2 Context (com.enonic.xp.context.Context)2 PropertySet (com.enonic.xp.data.PropertySet)2 FindNodesByParentResult (com.enonic.xp.node.FindNodesByParentResult)2 Node (com.enonic.xp.node.Node)2 NodeId (com.enonic.xp.node.NodeId)2