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

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


    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 testParseIssueWithoutLabels() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-without-labels.json");
    assertThat(issue.getLabels(), IsEmptyCollection.<String>empty());
  }
View Full Code Here

    final Set<String> labels = Sets.newHashSet(parseOptionalArrayNotNullable(shouldUseNestedValueAttribute, s,
        jsonWeakParserForString, FIELDS, LABELS_FIELD.id));

    final Collection<ChangelogGroup> changelog = parseOptionalArray(false, s, new JsonWeakParserForJsonObject<ChangelogGroup>(changelogJsonParser), "changelog", "histories");
    return new Issue(summary, selfUri, s.getString("key"), JsonParseUtil.getOptionalLong(s, "id"), project, issueType, status,
        description, priority, resolution, attachments, reporter, assignee, creationDate, updateDate,
        dueDate, affectedVersions, fixVersions, components, timeTracking, fields, comments,
        transitionsUri, issueLinks,
        votes, worklogs, watchers, expandos, subtasks, changelog, labels, s);
  }
View Full Code Here

@Restore("jira2-export-unassigned.xml")
public class JerseyIssueRestClientWithAnonymousThingsJerseyRestClientTest extends AbstractJerseyRestClientTest {

  @Test
  public void testGetUnassignedIssue() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1", pm);
    assertEquals("TST-1", issue.getKey());
    assertNull(issue.getAssignee());
  }
View Full Code Here

  // no timezone here, as JIRA does not store timezone information in its dump file
  private final DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime("2010-08-04T17:46:45.454");

  @Test
  public void testGetWatchers() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1", new NullProgressMonitor());
    final Watchers watchers = client.getIssueClient().getWatchers(issue.getWatchers().getSelf(), new NullProgressMonitor());
    assertEquals(1, watchers.getNumWatchers());
    assertFalse(watchers.isWatching());
    assertThat(watchers.getUsers(), containsInAnyOrder(USER1));
  }
View Full Code Here

  }

  @Test
  public void testGetWatcherForAnonymouslyAccessibleIssue() {
    setAnonymousMode();
    final Issue issue = client.getIssueClient().getIssue("ANNON-1", new NullProgressMonitor());
    final Watchers watchers = client.getIssueClient().getWatchers(issue.getWatchers().getSelf(), pm);
    assertEquals(1, watchers.getNumWatchers());
    assertFalse(watchers.isWatching());
    assertTrue("JRADEV-3594 bug!!!", Iterables.isEmpty(watchers.getUsers()));
    // to save time
    assertEquals(new TimeTracking(2700, 2400, null), issue.getTimeTracking());
  }
View Full Code Here

  @Test
  public void testDeleteAndMoveVersion() {
    if (!isJira4x4OrNewer()) {
      return;
    }
    final Issue issue = client.getIssueClient().getIssue("TST-2", pm);
    assertThat(Iterables.transform(issue.getFixVersions(), new VersionToNameMapper()), containsInAnyOrder("1.1"));
    assertThat(Iterables.transform(issue.getAffectedVersions(), new VersionToNameMapper()), containsInAnyOrder("1", "1.1"));

    final Version version1 = EntityHelper.findEntityByName(client.getProjectClient().getProject("TST", pm).getVersions(), "1");

    final Version version = Iterables.getOnlyElement(issue.getFixVersions());
    final URI fakeVersionUri = TestUtil.toUri("http://localhost/version/3432");
    final URI fakeVersionUri2 = TestUtil.toUri("http://localhost/version/34323");
    // @todo expected error code should be rather NOT FOUND in all cases below - see JRA-25045
    assertInvalidMoveToVersion(version.getSelf(), fakeVersionUri, null, "The fix version with id " +
        getLastPathSegment(fakeVersionUri) + " does not exist.", Response.Status.BAD_REQUEST);
    // @todo fix when bug JRA-25044 is fixed
    assertInvalidMoveToVersion(version.getSelf(), TestUtil.toUri("http://localhost/version/fdsa34323"), null,
        "Could not find version for id '-1'", Response.Status.NOT_FOUND);
    assertInvalidMoveToVersion(version.getSelf(), null, fakeVersionUri2, "The affects version with id " +
        getLastPathSegment(fakeVersionUri2) + " does not exist.", Response.Status.BAD_REQUEST);
    assertInvalidMoveToVersion(version.getSelf(), fakeVersionUri, fakeVersionUri2, "The affects version with id " +
        getLastPathSegment(fakeVersionUri2) + " does not exist.", Response.Status.BAD_REQUEST);

    assertEquals(1, client.getVersionRestClient().getNumUnresolvedIssues(version.getSelf(), pm));
    assertEquals(new VersionRelatedIssuesCount(version.getSelf(), 1, 1), client.getVersionRestClient().getVersionRelatedIssuesCount(version.getSelf(), pm));
    assertEquals(new VersionRelatedIssuesCount(version.getSelf(), 1, 1), client.getVersionRestClient().getVersionRelatedIssuesCount(version.getSelf(), pm));

    // now removing the first version
    client.getVersionRestClient().removeVersion(version.getSelf(), version1.getSelf(), version1.getSelf(), pm);
    final Issue issueAfterVerRemoval = client.getIssueClient().getIssue("TST-2", pm);
    assertThat(Iterables.transform(issueAfterVerRemoval.getFixVersions(), new VersionToNameMapper()), containsInAnyOrder("1"));
    assertThat(Iterables.transform(issueAfterVerRemoval.getAffectedVersions(), new VersionToNameMapper()), containsInAnyOrder("1"));
    assertThat(Iterables.transform(client.getProjectClient().getProject("TST", pm).getVersions(), new VersionToNameMapper()),
        containsInAnyOrder("1"));

    TestUtil.assertErrorCode(Response.Status.BAD_REQUEST, "You cannot move the issues to the version being deleted.", new Runnable() {
      @Override
      public void run() {
        client.getVersionRestClient().removeVersion(version1.getSelf(), version1.getSelf(), version1.getSelf(), pm);
      }
    });

    // now removing the other version
    client.getVersionRestClient().removeVersion(version1.getSelf(), null, null, pm);
    final Issue issueAfter2VerRemoval = client.getIssueClient().getIssue("TST-2", pm);
    assertThat(Iterables.transform(issueAfter2VerRemoval.getFixVersions(), new VersionToNameMapper()), IsEmptyIterable.<String>emptyIterable());
    assertThat(Iterables.transform(issueAfter2VerRemoval.getAffectedVersions(), new VersionToNameMapper()), IsEmptyIterable.<String>emptyIterable());
  }
