use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_publish method publish_with_message_no_message.
@Test
public void publish_with_message_no_message() {
final Content content = createContent(ContentPath.ROOT, "a");
this.contentService.publish(PushContentParams.create().contentIds(ContentIds.from(content.getId())).target(WS_OTHER).message(null).build());
FindContentVersionsResult versions = this.contentService.getVersions(FindContentVersionsParams.create().contentId(content.getId()).build());
Iterator<ContentVersion> iterator = versions.getContentVersions().iterator();
assertTrue(iterator.hasNext());
ContentVersion version = iterator.next();
assertNotNull(version.getPublishInfo().getTimestamp());
assertEquals("user:system:test-user", version.getPublishInfo().getPublisher().toString());
assertNull(version.getPublishInfo().getMessage());
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_publish method push_one_content.
@Test
public void push_one_content() throws Exception {
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());
assertEquals(0, push.getDeletedContents().getSize());
assertEquals(0, push.getFailedContents().getSize());
assertEquals(1, push.getPushedContents().getSize());
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_publish method publish_workflow_not_ready.
@Test
public void publish_workflow_not_ready() throws Exception {
final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my content").name("myContent").parent(ContentPath.ROOT).type(ContentTypeName.folder()).workflowInfo(WorkflowInfo.create().state(WorkflowState.PENDING_APPROVAL).build()).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());
assertEquals(0, push.getDeletedContents().getSize());
assertEquals(1, push.getFailedContents().getSize());
assertEquals(0, push.getPushedContents().getSize());
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_undoPendingDelete method child_resurrected.
@Test
public void child_resurrected() throws Exception {
final Content parent = this.createTestContent("myContent");
this.createTestContent("myOtherContent", parent.getPath());
final Content child2 = this.createTestContent("myOtherContent2", parent.getPath());
this.nodeService.setNodeState(SetNodeStateParams.create().nodeId(NodeId.from(child2.getId())).recursive(true).nodeState(NodeState.DEFAULT).build());
int result = resurrect(ContentIds.from(parent.getId()));
assertEquals(2, result);
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_undoPendingDelete method deleted_parents_resurrected.
@Test
public void deleted_parents_resurrected() throws Exception {
final Content node1 = this.createTestContent("node1", ContentPath.ROOT);
this.createTestContent("node2", ContentPath.ROOT);
final Content node1_1 = this.createTestContent("node1_1", node1.getPath());
this.createTestContent("node1_2", node1.getPath());
final Content node1_1_1 = this.createTestContent("node1_1_1", node1_1.getPath());
final int result = resurrect(ContentIds.from(node1_1_1.getId()));
assertEquals(3, result);
}
Aggregations