From 6816375f9fe2c8fb6340e479a761338875c70329 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 8 Apr 2016 00:43:12 +0900 Subject: [PATCH] AbstractDaemonTest: Add saveProjectConfig method The same saveProjectConfig implementation is defined in 3 test classes that are derived from AbstractDaemonTest. Remove them and define it once in AbstractDaemonTest instead. Change-Id: Ic627f389a1a154cbb095c1b6a184178f0b154094 --- .../com/google/gerrit/acceptance/AbstractDaemonTest.java | 4 ++++ .../gerrit/acceptance/git/AbstractPushForReview.java | 7 ------- .../google/gerrit/acceptance/rest/change/MoveChangeIT.java | 7 ------- .../gerrit/acceptance/server/project/LabelTypeIT.java | 7 ------- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java index 9cf15152bb..f490cad0b6 100644 --- a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java +++ b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java @@ -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); diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/AbstractPushForReview.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/AbstractPushForReview.java index 638d20e0ab..205a3bb114 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/AbstractPushForReview.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/AbstractPushForReview.java @@ -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) { diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/MoveChangeIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/MoveChangeIT.java index db73b1be06..c164786567 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/MoveChangeIT.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/MoveChangeIT.java @@ -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); diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/server/project/LabelTypeIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/server/project/LabelTypeIT.java index a22b09d319..a69bb19631 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/server/project/LabelTypeIT.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/server/project/LabelTypeIT.java @@ -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);