Remove duplicate test method removeAnonymousRead

Use identical method AbstractDaemonTest#blockAnonymousRead() instead.

Change-Id: Ibe7260bea6e54c2dfd8ebcabb96999183421cf70
This commit is contained in:
Sven Selberg
2020-04-09 10:00:33 +02:00
committed by David Ostrovsky
parent 76f3e34046
commit d12f3dcbef

View File

@@ -21,16 +21,13 @@ import static com.google.gerrit.acceptance.GitUtil.pushHead;
import static com.google.gerrit.acceptance.GitUtil.updateAnnotatedTag;
import static com.google.gerrit.acceptance.rest.project.AbstractPushTag.TagType.ANNOTATED;
import static com.google.gerrit.acceptance.rest.project.AbstractPushTag.TagType.LIGHTWEIGHT;
import static com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS;
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
import com.google.common.base.MoreObjects;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.GitUtil;
import com.google.gerrit.common.data.Permission;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.project.testing.Util;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.PushResult;
@@ -58,7 +55,7 @@ public abstract class AbstractPushTag extends AbstractDaemonTest {
public void setUpTestEnvironment() throws Exception {
initialHead = getRemoteHead();
tagType = getTagType();
removeAnonymousRead();
blockAnonymousRead();
}
protected abstract TagType getTagType();
@@ -250,17 +247,6 @@ public abstract class AbstractPushTag extends AbstractDaemonTest {
removePermission(project, "refs/tags/*", Permission.PUSH);
}
private void removeAnonymousRead() throws Exception {
AccountGroup.UUID anonymous = systemGroupBackend.getGroup(ANONYMOUS_USERS).getUUID();
AccountGroup.UUID registered = systemGroupBackend.getGroup(REGISTERED_USERS).getUUID();
String allRefs = RefNames.REFS + "*";
try (ProjectConfigUpdate u = updateProject(project)) {
Util.block(u.getConfig(), Permission.READ, anonymous, allRefs);
Util.allow(u.getConfig(), Permission.READ, registered, allRefs);
u.save();
}
}
private void commit(PersonIdent ident, String subject) throws Exception {
commitBuilder().ident(ident).message(subject + " (" + System.nanoTime() + ")").create();
}