View Full Code Here

    // create
    final BasicIssue basicCreatedIssue = issueClient.createIssue(issueInputBuilder.build(), pm);
    assertNotNull(basicCreatedIssue.getKey());

    // get issue and check if everything was set as we expected
    final Issue createdIssue = issueClient.getIssue(basicCreatedIssue.getKey(), pm);
    assertNotNull(createdIssue);

    assertEquals(basicCreatedIssue.getKey(), createdIssue.getKey());
    assertEquals(project.getKey(), createdIssue.getProject().getKey());
    assertEquals(issueType.getId(), createdIssue.getIssueType().getId());
    assertEquals(summary, createdIssue.getSummary());
    assertEquals(description, createdIssue.getDescription());

    final BasicUser actualAssignee = createdIssue.getAssignee();
    assertNotNull(actualAssignee);
    assertEquals(assignee.getSelf(), actualAssignee.getSelf());

    final Iterable<String> actualAffectedVersionsNames = EntityHelper.toNamesList(createdIssue.getAffectedVersions());
    assertThat(affectedVersionsNames, containsInAnyOrder(toArray(actualAffectedVersionsNames, String.class)));

    final Iterable<String> actualFixVersionsNames = EntityHelper.toNamesList(createdIssue.getFixVersions());
    assertThat(fixVersionsNames, containsInAnyOrder(toArray(actualFixVersionsNames, String.class)));

    assertTrue(createdIssue.getComponents().iterator().hasNext());
    assertEquals(component.getId(), createdIssue.getComponents().iterator().next().getId());

    // strip time from dueDate
    final DateTime expectedDueDate = JsonParseUtil.parseDate(JsonParseUtil.formatDate(dueDate));
    assertEquals(expectedDueDate, createdIssue.getDueDate());

    final BasicPriority actualPriority = createdIssue.getPriority();
    assertNotNull(actualPriority);
    assertEquals(priority.getId(), actualPriority.getId());
  }
View Full Code Here

    final IssueInput issueInput = new IssueInputBuilder(project, issueType, summary).build();
    final BasicIssue basicCreatedIssue = issueClient.createIssue(issueInput, pm);
    assertNotNull(basicCreatedIssue.getKey());

    // get issue and check if everything was set as we expected
    final Issue createdIssue = issueClient.getIssue(basicCreatedIssue.getKey(), pm);
    assertNotNull(createdIssue);

    assertEquals(basicCreatedIssue.getKey(), createdIssue.getKey());
    assertEquals(project.getKey(), createdIssue.getProject().getKey());
    assertEquals(issueType.getId(), createdIssue.getIssueType().getId());
    assertEquals(summary, createdIssue.getSummary());
  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.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.