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

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


    final Collection<Version> versions = JsonParseUtil.parseJsonArray(json.getJSONArray("versions"), versionJsonParser);
    final Collection<BasicComponent> components = JsonParseUtil.parseJsonArray(json.getJSONArray("components"), componentJsonParser);
    final JSONArray issueTypesArray = json.optJSONArray("issueTypes");
    final OptionalIterable<IssueType> issueTypes = JsonParseUtil.parseOptionalJsonArray(issueTypesArray, issueTypeJsonParser);
    final Collection<BasicProjectRole> projectRoles = basicProjectRoleJsonParser.parse(JsonParseUtil.getOptionalJsonObject(json, "roles"));
    return new Project(self, key, name, id, description, lead, uri, versions, components, issueTypes, projectRoles);
  }
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());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    assertFalse(issueTypes.isSupported());
    assertThat(issueTypes, IsEmptyIterable.<IssueType>emptyIterable());
  }
View Full Code Here

    assertThat(issueTypes, 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());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    assertTrue(issueTypes.isSupported());
    assertThat(issueTypes, containsInAnyOrder(
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/1"), null, "Bug", false, null, null),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/2"), null, "New Feature", false, null, null),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/3"), null, "Task", false, 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());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    assertTrue(issueTypes.isSupported());
    assertThat(issueTypes, containsInAnyOrder(
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/1"), 1L, "Bug", false, "A problem which impairs or prevents the functions of the product.", TestUtil.toUri("http://localhost:2990/jira/images/icons/bug.gif")),
        new IssueType(TestUtil.toUri("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.", TestUtil.toUri("http://localhost:2990/jira/images/icons/newfeature.gif")),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/3"), 3L, "Task", false, "A task that needs to be done.", TestUtil.toUri("http://localhost:2990/jira/images/icons/task.gif")),
View Full Code Here

    ));
  }

  @Test
  public void testParseProjectWithBasicRoles() throws JSONException, URISyntaxException {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/project-jira-5-0.json"));
    final Iterable<BasicProjectRole> projectRoles = project.getProjectRoles();
    assertThat(projectRoles, containsInAnyOrder(
        new BasicProjectRole(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/project/TST/role/10000"), "Users"),
        new BasicProjectRole(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/project/TST/role/10001"), "Developers"),
        new BasicProjectRole(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/project/TST/role/10002"), "Administrators")
    ));
View Full Code Here

  public final ExpectedException exception = ExpectedException.none();

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetProjectRoleWithRoleKeyFromAnonymousProject() {
    final Project anonProject = client.getProjectClient().getProject(ANONYMOUS_PROJECT_KEY, pm);
    final ProjectRole role = client.getProjectRolesRestClient().getRole(anonProject.getSelf(), 10000l, pm);
    assertNotNull(role);
    assertEquals("Users", role.getName());
    assertEquals("A project role that represents users in a project", role.getDescription());
    final RoleActor actor = Iterables.getOnlyElement(role.getActors());
    assertEquals("jira-users", actor.getDisplayName());
View Full Code Here

  }

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetProjectRoleWithRoleKeyFromRestrictedProject() {
    final Project restrictedProject = client.getProjectClient().getProject(RESTRICTED_PROJECT_KEY, pm);
    final ProjectRole role = client.getProjectRolesRestClient().getRole(restrictedProject.getSelf(), 10000l, pm);
    assertNotNull(role);
    assertEquals("Users", role.getName());
    assertEquals("A project role that represents users in a project", role.getDescription());
    final RoleActor actor = Iterables.getOnlyElement(role.getActors());
    assertEquals("Administrator", actor.getDisplayName());
View Full Code Here

  }

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetProjectRoleWithRoleKeyFromRestrictedProjectWithoutPermission() {
    final Project restrictedProject = client.getProjectClient().getProject(RESTRICTED_PROJECT_KEY, pm);
    setAnonymousMode();
    exception.expect(RestClientException.class);
    exception.expectMessage("com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404");
    client.getProjectRolesRestClient().getRole(restrictedProject.getUri(), 10000l, pm);
  }
View Full Code Here

  }

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetProjectRoleWithFullURI() {
    final Project anonProject = client.getProjectClient().getProject(ANONYMOUS_PROJECT_KEY, pm);
    final URI roleURI = client.getProjectRolesRestClient().getRole(anonProject.getSelf(), 10000l, pm).getSelf();
    final ProjectRole role = client.getProjectRolesRestClient().getRole(roleURI, pm);
    assertNotNull(role);
    assertEquals("Users", role.getName());
    assertEquals("A project role that represents users in a project", role.getDescription());
    final RoleActor actor = Iterables.getOnlyElement(role.getActors());
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.