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

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


  }

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetProjectRoleWithRoleKeyFromRestrictedProject() {
    final Project restrictedProject = client.getProjectClient().getProject(RESTRICTED_PROJECT_KEY).claim();
    final ProjectRole role = client.getProjectRolesRestClient().getRole(restrictedProject.getSelf(), 10000l).claim();
    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).claim();
    setAnonymousMode();
    exception.expect(RestClientException.class);
    exception.expectMessage("404");
    client.getProjectRolesRestClient().getRole(restrictedProject.getUri(), 10000l).claim();
  }
View Full Code Here

  }

  @JiraBuildNumberDependent(ServerVersionConstants.BN_JIRA_4_4)
  @Test
  public void testGetProjectRoleWithFullURI() {
    final Project anonProject = client.getProjectClient().getProject(ANONYMOUS_PROJECT_KEY).claim();
    final URI roleURI = client.getProjectRolesRestClient().getRole(anonProject.getSelf(), 10000l).claim().getSelf();
    final ProjectRole role = client.getProjectRolesRestClient().getRole(roleURI).claim();
    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

  }

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

  }

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

        .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, description, lead, uri, versions, components, issueTypes, projectRoles);
  }
View Full Code Here

    Assert.assertNull(project.getId());
  }

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

    Assert.assertNull(project.getDescription());
  }

  @Test
  public void testParseProjectInJira5x0() throws JSONException, URISyntaxException {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/project-jira-5-0.json"));
    Assert.assertEquals("TST", project.getKey());
    Assert.assertEquals(new DateMidnight(2010, 8, 25).toInstant(), Iterables.getLast(project.getVersions()).getReleaseDate()
        .toInstant());
    Assert.assertEquals("Test Project", project.getName());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    Assert.assertTrue(issueTypes.isSupported());
    Assert.assertThat(issueTypes, IsIterableContainingInAnyOrder.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")),
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();
    Assert.assertThat(projectRoles, IsIterableContainingInAnyOrder.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"),
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"));
    Assert.assertEquals(TestUtil.toUri("http://localhost:8090/jira/rest/api/latest/project/TST"), project.getSelf());
    Assert.assertEquals("This is my description here.\r\nAnother line.", project.getDescription());
    assertEquals(TestConstants.USER_ADMIN_BASIC_DEPRECATED, project.getLead());
    Assert.assertEquals("http://example.com", project.getUri().toString());
    Assert.assertEquals("TST", project.getKey());
    Assert.assertEquals(Long.valueOf(10000), project.getId());
    Assert.assertThat(project.getVersions(), IsIterableContainingInAnyOrder
        .containsInAnyOrder(TestConstants.VERSION_1, TestConstants.VERSION_1_1));
    Assert.assertThat(project.getComponents(), IsIterableContainingInAnyOrder
        .containsInAnyOrder(TestConstants.BCOMPONENT_A, TestConstants.BCOMPONENT_B));
    Assert.assertNull(project.getName());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    Assert.assertFalse(issueTypes.isSupported());
    Assert.assertThat(issueTypes, IsEmptyIterable.<IssueType>emptyIterable());
  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.api.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.