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

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


  }

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetAllRolesForProject() {
    final Project anonymousProject = client.getProjectClient().getProject(ANONYMOUS_PROJECT_KEY, pm);
    final Iterable<ProjectRole> projectRoles = client.getProjectRolesRestClient().getRoles(anonymousProject.getSelf(), pm);
    final Iterable<ProjectRole> projectRolesWithoutSelf = Iterables.transform(
        projectRoles,
        new Function<ProjectRole, ProjectRole>() {
          @Override
          public ProjectRole apply(final ProjectRole role) {
View Full Code Here


  }

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetProjectRoleWithRoleKeyErrorCode() {
    final Project anonProject = client.getProjectClient().getProject(ANONYMOUS_PROJECT_KEY, pm);
    exception.expect(RestClientException.class);
    exception.expectMessage("Can not retrieve a role actor for a null project role.");
    client.getProjectRolesRestClient().getRole(anonProject.getSelf(), -1l, pm);
  }
View Full Code Here

    });
  }

  @Test
  public void testGetProject() throws URISyntaxException {
    final Project project = client.getProjectClient().getProject("TST", pm);
    assertEquals("TST", project.getKey());
    assertEquals(IntegrationTestUtil.USER_ADMIN_LATEST, project.getLead());
    assertEquals(2, Iterables.size(project.getVersions()));
    assertEquals(2, Iterables.size(project.getComponents()));
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    if (isJira4x4OrNewer()) {
      assertTrue(issueTypes.isSupported());
      final Iterator<IssueType> issueTypesIterator = issueTypes.iterator();
      assertTrue(issueTypesIterator.hasNext());
      final IssueType it = issueTypesIterator.next();
View Full Code Here

    }
  }

  @Test
  public void testGetRestrictedProject() {
    final Project project = client.getProjectClient().getProject("RST", pm);
    assertEquals("RST", project.getKey());

    setClient(TestConstants.USER1_USERNAME, TestConstants.USER1_PASSWORD);
    client.getProjectClient().getProject("TST", pm);
    // @todo when JRADEV-3519 - instead of NOT_FOUND, FORBIDDEN code should be returned by JIRA
    final String message = getCannotViewProjectErrorMessage("RST");
View Full Code Here

      public void run() {
        client.getProjectClient().getProject("TST", pm);
      }
    });

    final Project project = client.getProjectClient().getProject("ANNON", pm);
    assertEquals("ANNON", project.getKey());

  }
View Full Code Here

public class ProjectJsonParserTest {
  private final ProjectJsonParser parser = new ProjectJsonParser();

  @Test
  public void testParse() throws Exception {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/valid.json"));
    assertEquals(TestUtil.toUri("http://localhost:8090/jira/rest/api/latest/project/TST"), project.getSelf());
    assertEquals("This is my description here.\r\nAnother line.", project.getDescription());
    assertEquals(TestConstants.USER_ADMIN, project.getLead());
    assertEquals("http://example.com", project.getUri().toString());
    assertEquals("TST", project.getKey());
    assertThat(project.getVersions(), containsInAnyOrder(TestConstants.VERSION_1, TestConstants.VERSION_1_1));
    assertThat(project.getComponents(), containsInAnyOrder(TestConstants.BCOMPONENT_A, TestConstants.BCOMPONENT_B));
        assertNull(project.getName());
    assertThat(project.getIssueTypes(), IsEmptyIterable.<IssueType>emptyIterable());
  }
View Full Code Here

    assertThat(project.getIssueTypes(), IsEmptyIterable.<IssueType>emptyIterable());
  }

  @Test
  public void testParseProjectWithNoUrl() throws JSONException {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/project-no-url.json"));
    assertEquals("MYT", project.getKey());
    assertNull(project.getUri());
    assertNull(project.getDescription());
  }
View Full Code Here

    assertNull(project.getDescription());
  }

  @Test
  public void testParseProjectInJira4x4() throws JSONException, URISyntaxException {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/project-jira-4-4.json"));
    assertEquals("TST", project.getKey()); //2010-08-25
    assertEquals(new DateMidnight(2010, 8, 25).toInstant(), Iterables.getLast(project.getVersions()).getReleaseDate().toInstant());
        assertEquals("Test Project", project.getName());
    assertThat(project.getIssueTypes(), containsInAnyOrder(
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issueType/1"), null, "Bug", false, null, null),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issueType/2"), null, "New Feature", false, null, null),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issueType/3"), null, "Task", false, null, null),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issueType/4"), null, "Improvement", false, null, null),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issueType/5"), null, "Sub-task", true, null, null)
View Full Code Here

    ));
  }

  @Test
  public void testParseProjectInJira5x0() throws JSONException, URISyntaxException {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/project-jira-5-0.json"));
    assertEquals("TST", project.getKey());
    assertEquals(new DateMidnight(2010, 8, 25).toInstant(), Iterables.getLast(project.getVersions()).getReleaseDate().toInstant());
    assertEquals("Test Project", project.getName());
    assertThat(project.getIssueTypes(), containsInAnyOrder(
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issuetype/1"), 1L, "Bug", false, "A problem which impairs or prevents the functions of the product.", new URI("http://localhost:2990/jira/images/icons/bug.gif")),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issuetype/2"), 2L, "New Feature", false, "A new feature of the product, which has yet to be developed.", new URI("http://localhost:2990/jira/images/icons/newfeature.gif")),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issuetype/3"), 3L, "Task", false, "A task that needs to be done.", new URI("http://localhost:2990/jira/images/icons/task.gif")),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issuetype/4"), 4L, "Improvement", false, "An improvement or enhancement to an existing feature or task.", new URI("http://localhost:2990/jira/images/icons/improvement.gif")),
        new IssueType(new URI("http://localhost:2990/jira/rest/api/latest/issuetype/5"), 5L, "Sub-task", true, "The sub-task of the issue", new URI("http://localhost:2990/jira/images/icons/issue_subtask.gif"))
View Full Code Here

    final Collection<BasicComponent> components = JsonParseUtil.parseJsonArray(json.getJSONArray("components"), componentJsonParser);
    final JSONArray issueTypesArray = json.optJSONArray("issueTypes");
    final Collection<IssueType> issueTypes = (issueTypesArray == null)
        ? Collections.<IssueType>emptyList()
        : JsonParseUtil.parseJsonArray(issueTypesArray, issueTypeJsonParser);
    return new Project(self, key, name, description, lead, uri, versions, components, issueTypes);

  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.domain.Project

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.