use of com.enonic.xp.content.ContentId in project xp by enonic.
the class IssueServiceImplTest_findIssues method findByContentId1.
@Test
public void findByContentId1() throws Exception {
ContentId contentId = ContentId.from("issue-item-1");
IssueQuery query = IssueQuery.create().items(ContentIds.from(contentId)).build();
final FindIssuesResult result = this.issueService.findIssues(query);
assertNotNull(result);
assertEquals(2, result.getHits());
assertTrue(result.getIssues().stream().allMatch(issue -> issue.getPublishRequest().getItems().stream().anyMatch(item -> item.getId().equals(contentId))));
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class IssueServiceImplTest_findIssues method findByContentId4.
@Test
public void findByContentId4() throws Exception {
ContentId contentId = ContentId.from("issue-item-4");
IssueQuery query = IssueQuery.create().items(ContentIds.from(contentId)).build();
final FindIssuesResult result = this.issueService.findIssues(query);
assertNotNull(result);
assertEquals(1, result.getHits());
assertTrue(result.getIssues().stream().allMatch(issue -> issue.getPublishRequest().getItems().stream().anyMatch(item -> item.getId().equals(contentId))));
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class SyncContentServiceImplTest method resetWithRemovedSource.
@Test
public void resetWithRemovedSource() throws Exception {
final Content source = sourceContext.callWith(() -> createContent(ContentPath.ROOT));
syncCreated(source.getId());
targetContext.runWith(() -> {
contentService.update(new UpdateContentParams().contentId(source.getId()).editor(edit -> {
edit.workflowInfo = WorkflowInfo.ready();
edit.data = new PropertyTree();
}));
});
sourceContext.runWith(() -> contentService.deleteWithoutFetch(DeleteContentParams.create().contentPath(source.getPath()).build()));
assertThrows(IllegalArgumentException.class, () -> syncContentService.resetInheritance(ResetContentInheritParams.create().contentId(source.getId()).inherit(EnumSet.of(ContentInheritType.CONTENT)).projectName(targetProject.getName()).build()));
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class ProjectContentEventListenerTest method testDuplicateInherited.
@Test
public void testDuplicateInherited() throws InterruptedException {
final Content sourceContent = sourceContext.callWith(() -> createContent(ContentPath.ROOT, "localName"));
handleEvents();
final ContentId duplicatedContentId = targetContext.callWith(() -> contentService.duplicate(DuplicateContentParams.create().contentId(sourceContent.getId()).build()).getDuplicatedContents().first());
targetContext.runWith(() -> {
final Content duplicatedTargetContent = contentService.getById(duplicatedContentId);
assertEquals("localName-copy", duplicatedTargetContent.getName().toString());
assertTrue(duplicatedTargetContent.getInherit().isEmpty());
});
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class ProjectContentEventListenerTest method testSyncDuplicateWithExistedLocalName.
@Test
public void testSyncDuplicateWithExistedLocalName() throws InterruptedException {
targetContext.callWith(() -> createContent(ContentPath.ROOT, "localName-copy"));
targetContext.callWith(() -> createContent(ContentPath.ROOT, "localName-copy-1"));
final Content sourceContent = sourceContext.callWith(() -> createContent(ContentPath.ROOT, "localName"));
handleEvents();
final ContentId duplicatedContentId = sourceContext.callWith(() -> contentService.duplicate(DuplicateContentParams.create().contentId(sourceContent.getId()).build()).getDuplicatedContents().first());
handleEvents();
targetContext.runWith(() -> {
final Content duplicatedTargetContent = contentService.getById(duplicatedContentId);
assertEquals("localName-copy-1-1", duplicatedTargetContent.getName().toString());
assertEquals(3, duplicatedTargetContent.getInherit().size());
assertFalse(duplicatedTargetContent.getInherit().contains(ContentInheritType.NAME));
});
}
Aggregations