Package com.atlassian.jira.rest.client.api.domain

Examples of com.atlassian.jira.rest.client.api.domain.Issue


    assertNull(issue.getIssueLinks());
  }

  @Test
  public void issueWithSubtasks() throws JSONException {
    final Issue issue = parseIssue("/json/issue/subtasks-5.json");
    Iterable<Subtask> subtasks = issue.getSubtasks();
    assertEquals(1, Iterables.size(subtasks));
    Subtask subtask = Iterables.get(subtasks, 0, null);
    assertNotNull(subtask);
    assertEquals("SAM-2", subtask.getIssueKey());
    assertEquals("Open", subtask.getStatus().getName());
View Full Code Here


    assertEquals("Subtask", subtask.getIssueType().getName());
  }

  @Test
  public void issueWithChangelog() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-5.0-with-changelog.json");
    assertEquals("HST-1", issue.getKey());

    final Iterable<ChangelogGroup> changelog = issue.getChangelog();
    assertNotNull(changelog);

    assertEquals(4, Iterables.size(changelog));
    final Iterator<ChangelogGroup> iterator = changelog.iterator();
View Full Code Here

    assertEquals(expectedItems, changelogGroup.getItems());
  }

  @Test
  public void testParseIssueWithLabelsForJira5x0() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-5.0-with-labels.json");
    assertThat(issue.getLabels(), containsInAnyOrder("a", "bcds"));
  }
View Full Code Here

    assertThat(issue.getLabels(), containsInAnyOrder("a", "bcds"));
  }

  @Test
  public void testParseIssueWithLabels() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-5.0-with-labels.json");
    assertThat(issue.getLabels(), containsInAnyOrder("a", "bcds"));
  }
View Full Code Here

    assertThat(issue.getLabels(), containsInAnyOrder("a", "bcds"));
  }

  @Test
  public void testParseIssueWithoutLabelsForJira5x0() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-5.0-without-labels.json");
    assertThat(issue.getLabels(), IsEmptyCollection.<String>empty());
  }
