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

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


    final IssueInput issueInput = builder.build();

    final BasicIssue basicCreatedIssue = issueClient.createIssue(issueInput, pm);
    assertNotNull(basicCreatedIssue);

    final Issue createdIssue = issueClient.getIssue(basicCreatedIssue.getKey(), pm);
    assertNotNull(createdIssue);

    log.log("Created new issue successfully, key: " + basicCreatedIssue.getKey());

    // assert few fields
    IssueInputBuilder actualBuilder = new IssueInputBuilder(createdIssue.getProject(), createdIssue
        .getIssueType(), createdIssue.getSummary())
        .setPriority(createdIssue.getPriority())
        .setReporter(createdIssue.getReporter())
        .setAssignee(createdIssue.getAssignee())
        .setDescription(createdIssue.getDescription());

    final Collection<FieldInput> actualValues = actualBuilder.build().getFields().values();
    final Collection<FieldInput> expectedValues = issueInput.getFields().values();

    assertThat(expectedValues, hasItems(toArray(actualValues, FieldInput.class)));
View Full Code Here


  }

  @Test
  public void testGetIssueWithAnonymouslyCreatedAttachment() {
    setAnonymousMode();
    final Issue issue = client.getIssueClient().getIssue("ANONEDIT-1", new NullProgressMonitor());
    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", new NullProgressMonitor());
    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", pm);
    assertEquals("TST-1", issue.getKey());
    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"), IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ? (long) 10040 : null,
        "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 issueWithChangelog = client.getIssueClient().getIssue("TST-2", EnumSet.of(IssueRestClient.Expandos.CHANGELOG), pm);
    final Iterable<ChangelogGroup> changelog = issueWithChangelog.getChangelog();
    if (isJira5xOrNewer()) {
      assertNotNull(changelog);
      final ChangelogGroup chg1 = Iterables.get(changelog, 18);
      assertEquals("admin", chg1.getAuthor().getName());
      assertEquals("Administrator", chg1.getAuthor().getDisplayName());
View Full Code Here

    }
  }

  @Test
  public void testGetIssueWithNonTrivialComments() {
    final Issue issue = client.getIssueClient().getIssue("TST-2", pm);
    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

  public void testGetIssueWithNoViewWatchersPermission() {
    setUser1();
    assertTrue(client.getIssueClient().getIssue("TST-1", pm).getWatchers().isWatching());

    setUser2();
    final Issue issue = client.getIssueClient().getIssue("TST-1", pm);
    assertFalse(issue.getWatchers().isWatching());
    client.getIssueClient().watch(issue.getWatchers().getSelf(), pm);
    final Issue watchedIssue = client.getIssueClient().getIssue("TST-1", pm);
    assertTrue(watchedIssue.getWatchers().isWatching());
    assertEquals(2, watchedIssue.getWatchers().getNumWatchers());

    // although there are 2 watchers, only one is listed with details - the caller itself, as the caller does not
    // have view watchers and voters permission
    assertThat(client.getIssueClient().getWatchers(watchedIssue.getWatchers().getSelf(), pm).getUsers(), containsInAnyOrder(USER2));
  }
View Full Code Here

    assertThat(client.getIssueClient().getWatchers(watchedIssue.getWatchers().getSelf(), pm).getUsers(), containsInAnyOrder(USER2));
  }

  @Test
  public void testGetVoter() {
    final Issue issue = client.getIssueClient().getIssue("TST-1", pm);
    final Votes votes = client.getIssueClient().getVotes(issue.getVotes().getSelf(), pm);
    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", pm);
    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(), pm);
      }
    });
  }
View Full Code Here

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


  private void assertNumVotesAndNoVotersDetails(final String issueKey, final int numVotes) {
    final Issue issue = client.getIssueClient().getIssue(issueKey, pm);
    assertEquals(numVotes, issue.getVotes().getVotes());
    assertFalse(issue.getVotes().hasVoted());
    final Votes votes = client.getIssueClient().getVotes(issue.getVotes().getSelf(), pm);
    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", new NullProgressMonitor());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue, pm);
    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.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.