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

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


    assertEquals("My Test Project", issue.getProject().getName());
  }

  @Test
  public void testParseIssueJiraRepresentationJrjc49() throws JSONException {
    final Issue issue = parseIssue("/json/issue/jrjc49.json");
    final Iterable<Worklog> worklogs = issue.getWorklogs();
    assertEquals(1, Iterables.size(worklogs));
    final Worklog worklog = Iterables.get(worklogs, 0);
    assertEquals("Worklog comment should be returned as empty string, when JIRA doesn't include it in reply",
        StringUtils.EMPTY, worklog.getComment());
    assertEquals(180, worklog.getMinutesSpent());
View Full Code Here


    assertEquals("deleteduser", worklog.getAuthor().getName());
  }

  @Test
  public void testParseIssueJira5x0RepresentationNullCustomField() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-5.0-null-custom-field.json");
    assertEquals(null, issue.getField("customfield_10000").getValue());
    assertNull(issue.getIssueLinks());
  }
View Full Code Here

    assertTransitionWithNumericCustomField(fieldInput2, newValue);
  }


  private void assertTransitionWithNumericCustomField(FieldInput fieldInput, Double expectedValue) {
    final Issue issue = client.getIssueClient().getIssue("TST-1").claim();
    assertNull(issue.getField(NUMERIC_CUSTOMFIELD_ID).getValue());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue).claim();

    final Transition transitionFound = TestUtil.getTransitionByName(transitions, "Estimate");
    assertNotNull(transitionFound);
    assertTrue(Iterables.contains(transitionFound.getFields(),
        new Transition.Field(NUMERIC_CUSTOMFIELD_ID, false,
            IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ? NUMERIC_CUSTOMFIELD_TYPE_V5 : NUMERIC_CUSTOMFIELD_TYPE)));
    client.getIssueClient().transition(issue, new TransitionInput(transitionFound.getId(), Arrays.asList(fieldInput),
        Comment.valueOf("My test comment"))).claim();
    final Issue changedIssue = client.getIssueClient().getIssue("TST-1").claim();
    assertTrue(changedIssue.getField(NUMERIC_CUSTOMFIELD_ID).getValue().equals(expectedValue));
  }
View Full Code Here

  public void testDeleteIssue() {
    final IssueRestClient issueClient = client.getIssueClient();

    // verify that issue exist
    final String issueKey = "TST-1";
    final Issue issue = issueClient.getIssue(issueKey).claim();
    assertEquals(issueKey, issue.getKey());

    // delete issue
    issueClient.deleteIssue(issueKey, false).claim();

    // verify
View Full Code Here

  public void testDeleteIssueWithSubtasks() {
    final IssueRestClient issueClient = client.getIssueClient();

    // verify that issue exist and create subtask
    final String issueKey = "TST-1";
    final Issue issue = issueClient.getIssue(issueKey).claim();
    assertEquals(issueKey, issue.getKey());
    final BasicIssue subtask = addSubtaskToIssue(issue);
    System.out.println(subtask);

    // delete issue
    issueClient.deleteIssue(issueKey, true).claim();
View Full Code Here

  public void testDeleteIssueWithSubtasksWhenDeleteSubtasksIsFalse() {
    final IssueRestClient issueClient = client.getIssueClient();

    // verify that issue exist and create subtask
    final String issueKey = "TST-1";
    final Issue issue = issueClient.getIssue(issueKey).claim();
    assertEquals(issueKey, issue.getKey());
    BasicIssue subtask = addSubtaskToIssue(issue);
    System.out.println(subtask);

    // delete issue
    expectedException.expect(rceWithSingleError(400, String.format("The issue '%s' has subtasks.  "
View Full Code Here

    setAnonymousMode();
    final IssueRestClient issueClient = client.getIssueClient();

    // verify that issue doesn't exist
    final String issueKey = "ANONEDIT-2";
    final Issue issue = issueClient.getIssue(issueKey).claim();
    assertEquals(issueKey, issue.getKey());

    // delete issue should thrown 401
    expectedException.expect(rceWithSingleError(401, "You do not have permission to delete issues in this project."));
    issueClient.deleteIssue(issueKey, false).claim();
  }
View Full Code Here

    issueClient.deleteIssue(issueKey, false).claim();
  }

  @Test
  public void testTransitionWithNumericCustomFieldAndInteger() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1").claim();
    assertNull(issue.getField(NUMERIC_CUSTOMFIELD_ID).getValue());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue).claim();
    Transition transitionFound = TestUtil.getTransitionByName(transitions, "Estimate");

    assertNotNull(transitionFound);
    assertTrue(Iterables.contains(transitionFound.getFields(),
        new Transition.Field(NUMERIC_CUSTOMFIELD_ID, false,
            IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ? NUMERIC_CUSTOMFIELD_TYPE_V5 : NUMERIC_CUSTOMFIELD_TYPE)));
    final double newValue = 123;
    final FieldInput fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, newValue);
    client.getIssueClient().transition(issue.getTransitionsUri(), new TransitionInput(transitionFound.getId(), Arrays
        .asList(fieldInput),
        Comment.valueOf("My test comment"))).claim();
    final Issue changedIssue = client.getIssueClient().getIssue("TST-1").claim();
    assertEquals(newValue, changedIssue.getField(NUMERIC_CUSTOMFIELD_ID).getValue());
  }
View Full Code Here

    assertEquals(newValue, changedIssue.getField(NUMERIC_CUSTOMFIELD_ID).getValue());
  }

  @Test
  public void testTransitionWithInvalidNumericField() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1").claim();
    assertNull(issue.getField(NUMERIC_CUSTOMFIELD_ID).getValue());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue).claim();
    final Transition transitionFound = TestUtil.getTransitionByName(transitions, "Estimate");

    assertNotNull(transitionFound);
    assertTrue(Iterables.contains(transitionFound.getFields(),
View Full Code Here

        "My text which I am just adding " + new DateTime(), "some-fake-group");
    assertInvalidCommentInput(comment, "Group: some-fake-group does not exist.");
  }

  private void assertInvalidCommentInput(final Comment comment, String expectedErrorMsg) {
    final Issue issue = client.getIssueClient().getIssue("TST-1").claim();
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue).claim();
    final Transition transitionFound = TestUtil.getTransitionByName(transitions, "Estimate");
    final String errorMsg = doesJiraServeCorrectlyErrorMessagesForBadRequestWhileTransitioningIssue()
        ? expectedErrorMsg : null;
    assertErrorCode(Response.Status.BAD_REQUEST, errorMsg, new Runnable() {
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.