View Full Code Here

    assertThat(issue.getLabels(), IsEmptyCollection.<String>empty());
  }

  @Test
  public void testParseIssueWithOperations() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-5.0-with-operations.json");
    assertThat(issue.getOperations(), is(new Operations(Collections.singleton(new OperationGroup(
        "opsbar-transitions",
        Collections.singleton(new OperationLink("action_id_4", "issueaction-workflow-transition",
            "Start Progress", "Start work on the issue", "/secure/WorkflowUIDispatcher.jspa?id=93813&action=4&atl_token=",
            10, null)),
        Collections.singleton(new OperationGroup(
View Full Code Here

  public void testParse() throws Exception {
    final SearchResult searchResult = parser.parse(getJsonObjectFromResource("/json/search/issues1.json"));

    assertThat(searchResult, searchResultWithParamsAndIssueCount(0, 50, 1, 1));

    final Issue foundIssue = Iterables.getLast(searchResult.getIssues());
    assertIssueIsTST7(foundIssue);
  }
View Full Code Here

  public void testParseMany() throws Exception {
    final SearchResult searchResult = parser.parse(getJsonObjectFromResource("/json/search/many-issues.json"));

    assertThat(searchResult, searchResultWithParamsAndIssueCount(0, 8, 15, 8));

    final Issue issue = findEntityById(searchResult.getIssues(), 10040L);
    assertIssueIsTST7(issue);

    final String[] expectedIssuesKeys = {"TST-13", "TST-12", "TST-11", "TST-10", "TST-9", "TST-8", "TST-7", "TST-6"};
    assertThat(searchResult.getIssues(), issuesWithKeys(expectedIssuesKeys));
  }
View Full Code Here

// Ignore "May produce NPE" warnings, as we know what we are doing in tests
@SuppressWarnings("ConstantConditions")
public class IssueJsonParserTest {
  @Test
  public void testParseIssue() throws Exception {
    final Issue issue = parseIssue("/json/issue/valid-all-expanded.json");

    assertEquals("Testing attachem2", issue.getSummary());
    assertEquals("TST-2", issue.getKey());
    assertEquals("my description", issue.getDescription());
    assertEquals(Long.valueOf(10010), issue.getId());

    final BasicProject expectedProject = new BasicProject(toUri("http://localhost:8090/jira/rest/api/2/project/TST"), "TST", 10000L, "Test Project");
    assertEquals(expectedProject, issue.getProject());

    assertEquals("Major", issue.getPriority().getName());
    assertNull(issue.getResolution());
    assertEquals(toDateTime("2010-07-26T13:29:18.262+0200"), issue.getCreationDate());
    assertEquals(toDateTime("2012-12-07T14:52:52.570+01:00"), issue.getUpdateDate());
    assertEquals(null, issue.getDueDate());

    final IssueType expectedIssueType = new IssueType(toUri("http://localhost:8090/jira/rest/api/2/issuetype/1"), 1L,
        "Bug", false, "A problem which impairs or prevents the functions of the product.",
        toUri("http://localhost:8090/jira/images/icons/bug.gif"));
    assertEquals(expectedIssueType, issue.getIssueType());

    assertEquals(TestConstants.USER_ADMIN, issue.getReporter());
    assertEquals(TestConstants.USER1, issue.getAssignee());

    // issue links
    Assert.assertThat(issue.getIssueLinks(), containsInAnyOrder(
        new IssueLink("TST-1", toUri("http://localhost:8090/jira/rest/api/2/issue/10000"),
            new IssueLinkType("Duplicate", "duplicates", IssueLinkType.Direction.OUTBOUND)),
        new IssueLink("TST-1", toUri("http://localhost:8090/jira/rest/api/2/issue/10000"),
            new IssueLinkType("Duplicate", "is duplicated by", IssueLinkType.Direction.INBOUND))
    ));

    // watchers
    final BasicWatchers watchers = issue.getWatchers();
    assertFalse(watchers.isWatching());
    assertEquals(toUri("http://localhost:8090/jira/rest/api/2/issue/TST-2/watchers"), watchers.getSelf());
    assertEquals(1, watchers.getNumWatchers());

    // time tracking
    assertEquals(new TimeTracking(0, 0, 145), issue.getTimeTracking());

    // attachments
    final Iterable<Attachment> attachments = issue.getAttachments();
    assertEquals(7, Iterables.size(attachments));
    final Attachment attachment = findAttachmentByFileName(attachments, "avatar1.png");
    assertEquals(TestConstants.USER_ADMIN_BASIC, attachment.getAuthor());
    assertEquals(359345, attachment.getSize());
    assertEquals(toUri("http://localhost:8090/jira/secure/thumbnail/10070/_thumb_10070.png"), attachment.getThumbnailUri());
    assertEquals(toUri("http://localhost:8090/jira/secure/attachment/10070/avatar1.png"), attachment.getContentUri());
    final Iterable<String> attachmentsNames = EntityHelper.toFileNamesList(attachments);
    assertThat(attachmentsNames, containsInAnyOrder("10000_thumb_snipe.jpg", "Admal pompa ciepÅ‚a.pdf",
        "apache-tomcat-5.5.30.zip", "avatar1.png", "jira_logo.gif", "snipe.png", "transparent-png.png"));

    // worklogs
    final Iterable<Worklog> worklogs = issue.getWorklogs();
    assertEquals(5, Iterables.size(worklogs));
    final Worklog expectedWorklog1 = new Worklog(
        toUri("http://localhost:8090/jira/rest/api/2/issue/10010/worklog/10011"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/10010"), TestConstants.USER1_BASIC,
        TestConstants.USER1_BASIC, "another piece of work",
        toDateTime("2010-08-17T16:38:00.013+02:00"), toDateTime("2010-08-17T16:38:24.948+02:00"),
        toDateTime("2010-08-17T16:37:00.000+02:00"), 15, Visibility.role("Developers"));
    final Worklog worklog1 = Iterables.get(worklogs, 1);
    assertEquals(expectedWorklog1, worklog1);

    final Worklog worklog2 = Iterables.get(worklogs, 2);
    assertEquals(Visibility.group("jira-users"), worklog2.getVisibility());

    final Worklog worklog3 = Iterables.get(worklogs, 3);
    assertEquals(StringUtils.EMPTY, worklog3.getComment());

    // comments
    assertEquals(4, Iterables.size(issue.getComments()));
    final Comment comment = issue.getComments().iterator().next();
    assertEquals(Visibility.Type.ROLE, comment.getVisibility().getType());
    assertEquals(TestConstants.USER_ADMIN_BASIC, comment.getAuthor());
    assertEquals(TestConstants.USER_ADMIN_BASIC, comment.getUpdateAuthor());

    // components
    final Iterable<String> componentsNames = EntityHelper.toNamesList(issue.getComponents());
    assertThat(componentsNames, containsInAnyOrder("Component A", "Component B"));
  }
View Full Code Here

    assertThat(componentsNames, containsInAnyOrder("Component A", "Component B"));
  }

  @Test
  public void testParseIssueWithCustomFieldsValues() throws Exception {
    final Issue issue = parseIssue("/json/issue/valid-all-expanded.json");

    // test float value: number, com.atlassian.jira.plugin.system.customfieldtypes:float
    assertEquals(1.457, issue.getField("customfield_10000").getValue());

    // TODO: add assertions for more custom field types after fixing JRJC-122
  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.api.domain.Issue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.