Search in sources :

Example 16 with PublishContentResult

use of com.enonic.xp.content.PublishContentResult in project xp by enonic.

the class ContentServiceImpl method publish.

@Override
public PublishContentResult publish(final PushContentParams params) {
    final PublishContentResult result = PublishContentCommand.create().nodeService(this.nodeService).contentTypeService(this.contentTypeService).translator(this.translator).eventPublisher(this.eventPublisher).contentIds(params.getContentIds()).excludedContentIds(params.getExcludedContentIds()).target(params.getTarget()).contentPublishInfo(params.getContentPublishInfo()).excludeChildrenIds(getExcludeChildrenIds(params)).includeDependencies(params.isIncludeDependencies()).pushListener(params.getPublishContentListener()).deleteListener(params.getDeleteContentListener()).message(params.getMessage()).build().execute();
    contentAuditLogSupport.publish(params, result);
    return result;
}
Also used : PublishContentResult(com.enonic.xp.content.PublishContentResult)

Example 17 with PublishContentResult

use of com.enonic.xp.content.PublishContentResult in project xp by enonic.

the class ContentServiceImplTest_publish method audit_data.

@Test
public void audit_data() throws Exception {
    final ArgumentCaptor<LogAuditLogParams> captor = ArgumentCaptor.forClass(LogAuditLogParams.class);
    final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my content").name("myContent").parent(ContentPath.ROOT).type(ContentTypeName.folder()).build();
    final Content content = this.contentService.create(createContentParams);
    final PublishContentResult push = this.contentService.publish(PushContentParams.create().contentIds(ContentIds.from(content.getId())).target(WS_OTHER).includeDependencies(false).build());
    Mockito.verify(auditLogService, Mockito.timeout(5000).atLeast(16)).log(captor.capture());
    final PropertySet logResultSet = captor.getAllValues().stream().filter(log -> log.getType().equals("system.content.publish")).findFirst().get().getData().getSet("result");
    assertEquals(content.getId().toString(), logResultSet.getStrings("pushedContents").iterator().next());
    assertFalse(logResultSet.getStrings("deletedContents").iterator().hasNext());
    assertFalse(logResultSet.getStrings("pendingContents").iterator().hasNext());
}
Also used : PublishContentResult(com.enonic.xp.content.PublishContentResult) LogAuditLogParams(com.enonic.xp.audit.LogAuditLogParams) CreateContentParams(com.enonic.xp.content.CreateContentParams) Content(com.enonic.xp.content.Content) PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet) Test(org.junit.jupiter.api.Test)

Example 18 with PublishContentResult

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

Example 19 with PublishContentResult

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

Example 20 with PublishContentResult

use of com.enonic.xp.content.PublishContentResult 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)

Aggregations

PublishContentResult (com.enonic.xp.content.PublishContentResult)21 Test (org.junit.jupiter.api.Test)19 Content (com.enonic.xp.content.Content)12 PropertyTree (com.enonic.xp.data.PropertyTree)11 PushContentParams (com.enonic.xp.content.PushContentParams)10 CreateContentParams (com.enonic.xp.content.CreateContentParams)7 DeleteContentsResult (com.enonic.xp.content.DeleteContentsResult)5 Disabled (org.junit.jupiter.api.Disabled)3 ContentId (com.enonic.xp.content.ContentId)2 ContentIds (com.enonic.xp.content.ContentIds)2 Contents (com.enonic.xp.content.Contents)2 LogAuditLogParams (com.enonic.xp.audit.LogAuditLogParams)1 ContentPath (com.enonic.xp.content.ContentPath)1 ContentPublishInfo (com.enonic.xp.content.ContentPublishInfo)1 DeleteContentParams (com.enonic.xp.content.DeleteContentParams)1 GetContentByIdsParams (com.enonic.xp.content.GetContentByIdsParams)1 PropertySet (com.enonic.xp.data.PropertySet)1 PublishContentResultMapper (com.enonic.xp.lib.content.mapper.PublishContentResultMapper)1 ContentType (com.enonic.xp.schema.content.ContentType)1 ArrayList (java.util.ArrayList)1