Search in sources :

Example 1 with IssueName

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

the class UpdateIssueCommandTest method update.

@Test
public void update() {
    final UpdateIssueParams params = makeUpdateIssueParams();
    final UpdateIssueCommand command = updateIssueCommand(params);
    final IssueName issueName = IssueName.from(NamePrettyfier.create("title"));
    final Issue issue = command.execute();
    assertNotNull(issue);
    assertEquals("title", issue.getTitle());
    assertEquals(IssueStatus.OPEN, issue.getStatus());
    assertEquals(issueName, issue.getName());
}
Also used : Issue(com.enonic.xp.issue.Issue) IssueName(com.enonic.xp.issue.IssueName) UpdateIssueParams(com.enonic.xp.issue.UpdateIssueParams) Test(org.junit.jupiter.api.Test)

Example 2 with IssueName

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

the class GetIssueCommandTest method getById.

@Test
public void getById() {
    final GetIssueByIdCommand command = getIssueCommand(IssueId.create());
    final IssueName issueName = IssueName.from(NamePrettyfier.create("title"));
    final Issue issue = command.execute();
    assertNotNull(issue);
    assertEquals("title", issue.getTitle());
    assertEquals(IssueStatus.OPEN, issue.getStatus());
    assertEquals(issueName, issue.getName());
}
Also used : Issue(com.enonic.xp.issue.Issue) IssueName(com.enonic.xp.issue.IssueName) Test(org.junit.jupiter.api.Test)

Example 3 with IssueName

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

the class IssueNodeTranslatorTest method testFromNodeNotResolvingChildren.

@Test
public void testFromNodeNotResolvingChildren() throws Exception {
    final Node node = createNode();
    final Issue issue = IssueNodeTranslator.fromNode(node);
    final IssueName issueName = IssueName.from(NamePrettyfier.create("title"));
    assertNotNull(issue);
    assertEquals("title", issue.getTitle());
    assertEquals("description", issue.getDescription());
    assertEquals(IssueStatus.OPEN, issue.getStatus());
    assertEquals(PrincipalKey.from("user:myStore:me"), issue.getCreator());
    assertEquals(PrincipalKey.from("user:myStore:approver-1"), issue.getApproverIds().first());
    assertTrue(issue.getPublishRequest().getItems().contains(PublishRequestItem.create().id(ContentId.from("content-id1")).includeChildren(false).build()));
    assertTrue(issue.getPublishRequest().getItems().contains(PublishRequestItem.create().id(ContentId.from("content-id2")).includeChildren(true).build()));
    assertEquals(issueName, issue.getName());
}
Also used : Issue(com.enonic.xp.issue.Issue) IssueName(com.enonic.xp.issue.IssueName) Node(com.enonic.xp.node.Node) Test(org.junit.jupiter.api.Test)

Example 4 with IssueName

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

the class CreateIssueCommand method doExecute.

private Issue doExecute() {
    validateBlockingChecks();
    final long index = countTotalIssues() + 1;
    final IssueName issueName = IssueNameFactory.create(index);
    final CreateNodeParams createNodeParams = CreateNodeParamsFactory.create(this.params, this.getCurrentUser(), index, issueName);
    final Node createdNode;
    try {
        createdNode = nodeService.create(createNodeParams);
    } catch (NodeAlreadyExistAtPathException e) {
        throw new IssueAlreadyExistsException(IssueName.from(createNodeParams.getName()));
    }
    nodeService.refresh(RefreshMode.SEARCH);
    return IssueNodeTranslator.fromNode(createdNode);
}
Also used : IssueAlreadyExistsException(com.enonic.xp.issue.IssueAlreadyExistsException) IssueName(com.enonic.xp.issue.IssueName) Node(com.enonic.xp.node.Node) NodeAlreadyExistAtPathException(com.enonic.xp.node.NodeAlreadyExistAtPathException) CreateNodeParams(com.enonic.xp.node.CreateNodeParams)

Aggregations

IssueName (com.enonic.xp.issue.IssueName)4 Issue (com.enonic.xp.issue.Issue)3 Test (org.junit.jupiter.api.Test)3 Node (com.enonic.xp.node.Node)2 IssueAlreadyExistsException (com.enonic.xp.issue.IssueAlreadyExistsException)1 UpdateIssueParams (com.enonic.xp.issue.UpdateIssueParams)1 CreateNodeParams (com.enonic.xp.node.CreateNodeParams)1 NodeAlreadyExistAtPathException (com.enonic.xp.node.NodeAlreadyExistAtPathException)1