Search in sources :

Example 6 with IssueQuery

use of com.enonic.xp.issue.IssueQuery 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))));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Issue(com.enonic.xp.issue.Issue) PublishRequestItem(com.enonic.xp.issue.PublishRequestItem) CreateIssueParams(com.enonic.xp.issue.CreateIssueParams) Test(org.junit.jupiter.api.Test) ContentId(com.enonic.xp.content.ContentId) ContentIds(com.enonic.xp.content.ContentIds) IssueQuery(com.enonic.xp.issue.IssueQuery) FindIssuesResult(com.enonic.xp.issue.FindIssuesResult) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) PublishRequest(com.enonic.xp.issue.PublishRequest) ContentId(com.enonic.xp.content.ContentId) IssueQuery(com.enonic.xp.issue.IssueQuery) FindIssuesResult(com.enonic.xp.issue.FindIssuesResult) Test(org.junit.jupiter.api.Test)

Example 7 with IssueQuery

use of com.enonic.xp.issue.IssueQuery in project xp by enonic.

the class IssueServiceImplTest_findIssues method find.

@Test
public void find() throws Exception {
    IssueQuery query = IssueQuery.create().build();
    final FindIssuesResult result = this.issueService.findIssues(query);
    assertNotNull(result);
    assertEquals(3, result.getHits());
}
Also used : IssueQuery(com.enonic.xp.issue.IssueQuery) FindIssuesResult(com.enonic.xp.issue.FindIssuesResult) Test(org.junit.jupiter.api.Test)

Aggregations

IssueQuery (com.enonic.xp.issue.IssueQuery)7 FindIssuesResult (com.enonic.xp.issue.FindIssuesResult)6 Test (org.junit.jupiter.api.Test)6 ContentId (com.enonic.xp.content.ContentId)3 ContentIds (com.enonic.xp.content.ContentIds)3 CreateIssueParams (com.enonic.xp.issue.CreateIssueParams)3 Issue (com.enonic.xp.issue.Issue)3 PublishRequest (com.enonic.xp.issue.PublishRequest)3 PublishRequestItem (com.enonic.xp.issue.PublishRequestItem)3 NodeQuery (com.enonic.xp.node.NodeQuery)3 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)3 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)3 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 NodeIds (com.enonic.xp.node.NodeIds)2 FindNodesByQueryResult (com.enonic.xp.node.FindNodesByQueryResult)1