Search in sources :

Example 46 with Content

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

Example 47 with Content

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

Example 48 with Content

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

Example 49 with Content

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

Example 50 with Content

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

Aggregations

Content (com.enonic.xp.content.Content)563 Test (org.junit.jupiter.api.Test)435 PropertyTree (com.enonic.xp.data.PropertyTree)131 CreateContentParams (com.enonic.xp.content.CreateContentParams)57 ContentId (com.enonic.xp.content.ContentId)50 UpdateContentParams (com.enonic.xp.content.UpdateContentParams)48 ContentPath (com.enonic.xp.content.ContentPath)47 ValidationErrors (com.enonic.xp.content.ValidationErrors)47 Site (com.enonic.xp.site.Site)43 PropertySet (com.enonic.xp.data.PropertySet)31 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)27 Page (com.enonic.xp.page.Page)26 Contents (com.enonic.xp.content.Contents)25 Node (com.enonic.xp.node.Node)25 ContentIds (com.enonic.xp.content.ContentIds)24 ContentQuery (com.enonic.xp.content.ContentQuery)24 FindContentByParentParams (com.enonic.xp.content.FindContentByParentParams)24 FindContentByParentResult (com.enonic.xp.content.FindContentByParentResult)23 DataValidationError (com.enonic.xp.content.DataValidationError)21 ContentType (com.enonic.xp.schema.content.ContentType)20