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

Examples of com.atlassian.jira.rest.client.api.IssueRestClient


    assertThatIssueNotExists(issueKey);
  }

  @Test
  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();

    // verify
    assertThatIssueNotExists(issueKey);
    assertThatIssueNotExists(subtask.getKey());
  }
View Full Code Here


    assertThatIssueNotExists(subtask.getKey());
  }

  @Test
  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.  "
        + "You must specify the 'deleteSubtasks' parameter to delete this issue and all its subtasks.", issueKey)));
    issueClient.deleteIssue(issueKey, false).claim();
  }
View Full Code Here

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

  @Test
  public void testDeleteIssueWhenNoSuchIssue() {
    final IssueRestClient issueClient = client.getIssueClient();

    // verify that issue exist
    final String issueKey = "TST-999";
    assertThatIssueNotExists(issueKey);

    // delete issue should thrown 404
    expectedException.expect(rceWithSingleError(404, "Issue Does Not Exist"));
    issueClient.deleteIssue(issueKey, false).claim();
  }
View Full Code Here

  }

  @Test
  public void testDeleteIssueWithoutDeletePermission() {
    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

    assertEquals(2, issue.getVotes().getVotes());
  }

  @Test
  public void testWatchUnwatch() {
    final IssueRestClient issueClient = client.getIssueClient();
    final Issue issue1 = issueClient.getIssue("TST-1").claim();

    Assert.assertThat(issueClient.getWatchers(issue1.getWatchers().getSelf()).claim()
        .getUsers(), not(hasItem(IntegrationTestUtil.USER_ADMIN)));

    issueClient.watch(issue1.getWatchers().getSelf()).claim();
    Assert.assertThat(issueClient.getWatchers(issue1.getWatchers().getSelf()).claim()
        .getUsers(), hasItem(IntegrationTestUtil.USER_ADMIN));

    issueClient.unwatch(issue1.getWatchers().getSelf()).claim();
    Assert.assertThat(issueClient.getWatchers(issue1.getWatchers().getSelf()).claim()
        .getUsers(), not(hasItem(IntegrationTestUtil.USER_ADMIN)));

    Assert.assertThat(issueClient.getWatchers(issue1.getWatchers().getSelf()).claim()
        .getUsers(), hasItem(IntegrationTestUtil.USER1));
    issueClient.removeWatcher(issue1.getWatchers().getSelf(), IntegrationTestUtil.USER1.getName()).claim();
    Assert.assertThat(issueClient.getWatchers(issue1.getWatchers().getSelf()).claim()
        .getUsers(), not(hasItem(IntegrationTestUtil.USER1)));
    issueClient.addWatcher(issue1.getWatchers().getSelf(), IntegrationTestUtil.USER1.getName()).claim();
    Assert.assertThat(issueClient.getWatchers(issue1.getWatchers().getSelf()).claim()
        .getUsers(), hasItem(IntegrationTestUtil.USER1));
  }
View Full Code Here

  }

  @JiraBuildNumberDependent(BN_JIRA_5)
  @Test
  public void testCreateIssueWithNotExistentProject() {
    final IssueRestClient issueClient = client.getIssueClient();

    thrown.expect(RestClientException.class);
    thrown.expectMessage("project is required");

    final IssueInput issueInput = new IssueInputBuilder("BAD", 1L, "Should fail").build();
    issueClient.createIssue(issueInput).claim();
  }
View Full Code Here

  }

  @JiraBuildNumberDependent(BN_JIRA_5)
  @Test
  public void testCreateIssueWithNotExistentIssueType() {
    final IssueRestClient issueClient = client.getIssueClient();

    thrown.expect(RestClientException.class);
    thrown.expectMessage("valid issue type is required");

    final IssueInput issueInput = new IssueInputBuilder("TST", 666L, "Should fail").build();
    issueClient.createIssue(issueInput).claim();
  }
View Full Code Here


  @JiraBuildNumberDependent(BN_JIRA_5)
  @Test
  public void testCreateIssueWithoutProject() {
    final IssueRestClient issueClient = client.getIssueClient();

    thrown.expect(RestClientException.class);
    thrown.expectMessage("project is required");

    final IssueInput issueInput = new IssueInput(ImmutableMap.of(
        "summary", new FieldInput("summary", "Summary"),
        "issuetype", new FieldInput("issuetype", ComplexIssueInputFieldValue.with("id", "1"))
    ));
    issueClient.createIssue(issueInput).claim();
  }
View Full Code Here

  }

  @JiraBuildNumberDependent(BN_JIRA_5)
  @Test
  public void testCreateIssueWithInvalidAdditionalField() {
    final IssueRestClient issueClient = client.getIssueClient();
    final String fieldId = "invalidField";

    thrown.expect(RestClientException.class);
    thrown.expectMessage(String
        .format("Field '%s' cannot be set. It is not on the appropriate screen, or unknown.", fieldId));

    final IssueInput issueInput = new IssueInputBuilder("TST", 1L, "Should fail")
        .setFieldValue(fieldId, "test")
        .build();
    issueClient.createIssue(issueInput).claim();
  }
View Full Code Here

  }

  @JiraBuildNumberDependent(BN_JIRA_5)
  @Test
  public void testCreateIssueWithFieldValueThatIsNotAllowed() {
    final IssueRestClient issueClient = client.getIssueClient();
    final BasicPriority invalidPriority = new BasicPriority(null, 666L, "Invalid Priority");

    thrown.expect(RestClientException.class);
    thrown.expectMessage(String
        .format("Invalid value '%s' passed for customfield 'My Radio buttons'. Allowed values are: 10000[abc], 10001[Another], 10002[The last option], -1", invalidPriority
            .getId()));

    final IssueInput issueInput = new IssueInputBuilder("TST", 1L, "Should fail")
        .setFieldValue("customfield_10001", invalidPriority)
        .build();
    issueClient.createIssue(issueInput).claim();
  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.api.IssueRestClient

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.