use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.
the class AbstractQueryGroupsTest method bySubgroups.
@Test
public void bySubgroups() throws Exception {
assume().that(getSchemaVersion() >= 4).isTrue();
GroupInfo superParentGroup = createGroup(name("superParentGroup"));
GroupInfo parentGroup1 = createGroup(name("parentGroup1"));
GroupInfo parentGroup2 = createGroup(name("parentGroup2"));
GroupInfo subGroup = createGroup(name("subGroup"));
gApi.groups().id(superParentGroup.id).addGroups(parentGroup1.id, parentGroup2.id);
gApi.groups().id(parentGroup1.id).addGroups(subGroup.id);
gApi.groups().id(parentGroup2.id).addGroups(subGroup.id);
assertQuery("subgroup:" + subGroup.id, parentGroup1, parentGroup2);
assertQuery("subgroup:" + parentGroup1.id, superParentGroup);
gApi.groups().id(superParentGroup.id).addGroups(subGroup.id);
gApi.groups().id(parentGroup1.id).removeGroups(subGroup.id);
assertQuery("subgroup:" + subGroup.id, superParentGroup, parentGroup2);
}
use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.
the class AbstractQueryGroupsTest method byInname.
@Test
public void byInname() throws Exception {
String namePart = testName.getSanitizedMethodName();
namePart = CharMatcher.is('_').removeFrom(namePart);
GroupInfo group1 = createGroup("group-" + namePart);
GroupInfo group2 = createGroup("group-" + namePart + "-2");
GroupInfo group3 = createGroup("group-" + namePart + "3");
assertQuery("inname:" + namePart, group1, group2, group3);
assertQuery("inname:" + namePart.toUpperCase(Locale.US), group1, group2, group3);
assertQuery("inname:" + namePart.toLowerCase(Locale.US), group1, group2, group3);
}
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");
BadRequestException thrown = assertThrows(BadRequestException.class, () -> assertQuery("description:\"\""));
assertThat(thrown).hasMessageThat().contains("description operator requires a value");
}
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.toLowerCase(Locale.US));
// only exact match
GroupInfo groupWithHyphen = createGroup(name("group-with-hyphen"));
createGroup(name("group-no-match-with-hyphen"));
assertQuery("name:" + groupWithHyphen.name, groupWithHyphen);
}
use of com.google.gerrit.extensions.common.GroupInfo in project gerrit by GerritCodeReview.
the class AbstractQueryGroupsTest method byMember.
@Test
public void byMember() throws Exception {
assume().that(getSchemaVersion() >= 4).isTrue();
AccountInfo user1 = createAccount("user1", "User1", "user1@example.com");
AccountInfo user2 = createAccount("user2", "User2", "user2@example.com");
GroupInfo group1 = createGroup(name("group1"), user1);
GroupInfo group2 = createGroup(name("group2"), user2);
GroupInfo group3 = createGroup(name("group3"), user1);
assertQuery("member:" + user1.name, group1, group3);
assertQuery("member:" + user1.email, group1, group3);
gApi.groups().id(group3.id).removeMembers(user1.username);
gApi.groups().id(group2.id).addMembers(user1.username);
assertQuery("member:" + user1.name, group1, group2);
}
Aggregations