Search in sources :

Example 76 with GroupInfo

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

the class GroupOperationsImplTest method specifiedOwnerIsRespectedForGroupCreation.

@Test
public void specifiedOwnerIsRespectedForGroupCreation() throws Exception {
    AccountGroup.UUID ownerGroupUuid = groupOperations.newGroup().create();
    AccountGroup.UUID groupUuid = groupOperations.newGroup().ownerGroupUuid(ownerGroupUuid).create();
    GroupInfo foundGroup = getGroupFromServer(groupUuid);
    assertThat(foundGroup.ownerId).isEqualTo(ownerGroupUuid.get());
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 77 with GroupInfo

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

the class GroupOperationsImplTest method requestingNoMembersIsPossibleForGroupCreation.

@Test
public void requestingNoMembersIsPossibleForGroupCreation() throws Exception {
    AccountGroup.UUID groupUuid = groupOperations.newGroup().clearMembers().create();
    GroupInfo foundGroup = getGroupFromServer(groupUuid);
    assertThat(foundGroup.members).isEmpty();
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 78 with GroupInfo

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

the class GroupOperationsImplTest method directlyAddingSubgroupsIsPossibleForGroupCreation.

@Test
public void directlyAddingSubgroupsIsPossibleForGroupCreation() throws Exception {
    AccountGroup.UUID group1Uuid = groupOperations.newGroup().create();
    AccountGroup.UUID group2Uuid = groupOperations.newGroup().create();
    AccountGroup.UUID groupUuid = groupOperations.newGroup().addSubgroup(group1Uuid).addSubgroup(group2Uuid).create();
    GroupInfo foundGroup = getGroupFromServer(groupUuid);
    assertThat(foundGroup.includes).comparingElementsUsing(getGroupToUuidCorrespondence()).containsExactly(group1Uuid, group2Uuid);
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 79 with GroupInfo

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

the class GroupOperationsImplTest method groupCanBeCreatedWithoutSpecifyingAnyParameters.

@Test
public void groupCanBeCreatedWithoutSpecifyingAnyParameters() throws Exception {
    AccountGroup.UUID groupUuid = groupOperations.newGroup().create();
    GroupInfo foundGroup = getGroupFromServer(groupUuid);
    assertThat(foundGroup.id).isEqualTo(groupUuid.get());
    assertThat(foundGroup.name).isNotEmpty();
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 80 with GroupInfo

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

the class GroupOperationsImplTest method requestingNoDescriptionIsPossibleForGroupCreation.

@Test
public void requestingNoDescriptionIsPossibleForGroupCreation() throws Exception {
    AccountGroup.UUID groupUuid = groupOperations.newGroup().clearDescription().create();
    GroupInfo group = getGroupFromServer(groupUuid);
    assertThat(group.description).isNull();
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

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