Search in sources :

Example 66 with GroupInfo

use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.

the class GroupsIT method createGroupWithUuid.

@Test
public void createGroupWithUuid() throws Exception {
    AccountGroup.UUID uuid = AccountGroup.UUID.parse("4eb25d1cca562f53b9356117f33840706a36a349");
    GroupInput input = new GroupInput();
    input.uuid = uuid.get();
    input.name = name("new-group");
    GroupInfo info = gApi.groups().create(input).get();
    assertThat(info.name).isEqualTo(input.name);
    assertThat(info.id).isEqualTo(input.uuid);
}
Also used : GroupInput(com.google.gerrit.extensions.api.groups.GroupInput) AccountGroup(com.google.gerrit.entities.AccountGroup) GroupAssert.assertGroupInfo(com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 67 with GroupInfo

use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.

the class GroupsIT method cachedGroupsForMemberAreUpdatedOnGroupCreation.

@Test
public void cachedGroupsForMemberAreUpdatedOnGroupCreation() throws Exception {
    Account.Id accountId = accountOperations.newAccount().create();
    // Fill the cache for the observed account.
    groupIncludeCache.getGroupsWithMember(accountId);
    GroupInput groupInput = new GroupInput();
    groupInput.name = name("Users");
    groupInput.members = ImmutableList.of(String.valueOf(accountId.get()));
    GroupInfo group = gApi.groups().create(groupInput).get();
    Collection<AccountGroup.UUID> groups = groupIncludeCache.getGroupsWithMember(accountId);
    assertThat(groups).containsExactly(AccountGroup.uuid(group.id));
}
Also used : TestAccount(com.google.gerrit.acceptance.TestAccount) Account(com.google.gerrit.entities.Account) GroupInput(com.google.gerrit.extensions.api.groups.GroupInput) GroupAssert.assertGroupInfo(com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 68 with GroupInfo

use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.

the class GroupsIT method allGroupInfoFieldsSetCorrectly.

@Test
public void allGroupInfoFieldsSetCorrectly() throws Exception {
    InternalGroup adminGroup = adminGroup();
    Map<String, GroupInfo> groups = gApi.groups().list().addGroup(adminGroup.getName()).getAsMap();
    assertThatMap(groups).keys().containsExactly("Administrators");
    assertGroupInfo(adminGroup, Iterables.getOnlyElement(groups.values()));
}
Also used : GroupAssert.assertGroupInfo(com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) InternalGroup(com.google.gerrit.entities.InternalGroup) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 69 with GroupInfo

use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.

the class GroupsIT method getSystemGroupByConfiguredName.

@Test
@GerritConfig(name = "groups.global:Anonymous-Users.name", value = "All Users")
public void getSystemGroupByConfiguredName() throws Exception {
    GroupReference anonymousUsersGroup = systemGroupBackend.getGroup(ANONYMOUS_USERS);
    assertThat(anonymousUsersGroup.getName()).isEqualTo("All Users");
    GroupInfo group = gApi.groups().id(anonymousUsersGroup.getUUID().get()).get();
    assertThat(group.name).isEqualTo(anonymousUsersGroup.getName());
    group = gApi.groups().id(anonymousUsersGroup.getName()).get();
    assertThat(group.id).isEqualTo(Url.encode(anonymousUsersGroup.getUUID().get()));
}
Also used : GroupAssert.assertGroupInfo(com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) GroupReference(com.google.gerrit.entities.GroupReference) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 70 with GroupInfo

use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.

the class GroupsIT method getSystemGroupByDefaultName.

@Test
public void getSystemGroupByDefaultName() throws Exception {
    GroupReference anonymousUsersGroup = systemGroupBackend.getGroup(ANONYMOUS_USERS);
    GroupInfo group = gApi.groups().id("Anonymous Users").get();
    assertThat(group.name).isEqualTo(anonymousUsersGroup.getName());
    assertThat(group.id).isEqualTo(Url.encode(anonymousUsersGroup.getUUID().get()));
}
Also used : GroupAssert.assertGroupInfo(com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) GroupReference(com.google.gerrit.entities.GroupReference) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

GroupInfo (com.google.gerrit.extensions.common.GroupInfo)92 Test (org.junit.Test)60 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)43 AccountGroup (com.google.gerrit.entities.AccountGroup)28 GroupAssert.assertGroupInfo (com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo)24 ArrayList (java.util.ArrayList)11 GroupInput (com.google.gerrit.extensions.api.groups.GroupInput)10 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)10 Account (com.google.gerrit.entities.Account)8 AuthException (com.google.gerrit.extensions.restapi.AuthException)8 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)8 GroupControl (com.google.gerrit.server.account.GroupControl)8 GroupDescription (com.google.gerrit.entities.GroupDescription)7 GroupReference (com.google.gerrit.entities.GroupReference)7 TestAccount (com.google.gerrit.acceptance.TestAccount)6 InternalGroup (com.google.gerrit.entities.InternalGroup)6 GroupDescription (com.google.gerrit.common.data.GroupDescription)5 NoSuchGroupException (com.google.gerrit.exceptions.NoSuchGroupException)5 MethodNotAllowedException (com.google.gerrit.extensions.restapi.MethodNotAllowedException)5 InternalGroupDescription (com.google.gerrit.server.group.InternalGroupDescription)5