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

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


  // 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").claim();
    final Watchers watchers = client.getIssueClient().getWatchers(issue.getWatchers().getSelf()).claim();
    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").claim();
    final Watchers watchers = client.getIssueClient().getWatchers(issue.getWatchers().getSelf()).claim();
    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 testGetIssueWithAnonymouslyCreatedAttachment() {
    setAnonymousMode();
    final Issue issue = client.getIssueClient().getIssue("ANONEDIT-1").claim();
    final Iterator<Attachment> attachmentIterator = issue.getAttachments().iterator();
    assertTrue(attachmentIterator.hasNext());
    assertNull(attachmentIterator.next().getAuthor());
  }
View Full Code Here

  }

  @Test
  public void testGetIssueWithAnonymouslyCreatedWorklogEntry() {
    setAnonymousMode();
    final Issue issue = client.getIssueClient().getIssue("ANONEDIT-2").claim();
    final Iterator<Worklog> worklogIterator = issue.getWorklogs().iterator();
    assertTrue(worklogIterator.hasNext());
    assertNull(worklogIterator.next().getAuthor());
  }
View Full Code Here

  }


  @Test
  public void testGetIssue() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1").claim();
    assertEquals("TST-1", issue.getKey());
    assertEquals(Long.valueOf(10000), issue.getId());
    assertTrue(issue.getSelf().toString().startsWith(jiraUri.toString()));
    assertEqualsNoUri(IntegrationTestUtil.USER_ADMIN, issue.getReporter());
    assertEqualsNoUri(IntegrationTestUtil.USER_ADMIN, issue.getAssignee());

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

    assertEquals(3, Iterables.size(issue.getComments()));
    final Iterable<String> expectedExpandos = isJira5xOrNewer()
        ? ImmutableList.of("renderedFields", "names", "schema", "transitions", "operations", "editmeta", "changelog")
        : ImmutableList.of("html");
    assertThat(ImmutableList.copyOf(issue.getExpandos()), containsInAnyOrder(toArray(expectedExpandos, String.class)));
    assertEquals(new TimeTracking(null, 0, 190), issue.getTimeTracking());
    assertTrue(Iterables.size(issue.getFields()) > 0);

    assertEquals(IntegrationTestUtil.START_PROGRESS_TRANSITION_ID, Iterables.size(issue.getAttachments()));
    final Iterable<Attachment> items = issue.getAttachments();
    assertNotNull(items);
    Attachment attachment1 = new Attachment(IntegrationTestUtil.concat(
        IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ? UriBuilder.fromUri(jiraUri).path("/rest/api/2/").build()
            : jiraRestRootUri, "/attachment/10040"),
        "dla Paw\u0142a.txt", IntegrationTestUtil.USER_ADMIN, dateTime, 643, "text/plain",
        IntegrationTestUtil.concat(jiraUri, "/secure/attachment/10040/dla+Paw%C5%82a.txt"), null);

    assertEquals(attachment1, items.iterator().next());

    // test for changelog
    assertNull(issue.getChangelog());

    final Issue issueWithChangelogAndOperations = client.getIssueClient().getIssue("TST-2", EnumSet.of(CHANGELOG, OPERATIONS))
        .claim();
    final Iterable<ChangelogGroup> changelog = issueWithChangelogAndOperations.getChangelog();
    if (isJira5xOrNewer()) {
      assertNotNull(changelog);
      final ChangelogGroup chg1 = Iterables.get(changelog, 18);
      assertEquals("admin", chg1.getAuthor().getName());
      assertEquals("Administrator", chg1.getAuthor().getDisplayName());
      assertEquals(new DateTime(2010, 8, 17, 16, 40, 34, 924).toInstant(), chg1.getCreated().toInstant());

      assertEquals(Collections
          .singletonList(new ChangelogItem(FieldType.JIRA, "status", "1", "Open", "3", "In Progress")), chg1
          .getItems());

      final ChangelogGroup chg2 = Iterables.get(changelog, 20);
      assertEquals("admin", chg2.getAuthor().getName());
      assertEquals("Administrator", chg2.getAuthor().getDisplayName());
      assertEquals(new DateTime(2010, 8, 24, 16, 10, 23, 468).toInstant(), chg2.getCreated().toInstant());

      final List<ChangelogItem> expected = ImmutableList.of(
          new ChangelogItem(FieldType.JIRA, "timeoriginalestimate", null, null, "0", "0"),
          new ChangelogItem(FieldType.CUSTOM, "My Radio buttons", null, null, null, "Another"),
          new ChangelogItem(FieldType.CUSTOM, "project3", null, null, "10000", "Test Project"),
          new ChangelogItem(FieldType.CUSTOM, "My Number Field New", null, null, null, "1.45")
      );
      assertEquals(expected, chg2.getItems());
    }
    final Operations operations = issueWithChangelogAndOperations.getOperations();
    if (isJira5xOrNewer()) {
      assertThat(operations, notNullValue());
      assertThat(operations.getOperationById("log-work"), allOf(
              instanceOf(OperationLink.class),
              hasProperty("id", is("log-work"))
View Full Code Here

    }
  }

  @Test
  public void testGetIssueWithNonTrivialComments() {
    final Issue issue = client.getIssueClient().getIssue("TST-2").claim();
    final Iterable<Comment> comments = issue.getComments();
    assertEquals(3, Iterables.size(comments));
    final Comment c1 = Iterables.get(comments, 0);
    assertEquals(Visibility.role("Administrators"), c1.getVisibility());

    final Comment c3 = Iterables.get(comments, 2);
View Full Code Here

  }

  @Test
  public void testGetVoter() {
    final Issue issue = client.getIssueClient().getIssue("TST-1").claim();
    final Votes votes = client.getIssueClient().getVotes(issue.getVotes().getSelf()).claim();
    assertFalse(votes.hasVoted());
    assertThat(votes.getUsers(), containsInAnyOrder(USER1));
  }
View Full Code Here

    assertThat(votes.getUsers(), containsInAnyOrder(USER1));
  }

  @Test
  public void testGetVotersWithoutViewIssuePermission() {
    final Issue issue = client.getIssueClient().getIssue("RST-1").claim();
    setUser2();
    final String optionalDot = isJira5xOrNewer() ? "." : "";
    assertErrorCode(Response.Status.FORBIDDEN,
        "You do not have the permission to see the specified issue" + optionalDot, new Runnable() {
      @Override
      public void run() {
        client.getIssueClient().getVotes(issue.getVotes().getSelf()).claim();
      }
    });
  }
View Full Code Here

    assertNumVotesAndNoVotersDetails("ANNON-1", 0);
  }


  private void assertNumVotesAndNoVotersDetails(final String issueKey, final int numVotes) {
    final Issue issue = client.getIssueClient().getIssue(issueKey).claim();
    assertEquals(numVotes, issue.getVotes().getVotes());
    assertFalse(issue.getVotes().hasVoted());
    final Votes votes = client.getIssueClient().getVotes(issue.getVotes().getSelf()).claim();
    assertFalse(votes.hasVoted());
    assertEquals(numVotes, votes.getVotes());
    assertTrue(Iterables.isEmpty(votes.getUsers()));
  }
View Full Code Here

  }


  @Test
  public void testGetTransitions() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1").claim();
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue).claim();
    assertEquals(4, Iterables.size(transitions));
    assertTrue(Iterables
        .contains(transitions, new Transition("Start Progress", IntegrationTestUtil.START_PROGRESS_TRANSITION_ID, Collections
            .<Transition.Field>emptyList())));
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.