Search in sources :

Example 6 with GroupInput

use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.

the class GroupsIT method onlyVisibleGroupsReturned.

@Test
public void onlyVisibleGroupsReturned() throws Exception {
    String newGroupName = name("newGroup");
    GroupInput in = new GroupInput();
    in.name = newGroupName;
    in.description = "a hidden group";
    in.visibleToAll = false;
    in.ownerId = getFromCache("Administrators").getGroupUUID().get();
    gApi.groups().create(in);
    setApiUser(user);
    assertThat(gApi.groups().list().getAsMap()).doesNotContainKey(newGroupName);
    setApiUser(admin);
    gApi.groups().id(newGroupName).addMembers(user.username);
    setApiUser(user);
    assertThat(gApi.groups().list().getAsMap()).containsKey(newGroupName);
}
Also used : GroupInput(com.google.gerrit.extensions.api.groups.GroupInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 7 with GroupInput

use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.

the class ImpersonationIT method setUp.

@Before
public void setUp() throws Exception {
    anonRestSession = new RestSession(server, null);
    admin2 = accounts.admin2();
    GroupInput gi = new GroupInput();
    gi.name = name("New-Group");
    gi.members = ImmutableList.of(user.id.toString());
    newGroup = gApi.groups().create(gi).get();
}
Also used : GroupInput(com.google.gerrit.extensions.api.groups.GroupInput) RestSession(com.google.gerrit.acceptance.RestSession) Before(org.junit.Before)

Example 8 with GroupInput

use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.

the class AbstractQueryGroupsTest method createGroupWithOwner.

protected GroupInfo createGroupWithOwner(String name, GroupInfo ownerGroup) throws Exception {
    GroupInput in = new GroupInput();
    in.name = name;
    in.ownerId = ownerGroup.id;
    return gApi.groups().create(in).get();
}
Also used : GroupInput(com.google.gerrit.extensions.api.groups.GroupInput)

Example 9 with GroupInput

use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.

the class AbstractQueryGroupsTest method createGroupWithDescription.

protected GroupInfo createGroupWithDescription(String name, String description, AccountInfo... members) throws Exception {
    GroupInput in = new GroupInput();
    in.name = name;
    in.description = description;
    in.members = Arrays.asList(members).stream().map(a -> String.valueOf(a._accountId)).collect(toList());
    return gApi.groups().create(in).get();
}
Also used : GroupInput(com.google.gerrit.extensions.api.groups.GroupInput)

Example 10 with GroupInput

use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.

the class AbstractQueryGroupsTest method createGroupThatIsVisibleToAll.

protected GroupInfo createGroupThatIsVisibleToAll(String name) throws Exception {
    GroupInput in = new GroupInput();
    in.name = name;
    in.visibleToAll = true;
    return gApi.groups().create(in).get();
}
Also used : GroupInput(com.google.gerrit.extensions.api.groups.GroupInput)

Aggregations

GroupInput (com.google.gerrit.extensions.api.groups.GroupInput)13 GroupInfo (com.google.gerrit.extensions.common.GroupInfo)4 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)3 Test (org.junit.Test)3 GroupAssert.assertGroupInfo (com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo)2 RestSession (com.google.gerrit.acceptance.RestSession)1 TestAccount (com.google.gerrit.acceptance.TestAccount)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)1 UnprocessableEntityException (com.google.gerrit.extensions.restapi.UnprocessableEntityException)1 Account (com.google.gerrit.reviewdb.client.Account)1 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)1 Id (com.google.gerrit.reviewdb.client.AccountGroup.Id)1 CreateGroupArgs (com.google.gerrit.server.account.CreateGroupArgs)1 GroupCreationValidationListener (com.google.gerrit.server.validators.GroupCreationValidationListener)1 ValidationException (com.google.gerrit.server.validators.ValidationException)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1