Merge "AbstractDaemonTest: Add saveProjectConfig method"

This commit is contained in:
Hugo Arès 2016-04-08 14:19:32 +00:00 committed by Gerrit Code Review
commit 309f8835f3
4 changed files with 4 additions and 21 deletions

View File

@ -617,6 +617,10 @@ public abstract class AbstractDaemonTest {
projectCache.evict(cfg.getProject());
}
protected void saveProjectConfig(ProjectConfig cfg) throws Exception {
saveProjectConfig(project, cfg);
}
protected void grant(String permission, Project.NameKey project, String ref)
throws RepositoryNotFoundException, IOException, ConfigInvalidException {
grant(permission, project, ref, false);

View File

@ -39,7 +39,6 @@ import com.google.gerrit.extensions.common.EditInfo;
import com.google.gerrit.extensions.common.LabelInfo;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.server.git.MetaDataUpdate;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.server.group.SystemGroupBackend;
import com.google.gerrit.server.project.Util;
@ -88,12 +87,6 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
grant(Permission.LABEL + "Patch-Set-Lock", project, "refs/heads/*");
}
private void saveProjectConfig(ProjectConfig cfg) throws Exception {
try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
cfg.commit(md);
}
}
protected void selectProtocol(Protocol p) throws Exception {
String url;
switch (p) {

View File

@ -32,7 +32,6 @@ import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.server.git.MetaDataUpdate;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.server.group.SystemGroupBackend;
import com.google.gerrit.server.project.Util;
@ -241,12 +240,6 @@ public class MoveChangeIT extends AbstractDaemonTest {
move(r.getChangeId(), newBranch.get());
}
private void saveProjectConfig(ProjectConfig cfg) throws Exception {
try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
cfg.commit(md);
}
}
private void move(int changeNum, String destination)
throws RestApiException {
gApi.changes().id(changeNum).move(destination);

View File

@ -26,7 +26,6 @@ import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.LabelInfo;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.server.git.MetaDataUpdate;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.server.project.Util;
@ -416,12 +415,6 @@ public class LabelTypeIT extends AbstractDaemonTest {
saveProjectConfig(cfg);
}
private void saveProjectConfig(ProjectConfig cfg) throws Exception {
try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
cfg.commit(md);
}
}
@Override
protected void merge(PushOneCommit.Result r) throws Exception {
super.merge(r);