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;
}
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());
}
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());
}
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());
}
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());
}
Aggregations