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()));
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_update method update_workflow_info.
@Test
public void update_workflow_info() throws Exception {
final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my content").parent(ContentPath.ROOT).type(ContentTypeName.folder()).workflowInfo(WorkflowInfo.inProgress()).build();
final Content content = this.contentService.create(createContentParams);
final UpdateContentParams updateContentParams = new UpdateContentParams();
updateContentParams.contentId(content.getId()).editor(edit -> {
edit.workflowInfo = WorkflowInfo.create().state(WorkflowState.PENDING_APPROVAL).checks(Map.of("Laywer review", WorkflowCheckState.PENDING)).build();
});
this.contentService.update(updateContentParams);
final Content storedContent = this.contentService.getById(content.getId());
assertNotNull(storedContent.getWorkflowInfo());
assertNotNull(storedContent.getWorkflowInfo().getState());
assertNotNull(storedContent.getWorkflowInfo().getChecks());
assertEquals(WorkflowState.PENDING_APPROVAL, storedContent.getWorkflowInfo().getState());
assertEquals(Map.of("Laywer review", WorkflowCheckState.PENDING), storedContent.getWorkflowInfo().getChecks());
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_resolveRequiredDependencies method resolve_with_parent.
@Test
public void resolve_with_parent() throws Exception {
Content content1 = createContent(ContentPath.ROOT);
Content content2 = createContent(content1.getPath());
refresh();
final ContentIds result = this.contentService.resolveRequiredDependencies(ResolveRequiredDependenciesParams.create().contentIds(ContentIds.from(content1.getId(), content2.getId())).target(WS_OTHER).build());
assertEquals(content1.getId(), result.first());
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_resolveRequiredDependencies method resolve_hierarchy.
@Test
public void resolve_hierarchy() throws Exception {
Content content1 = createContent(ContentPath.ROOT);
Content content2 = createContent(content1.getPath());
Content content3 = createContent(content2.getPath());
refresh();
final ContentIds result = this.contentService.resolveRequiredDependencies(ResolveRequiredDependenciesParams.create().contentIds(ContentIds.from(content1.getId(), content2.getId(), content3.getId())).target(WS_OTHER).build());
assertTrue(result.getSize() == 2);
assertTrue(result.contains(content1.getId()));
assertTrue(result.contains(content2.getId()));
}
Aggregations