Search in sources :

Example 11 with PushContentParams

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

Example 12 with PushContentParams

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

Example 13 with PushContentParams

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

Example 14 with PushContentParams

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");
}
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)

Aggregations

PushContentParams (com.enonic.xp.content.PushContentParams)14 Test (org.junit.jupiter.api.Test)14 PublishContentResult (com.enonic.xp.content.PublishContentResult)9 ContentIds (com.enonic.xp.content.ContentIds)6 Content (com.enonic.xp.content.Content)4 PropertyTree (com.enonic.xp.data.PropertyTree)3 Contents (com.enonic.xp.content.Contents)2 Disabled (org.junit.jupiter.api.Disabled)2 CreateContentParams (com.enonic.xp.content.CreateContentParams)1 DeleteContentParams (com.enonic.xp.content.DeleteContentParams)1 DeleteContentsResult (com.enonic.xp.content.DeleteContentsResult)1 GetContentByIdsParams (com.enonic.xp.content.GetContentByIdsParams)1