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

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


    // Workaround for a bug in API. Id field should not be optional, unfortunately it is not returned for an admin role actor.
    final Long id = JsonParseUtil.getOptionalLong(json, "id");
    final String displayName = json.getString("displayName");
    final String type = json.getString("type");
    final String name = json.getString("name");
    return new RoleActor(id, displayName, type, name, parseAvatarUrl(json));
  }
View Full Code Here


  @Rule
  public final ExpectedException exception = ExpectedException.none();

  @Test
  public void testParseValidActorWithOptionalParam() throws Exception {
    final RoleActor actor = roleActorJsonParser.parse(getJsonObjectFromResource("/json/actor/valid-actor.json"));
    assertEquals(10020l, actor.getId().longValue());
    assertEquals("jira-users", actor.getName());
    assertEquals("jira-users", actor.getDisplayName());
    assertEquals("atlassian-group-role-actor", actor.getType());
    assertEquals(toUri(baseJiraURI.toString() + "/jira/secure/useravatar?size=small&avatarId=10083"), actor.getAvatarUri());
  }
View Full Code Here

    assertEquals(toUri(baseJiraURI.toString() + "/jira/secure/useravatar?size=small&avatarId=10083"), actor.getAvatarUri());
  }

  @Test
  public void testParseValidActorWithoutOptionalParams() throws JSONException {
    final RoleActor actor = roleActorJsonParser.parse(getJsonObjectFromResource("/json/actor/valid-actor-without-avatar.json"));
    assertEquals(10020l, actor.getId().longValue());
    assertEquals("jira-users", actor.getName());
    assertEquals("jira-users", actor.getDisplayName());
    assertEquals("atlassian-group-role-actor", actor.getType());
    assertNull(actor.getAvatarUri());
  }
View Full Code Here

    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());
    assertEquals("atlassian-group-role-actor", actor.getType());
    assertEquals("jira-users", actor.getName());
    assertEquals(jiraUri.resolve("/jira/secure/useravatar?size=small&avatarId=10083"), actor.getAvatarUri());
  }
View Full Code Here

    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());
    assertEquals("atlassian-user-role-actor", actor.getType());
    assertEquals("admin", actor.getName());
    assertEquals(jiraUri.resolve("/jira/secure/useravatar?size=small&ownerId=admin&avatarId=10054"), actor.getAvatarUri());
  }
View Full Code Here

    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());
    assertEquals("jira-users", actor.getDisplayName());
    assertEquals("atlassian-group-role-actor", actor.getType());
    assertEquals("jira-users", actor.getName());
    assertEquals(jiraUri.resolve("/jira/secure/useravatar?size=small&avatarId=10083"), actor.getAvatarUri());
  }
View Full Code Here

        }
    );
    assertThat(projectRolesWithoutSelf, containsInAnyOrder(
        new ProjectRole(10000l, null, "Users", "A project role that represents users in a project",
            ImmutableList.<RoleActor>of(
                new RoleActor(10062l, "jira-users", "atlassian-group-role-actor", "jira-users",
                    jiraUri.resolve("/jira/secure/useravatar?size=small&avatarId=10083"))
            )),
        new ProjectRole(10001l, null, "Developers", "A project role that represents developers in a project",
            ImmutableList.<RoleActor>of(
                new RoleActor(10061l, "jira-developers", "atlassian-group-role-actor", "jira-developers",
                    jiraUri.resolve("/jira/secure/useravatar?size=small&avatarId=10083")),
                new RoleActor(10063l, "My Test User", "atlassian-user-role-actor", "user",
                    jiraUri.resolve("/jira/secure/useravatar?size=small&avatarId=10082"))
            )),
        new ProjectRole(10002l, null, "Administrators", "A project role that represents administrators in a project",
            ImmutableList.<RoleActor>of(
                new RoleActor(10060l, "jira-administrators", "atlassian-group-role-actor", "jira-administrators",
                    jiraUri.resolve("/jira/secure/useravatar?size=small&avatarId=10083"))
            ))
    ));

    assertNotNull(Iterables.find(projectRoles, new EntityHelper.AddressEndsWithPredicate("project/ANNON/role/10000")));
View Full Code Here

    final ProjectRole role = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/role/valid-role-single-actor.json"));
    assertEquals(TestUtil.toUri("http://www.example.com/jira/rest/api/2/project/MKY/role/10360"), role.getSelf());
    assertEquals("Developers", role.getName());
    assertEquals("A project role that represents developers in a project", role.getDescription());
    assertNotNull(role.getActors());
    final RoleActor actor = Iterables.getOnlyElement(role.getActors());
    assertEquals("jira-developers", actor.getDisplayName());
    assertEquals("atlassian-group-role-actor", actor.getType());
    assertEquals("jira-developers", actor.getName());
  }
View Full Code Here

    assertEquals(TestUtil.toUri("http://localhost:2990/jira/rest/api/2/project/TST/role/10000"), role.getSelf());
    assertEquals("Users", role.getName());
    assertEquals("A project role that represents users in a project", role.getDescription());
    assertNotNull(role.getActors());
    assertThat(role.getActors(),
        containsInAnyOrder(new RoleActor(10020l, "jira-users", "atlassian-group-role-actor", "jira-users",
                toUri("http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10083")
            ),
            new RoleActor(10030l, "jira-superuser", "atlassian-user-role-actor", "superuser", null)
        )
    );
  }
View Full Code Here

    assertEquals(10000, role.getId().longValue());
    assertEquals("A project role that represents users in a project", role.getDescription());
    assertThat(
        role.getActors(),
        containsInAnyOrder(
            new RoleActor(null, "Administrator", "atlassian-user-role-actor", "admin",
                baseJiraURI.resolve("/jira/secure/useravatar?size=small&ownerId=admin&avatarId=10054")
            ),
            new RoleActor(10020l, "jira-users", "atlassian-group-role-actor", "jira-users",
                baseJiraURI.resolve("/jira/secure/useravatar?size=small&avatarId=10083")
            ),
            new RoleActor(10030l, "Wojciech Seliga", "atlassian-user-role-actor", "wseliga",
                baseJiraURI.resolve("/jira/secure/useravatar?size=small&avatarId=10082"))
        )
    );
  }
View Full Code Here

TOP

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

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.