Search in sources :

Example 56 with GroupReference

use of com.google.gerrit.entities.GroupReference in project gerrit by GerritCodeReview.

the class GroupNameNotesTest method loadedGroupsContainGroupsWithDuplicateGroupUuids.

@Test
public void loadedGroupsContainGroupsWithDuplicateGroupUuids() throws Exception {
    createGroup(groupUuid, groupName);
    AccountGroup.NameKey anotherGroupName = AccountGroup.nameKey("admins");
    createGroup(groupUuid, anotherGroupName);
    ImmutableList<GroupReference> allGroups = GroupNameNotes.loadAllGroups(repo);
    GroupReference group1 = GroupReference.create(groupUuid, groupName.get());
    GroupReference group2 = GroupReference.create(groupUuid, anotherGroupName.get());
    assertThat(allGroups).containsExactly(group1, group2);
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupReference(com.google.gerrit.entities.GroupReference) Test(org.junit.Test)

Example 57 with GroupReference

use of com.google.gerrit.entities.GroupReference in project gerrit by GerritCodeReview.

the class GroupListTest method references.

@Test
public void references() throws Exception {
    Collection<GroupReference> result = groupList.references();
    assertEquals(2, result.size());
    AccountGroup.UUID uuid = AccountGroup.uuid("ebe31c01aec2c9ac3b3c03e87a47450829ff4310");
    GroupReference expected = GroupReference.create(uuid, "Administrators");
    assertTrue(result.contains(expected));
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupReference(com.google.gerrit.entities.GroupReference) Test(org.junit.Test)

Example 58 with GroupReference

use of com.google.gerrit.entities.GroupReference in project gerrit by GerritCodeReview.

the class GroupListTest method put.

@Test
public void put() {
    AccountGroup.UUID uuid = AccountGroup.uuid("abc");
    GroupReference groupReference = GroupReference.create(uuid, "Hutzliputz");
    groupList.put(uuid, groupReference);
    assertEquals(3, groupList.references().size());
    GroupReference found = groupList.byUUID(uuid);
    assertEquals(groupReference, found);
}
Also used : AccountGroup(com.google.gerrit.entities.AccountGroup) GroupReference(com.google.gerrit.entities.GroupReference) Test(org.junit.Test)

Example 59 with GroupReference

use of com.google.gerrit.entities.GroupReference in project gerrit by GerritCodeReview.

the class GroupReferenceTest method forGroupDescription.

@Test
public void forGroupDescription() {
    String name = "foo";
    AccountGroup.UUID uuid = AccountGroup.uuid("uuid-foo");
    GroupReference groupReference = GroupReference.forGroup(new GroupDescription.Basic() {

        @Override
        public String getUrl() {
            return null;
        }

        @Override
        public String getName() {
            return name;
        }

        @Override
        public UUID getGroupUUID() {
            return uuid;
        }

        @Override
        public String getEmailAddress() {
            return null;
        }
    });
    assertThat(groupReference.getName()).isEqualTo(name);
    assertThat(groupReference.getUUID()).isEqualTo(uuid);
}
Also used : GroupDescription(com.google.gerrit.entities.GroupDescription) AccountGroup(com.google.gerrit.entities.AccountGroup) GroupReference(com.google.gerrit.entities.GroupReference) UUID(com.google.gerrit.entities.AccountGroup.UUID) UUID(com.google.gerrit.entities.AccountGroup.UUID) Test(org.junit.Test)

Aggregations

GroupReference (com.google.gerrit.entities.GroupReference)59 Test (org.junit.Test)24 AccountGroup (com.google.gerrit.entities.AccountGroup)18 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)8 GroupDescription (com.google.gerrit.entities.GroupDescription)8 InternalGroup (com.google.gerrit.entities.InternalGroup)7 ProjectConfig (com.google.gerrit.server.project.ProjectConfig)7 IOException (java.io.IOException)7 Repository (org.eclipse.jgit.lib.Repository)7 MetaDataUpdate (com.google.gerrit.server.git.meta.MetaDataUpdate)6 Config (org.eclipse.jgit.lib.Config)6 CachedProjectConfig (com.google.gerrit.entities.CachedProjectConfig)5 InMemoryRepository (org.eclipse.jgit.internal.storage.dfs.InMemoryRepository)5 NotifyConfig (com.google.gerrit.entities.NotifyConfig)4 ArrayList (java.util.ArrayList)4 Account (com.google.gerrit.entities.Account)3 BooleanProjectConfig (com.google.gerrit.entities.BooleanProjectConfig)3 Permission (com.google.gerrit.entities.Permission)3 PermissionRule (com.google.gerrit.entities.PermissionRule)3 ProjectAccessInfo (com.google.gerrit.extensions.api.access.ProjectAccessInfo)3