use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.
the class GroupsIT method onlyVisibleGroupsReturned.
@Test
public void onlyVisibleGroupsReturned() throws Exception {
String newGroupName = name("newGroup");
GroupInput in = new GroupInput();
in.name = newGroupName;
in.description = "a hidden group";
in.visibleToAll = false;
in.ownerId = adminGroupUuid().get();
gApi.groups().create(in);
requestScopeOperations.setApiUser(user.id());
assertThatMap(gApi.groups().list().getAsMap()).keys().doesNotContain(newGroupName);
requestScopeOperations.setApiUser(admin.id());
gApi.groups().id(newGroupName).addMembers(user.username());
requestScopeOperations.setApiUser(user.id());
assertThatMap(gApi.groups().list().getAsMap()).keys().contains(newGroupName);
}
use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.
the class RefAdvertisementIT method createGroup.
private AccountGroup.UUID createGroup(String name, @Nullable AccountGroup.UUID ownerGroup, TestAccount... members) throws RestApiException {
GroupInput groupInput = new GroupInput();
groupInput.name = name(name);
groupInput.ownerId = ownerGroup != null ? ownerGroup.get() : null;
groupInput.members = Arrays.stream(members).map(m -> String.valueOf(m.id().get())).collect(toList());
return AccountGroup.uuid(gApi.groups().create(groupInput).get().id);
}
use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.
the class ImpersonationIT method setUp.
@Before
public void setUp() throws Exception {
anonRestSession = new RestSession(server, null);
admin2 = accountCreator.admin2();
GroupInput gi = new GroupInput();
gi.name = name("New-Group");
gi.members = ImmutableList.of(user.id().toString());
newGroup = gApi.groups().create(gi).get();
}
use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.
the class GroupOperationsImplTest method groupNotCreatedByTestApiCanBeRetrieved.
@Test
public void groupNotCreatedByTestApiCanBeRetrieved() throws Exception {
GroupInput input = createArbitraryGroupInput();
input.name = "unique group not created via test API";
AccountGroup.UUID groupUuid = createGroupInServer(input);
TestGroup foundGroup = groupOperations.group(groupUuid).get();
assertThat(foundGroup.groupUuid()).isEqualTo(groupUuid);
assertThat(foundGroup.name()).isEqualTo("unique group not created via test API");
}
use of com.google.gerrit.extensions.api.groups.GroupInput in project gerrit by GerritCodeReview.
the class AbstractQueryGroupsTest method createGroupWithDescription.
protected GroupInfo createGroupWithDescription(String name, String description, AccountInfo... members) throws Exception {
GroupInput in = new GroupInput();
in.name = name;
in.description = description;
in.members = Arrays.asList(members).stream().map(a -> String.valueOf(a._accountId)).collect(toList());
return gApi.groups().create(in).get();
}
Aggregations