use of com.enonic.xp.content.Content in project xp by enonic.
the class ParentContentSynchronizerTest method syncByRoot.
@Test
public void syncByRoot() throws Exception {
final Content sourceContent = sourceContext.callWith(() -> createContent(ContentPath.ROOT, "name"));
final Content sourceChild1 = sourceContext.callWith(() -> createContent(sourceContent.getPath(), "child1"));
final Content sourceChild1_1 = sourceContext.callWith(() -> createContent(sourceContent.getPath(), "child1_1"));
sync(null, false);
assertTrue(targetContext.callWith(() -> contentService.contentExists(sourceContent.getId())));
assertTrue(targetContext.callWith(() -> contentService.contentExists(sourceChild1.getId())));
assertTrue(targetContext.callWith(() -> contentService.contentExists(sourceChild1_1.getId())));
}
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);
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_undoPendingDelete method not_deleted_not_resurrected.
@Test
public void not_deleted_not_resurrected() 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);
int result = resurrect(ContentIds.from(ContentIds.from(content.getId())));
assertEquals(0, result);
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_update method update_content_modified_time_updated.
@Test
public void update_content_modified_time_updated() throws Exception {
final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my content").parent(ContentPath.ROOT).type(ContentTypeName.folder()).build();
final Content content = this.contentService.create(createContentParams);
final UpdateContentParams updateContentParams = new UpdateContentParams();
updateContentParams.contentId(content.getId()).editor(edit -> {
edit.displayName = "new display name";
});
this.contentService.update(updateContentParams);
final Content updatedContent = this.contentService.getById(content.getId());
assertEquals("new display name", updatedContent.getDisplayName());
assertNotNull(updatedContent.getCreator());
assertNotNull(updatedContent.getCreatedTime());
assertNotNull(updatedContent.getModifier());
assertNotNull(updatedContent.getModifiedTime());
assertTrue(updatedContent.getModifiedTime().isAfter(content.getModifiedTime()));
}
Aggregations