Search in sources :

Example 26 with GroupInfo

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

the class AbstractQueryGroupsTest method byName.

@Test
public void byName() throws Exception {
    assertQuery("name:non-existing");
    GroupInfo group = createGroup(name("group"));
    assertQuery("name:" + group.name, group);
    assertQuery("name:" + group.name.toUpperCase(Locale.US), group);
    // only exact match
    GroupInfo groupWithHyphen = createGroup(name("group-with-hyphen"));
    createGroup(name("group-no-match-with-hyphen"));
    assertQuery("name:" + groupWithHyphen.name, groupWithHyphen);
}
Also used : GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test)

Example 27 with GroupInfo

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

the class Schema_150_to_151_Test method createGroup.

private AccountGroup.Id createGroup(String name) throws Exception {
    GroupInput groupInput = new GroupInput();
    groupInput.name = name;
    GroupInfo groupInfo = createGroupFactory.create(name).apply(TopLevelResource.INSTANCE, groupInput);
    return new Id(groupInfo.groupId);
}
Also used : GroupInput(com.google.gerrit.extensions.api.groups.GroupInput) GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Id(com.google.gerrit.reviewdb.client.AccountGroup.Id)

Example 28 with GroupInfo

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

the class AbstractQueryGroupsTest method asAnonymous.

@Test
public void asAnonymous() throws Exception {
    GroupInfo group = createGroup(name("group"));
    setAnonymous();
    assertQuery("uuid:" + group.id);
}
Also used : GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test)

Example 29 with GroupInfo

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

the class AbstractQueryGroupsTest method byDescription.

@Test
public void byDescription() throws Exception {
    GroupInfo group1 = createGroupWithDescription(name("group1"), "This is a test group.");
    GroupInfo group2 = createGroupWithDescription(name("group2"), "ANOTHER TEST GROUP.");
    createGroupWithDescription(name("group3"), "Maintainers of project foo.");
    assertQuery("description:test", group1, group2);
    assertQuery("description:non-existing");
    exception.expect(BadRequestException.class);
    exception.expectMessage("description operator requires a value");
    assertQuery("description:\"\"");
}
Also used : GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test)

Example 30 with GroupInfo

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

the class AbstractQueryGroupsTest method byUuid.

@Test
public void byUuid() throws Exception {
    assertQuery("uuid:6d70856bc40ded50f2585c4c0f7e179f3544a272");
    assertQuery("uuid:non-existing");
    GroupInfo group = createGroup(name("group"));
    assertQuery("uuid:" + group.id, group);
    GroupInfo admins = gApi.groups().id("Administrators").get();
    assertQuery("uuid:" + admins.id, admins);
}
Also used : GroupInfo(com.google.gerrit.extensions.common.GroupInfo) Test(org.junit.Test)

Aggregations

GroupInfo (com.google.gerrit.extensions.common.GroupInfo)38 Test (org.junit.Test)20 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)11 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)9 GroupAssert.assertGroupInfo (com.google.gerrit.acceptance.api.group.GroupAssert.assertGroupInfo)8 GroupDescription (com.google.gerrit.common.data.GroupDescription)5 ArrayList (java.util.ArrayList)5 GroupReference (com.google.gerrit.common.data.GroupReference)4 GroupInput (com.google.gerrit.extensions.api.groups.GroupInput)4 MethodNotAllowedException (com.google.gerrit.extensions.restapi.MethodNotAllowedException)4 TestAccount (com.google.gerrit.acceptance.TestAccount)3 NoSuchGroupException (com.google.gerrit.common.errors.NoSuchGroupException)3 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)3 GroupControl (com.google.gerrit.server.account.GroupControl)3 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)2 AuthException (com.google.gerrit.extensions.restapi.AuthException)2 Account (com.google.gerrit.reviewdb.client.Account)2 AccountGroupById (com.google.gerrit.reviewdb.client.AccountGroupById)2 Project (com.google.gerrit.reviewdb.client.Project)2 Message (com.google.gerrit.testutil.FakeEmailSender.Message)2