From 666b34d33c1b4e73147006dbced080bfec7f9751 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 9 Sep 2019 09:08:56 +0900 Subject: [PATCH 1/2] CreateGroup: Allow to create a group with given UUID Before migration of groups to NoteDb it was possible to create a group with a given UUID through the ReviewDb access methods. After migration to NoteDb this is no longer possible, which is a breaking change for plugins/extensions that rely on it. Add an optional UUID field to GroupInput so that callers may specify the UUID. If it's not set, generate the UUID as before. Fail when the given UUID belongs to an existing group or is not a valid UUID for an internal group. Bug: Issue 11935 Change-Id: I062bbfaaafd9fc510c514f8f7cd134b9a086beef --- Documentation/rest-api-groups.txt | 6 ++- .../extensions/api/groups/GroupInput.java | 1 + .../server/account/CreateGroupArgs.java | 1 + .../server/restapi/group/CreateGroup.java | 18 +++++++-- .../gerrit/acceptance/api/group/GroupsIT.java | 37 +++++++++++++++++++ 5 files changed, 58 insertions(+), 5 deletions(-) diff --git a/Documentation/rest-api-groups.txt b/Documentation/rest-api-groups.txt index 00fd81f62a..f84d91a0ad 100644 --- a/Documentation/rest-api-groups.txt +++ b/Documentation/rest-api-groups.txt @@ -508,8 +508,9 @@ describes the created group. } ---- -If the group creation fails because the name is already in use the -response is "`409 Conflict`". +If the group creation fails because the name is already in use, or the +UUID was specified and the UUID is already in use, the response is +"`409 Conflict`". [[get-group-detail]] === Get Group Detail @@ -1596,6 +1597,7 @@ a new internal group. |Field Name ||Description |`name` |optional|The name of the group (not encoded). + If set, must match the group name in the URL. +|`uuid` |optional|The UUID of the group. |`description` |optional|The description of the group. |`visible_to_all`|optional| Whether the group is visible to all registered users. + diff --git a/java/com/google/gerrit/extensions/api/groups/GroupInput.java b/java/com/google/gerrit/extensions/api/groups/GroupInput.java index ab38434168..30af08fb5a 100644 --- a/java/com/google/gerrit/extensions/api/groups/GroupInput.java +++ b/java/com/google/gerrit/extensions/api/groups/GroupInput.java @@ -18,6 +18,7 @@ import java.util.List; public class GroupInput { public String name; + public String uuid; public String description; public Boolean visibleToAll; public String ownerId; diff --git a/java/com/google/gerrit/server/account/CreateGroupArgs.java b/java/com/google/gerrit/server/account/CreateGroupArgs.java index 2c59a08350..2a764ccd6d 100644 --- a/java/com/google/gerrit/server/account/CreateGroupArgs.java +++ b/java/com/google/gerrit/server/account/CreateGroupArgs.java @@ -20,6 +20,7 @@ import java.util.Collection; public class CreateGroupArgs { private AccountGroup.NameKey groupName; + public AccountGroup.UUID uuid; public String groupDescription; public boolean visibleToAll; public AccountGroup.UUID ownerGroupUuid; diff --git a/java/com/google/gerrit/server/restapi/group/CreateGroup.java b/java/com/google/gerrit/server/restapi/group/CreateGroup.java index 585c014eb3..7c5e7ed38b 100644 --- a/java/com/google/gerrit/server/restapi/group/CreateGroup.java +++ b/java/com/google/gerrit/server/restapi/group/CreateGroup.java @@ -138,6 +138,16 @@ public class CreateGroup AccountGroup.UUID ownerUuid = owner(input); CreateGroupArgs args = new CreateGroupArgs(); args.setGroupName(name); + args.uuid = Strings.isNullOrEmpty(input.uuid) ? null : AccountGroup.UUID.parse(input.uuid); + if (args.uuid != null) { + if (!AccountGroup.isInternalGroup(args.uuid)) { + throw new BadRequestException(String.format("invalid group UUID '%s'", args.uuid.get())); + } + if (groupCache.get(args.uuid).isPresent()) { + throw new ResourceConflictException( + String.format("group with UUID '%s' already exists", args.uuid.get())); + } + } args.groupDescription = Strings.emptyToNull(input.description); args.visibleToAll = MoreObjects.firstNonNull(input.visibleToAll, defaultVisibleToAll); args.ownerGroupUuid = ownerUuid; @@ -196,9 +206,11 @@ public class CreateGroup AccountGroup.Id groupId = AccountGroup.id(sequences.nextGroupId()); AccountGroup.UUID uuid = - GroupUUID.make( - createGroupArgs.getGroupName(), - self.get().newCommitterIdent(serverIdent.getWhen(), serverIdent.getTimeZone())); + MoreObjects.firstNonNull( + createGroupArgs.uuid, + GroupUUID.make( + createGroupArgs.getGroupName(), + self.get().newCommitterIdent(serverIdent.getWhen(), serverIdent.getTimeZone()))); InternalGroupCreation groupCreation = InternalGroupCreation.builder() .setGroupUUID(uuid) diff --git a/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java b/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java index 07fb5771f0..8f53393a21 100644 --- a/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java +++ b/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java @@ -396,6 +396,43 @@ public class GroupsIT extends AbstractDaemonTest { assertThat(thrown).hasMessageThat().contains("group name 'Anonymous Users' is reserved"); } + @Test + public void createGroupWithUuid() throws Exception { + AccountGroup.UUID uuid = AccountGroup.UUID.parse("4eb25d1cca562f53b9356117f33840706a36a349"); + GroupInput input = new GroupInput(); + input.uuid = uuid.get(); + input.name = name("new-group"); + GroupInfo info = gApi.groups().create(input).get(); + assertThat(info.name).isEqualTo(input.name); + assertThat(info.id).isEqualTo(input.uuid); + } + + @Test + public void createGroupWithExistingUuid_Conflict() throws Exception { + GroupInfo existingGroup = gApi.groups().create(name("new-group")).get(); + GroupInput input = new GroupInput(); + input.uuid = existingGroup.id; + input.name = name("another-new-group"); + ResourceConflictException thrown = + assertThrows(ResourceConflictException.class, () -> gApi.groups().create(input).get()); + assertThat(thrown) + .hasMessageThat() + .isEqualTo(String.format("group with UUID '%s' already exists", input.uuid)); + } + + @Test + public void createGroupWithInvalidUuid_BadRequest() throws Exception { + AccountGroup.UUID uuid = AccountGroup.UUID.parse("foo:bar"); + GroupInput input = new GroupInput(); + input.uuid = uuid.get(); + input.name = name("new-group"); + BadRequestException thrown = + assertThrows(BadRequestException.class, () -> gApi.groups().create(input).get()); + assertThat(thrown) + .hasMessageThat() + .isEqualTo(String.format("invalid group UUID '%s'", input.uuid)); + } + @Test public void createGroupWithProperties() throws Exception { GroupInput in = new GroupInput(); From 9a5141f0ad35434bbc075e217b8bf009fd64be3b Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 13 Feb 2020 08:53:44 +0900 Subject: [PATCH 2/2] Consistently declare 'throws Exception' from @Test annotated methods Change-Id: I1948607db496d0a9b8d933c1a870ecc97434dd13 --- .../server/permissions/RefControlTest.java | 110 +++++++++--------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/javatests/com/google/gerrit/server/permissions/RefControlTest.java b/javatests/com/google/gerrit/server/permissions/RefControlTest.java index 7de50dc9ab..01aa2e8bf4 100644 --- a/javatests/com/google/gerrit/server/permissions/RefControlTest.java +++ b/javatests/com/google/gerrit/server/permissions/RefControlTest.java @@ -330,14 +330,14 @@ public class RefControlTest { } @Test - public void ownerProject() { + public void ownerProject() throws Exception { allow(local, OWNER, ADMIN, "refs/*"); assertAdminsAreOwnersAndDevsAreNot(); } @Test - public void denyOwnerProject() { + public void denyOwnerProject() throws Exception { allow(local, OWNER, ADMIN, "refs/*"); deny(local, OWNER, DEVS, "refs/*"); @@ -345,7 +345,7 @@ public class RefControlTest { } @Test - public void blockOwnerProject() { + public void blockOwnerProject() throws Exception { allow(local, OWNER, ADMIN, "refs/*"); block(local, OWNER, DEVS, "refs/*"); @@ -353,7 +353,7 @@ public class RefControlTest { } @Test - public void branchDelegation1() { + public void branchDelegation1() throws Exception { allow(local, OWNER, ADMIN, "refs/*"); allow(local, OWNER, DEVS, "refs/heads/x/*"); @@ -369,7 +369,7 @@ public class RefControlTest { } @Test - public void branchDelegation2() { + public void branchDelegation2() throws Exception { allow(local, OWNER, ADMIN, "refs/*"); allow(local, OWNER, DEVS, "refs/heads/x/*"); allow(local, OWNER, fixers, "refs/heads/x/y/*"); @@ -396,7 +396,7 @@ public class RefControlTest { } @Test - public void inheritRead_SingleBranchDeniesUpload() { + public void inheritRead_SingleBranchDeniesUpload() throws Exception { allow(parent, READ, REGISTERED_USERS, "refs/*"); allow(parent, PUSH, REGISTERED_USERS, "refs/for/refs/*"); allow(local, READ, REGISTERED_USERS, "refs/heads/foobar"); @@ -410,7 +410,7 @@ public class RefControlTest { } @Test - public void blockPushDrafts() { + public void blockPushDrafts() throws Exception { allow(parent, PUSH, REGISTERED_USERS, "refs/for/refs/*"); block(parent, PUSH, ANONYMOUS_USERS, "refs/drafts/*"); allow(local, PUSH, REGISTERED_USERS, "refs/drafts/*"); @@ -421,7 +421,7 @@ public class RefControlTest { } @Test - public void blockPushDraftsUnblockAdmin() { + public void blockPushDraftsUnblockAdmin() throws Exception { block(parent, PUSH, ANONYMOUS_USERS, "refs/drafts/*"); allow(parent, PUSH, ADMIN, "refs/drafts/*"); allow(local, PUSH, REGISTERED_USERS, "refs/drafts/*"); @@ -438,7 +438,7 @@ public class RefControlTest { } @Test - public void inheritRead_SingleBranchDoesNotOverrideInherited() { + public void inheritRead_SingleBranchDoesNotOverrideInherited() throws Exception { allow(parent, READ, REGISTERED_USERS, "refs/*"); allow(parent, PUSH, REGISTERED_USERS, "refs/for/refs/*"); allow(local, READ, REGISTERED_USERS, "refs/heads/foobar"); @@ -463,7 +463,7 @@ public class RefControlTest { } @Test - public void inheritRead_OverrideWithDeny() { + public void inheritRead_OverrideWithDeny() throws Exception { allow(parent, READ, REGISTERED_USERS, "refs/*"); deny(local, READ, REGISTERED_USERS, "refs/*"); @@ -471,7 +471,7 @@ public class RefControlTest { } @Test - public void inheritRead_AppendWithDenyOfRef() { + public void inheritRead_AppendWithDenyOfRef() throws Exception { allow(parent, READ, REGISTERED_USERS, "refs/*"); deny(local, READ, REGISTERED_USERS, "refs/heads/*"); @@ -483,7 +483,7 @@ public class RefControlTest { } @Test - public void inheritRead_OverridesAndDeniesOfRef() { + public void inheritRead_OverridesAndDeniesOfRef() throws Exception { allow(parent, READ, REGISTERED_USERS, "refs/*"); deny(local, READ, REGISTERED_USERS, "refs/*"); allow(local, READ, REGISTERED_USERS, "refs/heads/*"); @@ -496,7 +496,7 @@ public class RefControlTest { } @Test - public void inheritSubmit_OverridesAndDeniesOfRef() { + public void inheritSubmit_OverridesAndDeniesOfRef() throws Exception { allow(parent, SUBMIT, REGISTERED_USERS, "refs/*"); deny(local, SUBMIT, REGISTERED_USERS, "refs/*"); allow(local, SUBMIT, REGISTERED_USERS, "refs/heads/*"); @@ -508,7 +508,7 @@ public class RefControlTest { } @Test - public void cannotUploadToAnyRef() { + public void cannotUploadToAnyRef() throws Exception { allow(parent, READ, REGISTERED_USERS, "refs/*"); allow(local, READ, DEVS, "refs/heads/*"); allow(local, PUSH, DEVS, "refs/for/refs/heads/*"); @@ -519,14 +519,14 @@ public class RefControlTest { } @Test - public void usernamePatternCanUploadToAnyRef() { + public void usernamePatternCanUploadToAnyRef() throws Exception { allow(local, PUSH, REGISTERED_USERS, "refs/heads/users/${username}/*"); ProjectControl u = user(local, "a-registered-user"); assertCanUpload(u); } @Test - public void usernamePatternNonRegex() { + public void usernamePatternNonRegex() throws Exception { allow(local, READ, DEVS, "refs/sb/${username}/heads/*"); ProjectControl u = user(local, "u", DEVS); @@ -536,7 +536,7 @@ public class RefControlTest { } @Test - public void usernamePatternWithRegex() { + public void usernamePatternWithRegex() throws Exception { allow(local, READ, DEVS, "^refs/sb/${username}/heads/.*"); ProjectControl u = user(local, "d.v", DEVS); @@ -546,7 +546,7 @@ public class RefControlTest { } @Test - public void usernameEmailPatternWithRegex() { + public void usernameEmailPatternWithRegex() throws Exception { allow(local, READ, DEVS, "^refs/sb/${username}/heads/.*"); ProjectControl u = user(local, "d.v@ger-rit.org", DEVS); @@ -556,7 +556,7 @@ public class RefControlTest { } @Test - public void sortWithRegex() { + public void sortWithRegex() throws Exception { allow(local, READ, DEVS, "^refs/heads/.*"); allow(parent, READ, ANONYMOUS_USERS, "^refs/heads/.*-QA-.*"); @@ -567,7 +567,7 @@ public class RefControlTest { } @Test - public void blockRule_ParentBlocksChild() { + public void blockRule_ParentBlocksChild() throws Exception { allow(local, PUSH, DEVS, "refs/tags/*"); block(parent, PUSH, ANONYMOUS_USERS, "refs/tags/*"); ProjectControl u = user(local, DEVS); @@ -575,7 +575,7 @@ public class RefControlTest { } @Test - public void blockRule_ParentBlocksChildEvenIfAlreadyBlockedInChild() { + public void blockRule_ParentBlocksChildEvenIfAlreadyBlockedInChild() throws Exception { allow(local, PUSH, DEVS, "refs/tags/*"); block(local, PUSH, ANONYMOUS_USERS, "refs/tags/*"); block(parent, PUSH, ANONYMOUS_USERS, "refs/tags/*"); @@ -585,7 +585,7 @@ public class RefControlTest { } @Test - public void blockPartialRangeLocally() { + public void blockPartialRangeLocally() throws Exception { block(local, LABEL + "Code-Review", +1, +2, DEVS, "refs/heads/master"); ProjectControl u = user(local, DEVS); @@ -595,7 +595,7 @@ public class RefControlTest { } @Test - public void blockLabelRange_ParentBlocksChild() { + public void blockLabelRange_ParentBlocksChild() throws Exception { allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); block(parent, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); @@ -609,7 +609,7 @@ public class RefControlTest { } @Test - public void blockLabelRange_ParentBlocksChildEvenIfAlreadyBlockedInChild() { + public void blockLabelRange_ParentBlocksChildEvenIfAlreadyBlockedInChild() throws Exception { allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); block(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); block(parent, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); @@ -624,7 +624,7 @@ public class RefControlTest { } @Test - public void inheritSubmit_AllowInChildDoesntAffectUnblockInParent() { + public void inheritSubmit_AllowInChildDoesntAffectUnblockInParent() throws Exception { block(parent, SUBMIT, ANONYMOUS_USERS, "refs/heads/*"); allow(parent, SUBMIT, REGISTERED_USERS, "refs/heads/*"); allow(local, SUBMIT, REGISTERED_USERS, "refs/heads/*"); @@ -636,7 +636,7 @@ public class RefControlTest { } @Test - public void unblockNoForce() { + public void unblockNoForce() throws Exception { block(local, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(local, PUSH, DEVS, "refs/heads/*"); @@ -645,7 +645,7 @@ public class RefControlTest { } @Test - public void unblockForce() { + public void unblockForce() throws Exception { PermissionRule r = block(local, PUSH, ANONYMOUS_USERS, "refs/heads/*"); r.setForce(true); allow(local, PUSH, DEVS, "refs/heads/*").setForce(true); @@ -655,7 +655,7 @@ public class RefControlTest { } @Test - public void unblockRead_NotPossible() { + public void unblockRead_NotPossible() throws Exception { block(parent, READ, ANONYMOUS_USERS, "refs/*"); allow(parent, READ, ADMIN, "refs/*"); allow(local, READ, ANONYMOUS_USERS, "refs/*"); @@ -665,7 +665,7 @@ public class RefControlTest { } @Test - public void unblockForceWithAllowNoForce_NotPossible() { + public void unblockForceWithAllowNoForce_NotPossible() throws Exception { PermissionRule r = block(local, PUSH, ANONYMOUS_USERS, "refs/heads/*"); r.setForce(true); allow(local, PUSH, DEVS, "refs/heads/*"); @@ -675,7 +675,7 @@ public class RefControlTest { } @Test - public void unblockMoreSpecificRef_Fails() { + public void unblockMoreSpecificRef_Fails() throws Exception { block(local, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(local, PUSH, DEVS, "refs/heads/master"); @@ -684,7 +684,7 @@ public class RefControlTest { } @Test - public void unblockMoreSpecificRefInLocal_Fails() { + public void unblockMoreSpecificRefInLocal_Fails() throws Exception { block(parent, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(local, PUSH, DEVS, "refs/heads/master"); @@ -693,7 +693,7 @@ public class RefControlTest { } @Test - public void unblockMoreSpecificRefWithExclusiveFlag() { + public void unblockMoreSpecificRefWithExclusiveFlag() throws Exception { block(local, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(local, PUSH, DEVS, "refs/heads/master", true); @@ -702,7 +702,7 @@ public class RefControlTest { } @Test - public void unblockVoteMoreSpecificRefWithExclusiveFlag() { + public void unblockVoteMoreSpecificRefWithExclusiveFlag() throws Exception { String perm = LABEL + "Code-Review"; block(local, perm, -1, 1, ANONYMOUS_USERS, "refs/heads/*"); @@ -714,7 +714,7 @@ public class RefControlTest { } @Test - public void unblockFromParentDoesNotAffectChild() { + public void unblockFromParentDoesNotAffectChild() throws Exception { allow(parent, PUSH, DEVS, "refs/heads/master", true); block(local, PUSH, DEVS, "refs/heads/master"); @@ -723,7 +723,7 @@ public class RefControlTest { } @Test - public void unblockFromParentDoesNotAffectChildDifferentGroups() { + public void unblockFromParentDoesNotAffectChildDifferentGroups() throws Exception { allow(parent, PUSH, DEVS, "refs/heads/master", true); block(local, PUSH, ANONYMOUS_USERS, "refs/heads/master"); @@ -732,7 +732,7 @@ public class RefControlTest { } @Test - public void unblockMoreSpecificRefInLocalWithExclusiveFlag_Fails() { + public void unblockMoreSpecificRefInLocalWithExclusiveFlag_Fails() throws Exception { block(parent, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(local, PUSH, DEVS, "refs/heads/master", true); @@ -741,7 +741,7 @@ public class RefControlTest { } @Test - public void blockMoreSpecificRefWithinProject() { + public void blockMoreSpecificRefWithinProject() throws Exception { block(local, PUSH, ANONYMOUS_USERS, "refs/heads/secret"); allow(local, PUSH, DEVS, "refs/heads/*", true); @@ -751,7 +751,7 @@ public class RefControlTest { } @Test - public void unblockOtherPermissionWithMoreSpecificRefAndExclusiveFlag_Fails() { + public void unblockOtherPermissionWithMoreSpecificRefAndExclusiveFlag_Fails() throws Exception { block(local, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(local, PUSH, DEVS, "refs/heads/master"); allow(local, SUBMIT, DEVS, "refs/heads/master", true); @@ -761,7 +761,7 @@ public class RefControlTest { } @Test - public void unblockLargerScope_Fails() { + public void unblockLargerScope_Fails() throws Exception { block(local, PUSH, ANONYMOUS_USERS, "refs/heads/master"); allow(local, PUSH, DEVS, "refs/heads/*"); @@ -770,7 +770,7 @@ public class RefControlTest { } @Test - public void unblockInLocal_Fails() { + public void unblockInLocal_Fails() throws Exception { block(parent, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(local, PUSH, fixers, "refs/heads/*"); @@ -779,7 +779,7 @@ public class RefControlTest { } @Test - public void unblockInParentBlockInLocal() { + public void unblockInParentBlockInLocal() throws Exception { block(parent, PUSH, ANONYMOUS_USERS, "refs/heads/*"); allow(parent, PUSH, DEVS, "refs/heads/*"); block(local, PUSH, DEVS, "refs/heads/*"); @@ -789,7 +789,7 @@ public class RefControlTest { } @Test - public void unblockForceEditTopicName() { + public void unblockForceEditTopicName() throws Exception { block(local, EDIT_TOPIC_NAME, ANONYMOUS_USERS, "refs/heads/*"); allow(local, EDIT_TOPIC_NAME, DEVS, "refs/heads/*").setForce(true); @@ -800,7 +800,7 @@ public class RefControlTest { } @Test - public void unblockInLocalForceEditTopicName_Fails() { + public void unblockInLocalForceEditTopicName_Fails() throws Exception { block(parent, EDIT_TOPIC_NAME, ANONYMOUS_USERS, "refs/heads/*"); allow(local, EDIT_TOPIC_NAME, DEVS, "refs/heads/*").setForce(true); @@ -811,7 +811,7 @@ public class RefControlTest { } @Test - public void unblockRange() { + public void unblockRange() throws Exception { block(local, LABEL + "Code-Review", -1, +1, ANONYMOUS_USERS, "refs/heads/*"); allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); @@ -822,7 +822,7 @@ public class RefControlTest { } @Test - public void unblockRangeOnMoreSpecificRef_Fails() { + public void unblockRangeOnMoreSpecificRef_Fails() throws Exception { block(local, LABEL + "Code-Review", -1, +1, ANONYMOUS_USERS, "refs/heads/*"); allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/master"); @@ -833,7 +833,7 @@ public class RefControlTest { } @Test - public void unblockRangeOnLargerScope_Fails() { + public void unblockRangeOnLargerScope_Fails() throws Exception { block(local, LABEL + "Code-Review", -1, +1, ANONYMOUS_USERS, "refs/heads/master"); allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); @@ -844,7 +844,7 @@ public class RefControlTest { } @Test - public void nonconfiguredCannotVote() { + public void nonconfiguredCannotVote() throws Exception { allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); ProjectControl u = user(local, REGISTERED_USERS); @@ -854,7 +854,7 @@ public class RefControlTest { } @Test - public void unblockInLocalRange_Fails() { + public void unblockInLocalRange_Fails() throws Exception { block(parent, LABEL + "Code-Review", -1, 1, ANONYMOUS_USERS, "refs/heads/*"); allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); @@ -865,7 +865,7 @@ public class RefControlTest { } @Test - public void unblockRangeForChangeOwner() { + public void unblockRangeForChangeOwner() throws Exception { allow(local, LABEL + "Code-Review", -2, +2, CHANGE_OWNER, "refs/heads/*"); ProjectControl u = user(local, DEVS); @@ -876,7 +876,7 @@ public class RefControlTest { } @Test - public void unblockRangeForNotChangeOwner() { + public void unblockRangeForNotChangeOwner() throws Exception { allow(local, LABEL + "Code-Review", -2, +2, CHANGE_OWNER, "refs/heads/*"); ProjectControl u = user(local, DEVS); @@ -886,7 +886,7 @@ public class RefControlTest { } @Test - public void blockChangeOwnerVote() { + public void blockChangeOwnerVote() throws Exception { block(local, LABEL + "Code-Review", -2, +2, CHANGE_OWNER, "refs/heads/*"); ProjectControl u = user(local, DEVS); @@ -896,7 +896,7 @@ public class RefControlTest { } @Test - public void unionOfPermissibleVotes() { + public void unionOfPermissibleVotes() throws Exception { allow(local, LABEL + "Code-Review", -1, +1, DEVS, "refs/heads/*"); allow(local, LABEL + "Code-Review", -2, +2, REGISTERED_USERS, "refs/heads/*"); @@ -907,7 +907,7 @@ public class RefControlTest { } @Test - public void unionOfPermissibleVotesPermissionOrder() { + public void unionOfPermissibleVotesPermissionOrder() throws Exception { allow(local, LABEL + "Code-Review", -2, +2, REGISTERED_USERS, "refs/heads/*"); allow(local, LABEL + "Code-Review", -1, +1, DEVS, "refs/heads/*"); @@ -918,7 +918,7 @@ public class RefControlTest { } @Test - public void unionOfBlockedVotes() { + public void unionOfBlockedVotes() throws Exception { allow(parent, LABEL + "Code-Review", -1, +1, DEVS, "refs/heads/*"); block(parent, LABEL + "Code-Review", -2, +2, REGISTERED_USERS, "refs/heads/*"); block(local, LABEL + "Code-Review", -2, +1, REGISTERED_USERS, "refs/heads/*"); @@ -930,7 +930,7 @@ public class RefControlTest { } @Test - public void blockOwner() { + public void blockOwner() throws Exception { block(parent, OWNER, ANONYMOUS_USERS, "refs/*"); allow(local, OWNER, DEVS, "refs/*");