Rename TestLabels#category to label
This is a relic from when labels were called ApprovalCategories, which was changed in 2013. Change-Id: I83084d0a5906db48742a08a2ac18304d0c247446
This commit is contained in:
@@ -24,7 +24,7 @@ import static com.google.common.truth.TruthJUnit.assume;
|
||||
import static com.google.gerrit.extensions.api.changes.SubmittedTogetherOption.NON_VISIBLE_CHANGES;
|
||||
import static com.google.gerrit.reviewdb.client.Patch.COMMIT_MSG;
|
||||
import static com.google.gerrit.reviewdb.client.Patch.MERGE_LIST;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
@@ -1326,7 +1326,7 @@ public abstract class AbstractDaemonTest {
|
||||
LabelValue... value)
|
||||
throws Exception {
|
||||
try (ProjectConfigUpdate u = updateProject(project)) {
|
||||
LabelType labelType = category(label, value);
|
||||
LabelType labelType = label(label, value);
|
||||
labelType.setFunction(func);
|
||||
labelType.setRefPatterns(refPatterns);
|
||||
u.getConfig().getLabelSections().put(labelType.getName(), labelType);
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Arrays;
|
||||
|
||||
public class TestLabels {
|
||||
public static LabelType codeReview() {
|
||||
return category(
|
||||
return label(
|
||||
"Code-Review",
|
||||
value(2, "Looks good to me, approved"),
|
||||
value(1, "Looks good to me, but someone else must approve"),
|
||||
@@ -31,12 +31,12 @@ public class TestLabels {
|
||||
}
|
||||
|
||||
public static LabelType verified() {
|
||||
return category("Verified", value(1, "Verified"), value(0, "No score"), value(-1, "Fails"));
|
||||
return label("Verified", value(1, "Verified"), value(0, "No score"), value(-1, "Fails"));
|
||||
}
|
||||
|
||||
public static LabelType patchSetLock() {
|
||||
LabelType label =
|
||||
category("Patch-Set-Lock", value(1, "Patch Set Locked"), value(0, "Patch Set Unlocked"));
|
||||
label("Patch-Set-Lock", value(1, "Patch Set Locked"), value(0, "Patch Set Unlocked"));
|
||||
label.setFunction(LabelFunction.PATCH_SET_LOCK);
|
||||
return label;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class TestLabels {
|
||||
return new LabelValue((short) value, text);
|
||||
}
|
||||
|
||||
public static LabelType category(String name, LabelValue... values) {
|
||||
public static LabelType label(String name, LabelValue... values) {
|
||||
return new LabelType(name, Arrays.asList(values));
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ import static com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.CHANGE_OWNER;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.PROJECT_OWNERS;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
@@ -2155,7 +2155,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void removeReviewerNoVotes() throws Exception {
|
||||
LabelType verified =
|
||||
category("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
label("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
try (ProjectConfigUpdate u = updateProject(project)) {
|
||||
u.getConfig().getLabelSections().put(verified.getName(), verified);
|
||||
u.save();
|
||||
@@ -2441,7 +2441,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void nonVotingReviewerStaysAfterSubmit() throws Exception {
|
||||
LabelType verified =
|
||||
category("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
label("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
String heads = "refs/heads/*";
|
||||
try (ProjectConfigUpdate u = updateProject(project)) {
|
||||
u.getConfig().getLabelSections().put(verified.getName(), verified);
|
||||
@@ -2784,11 +2784,11 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void commitFooters() throws Exception {
|
||||
LabelType verified =
|
||||
category("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
label("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
LabelType custom1 =
|
||||
category("Custom1", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
label("Custom1", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
LabelType custom2 =
|
||||
category("Custom2", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
label("Custom2", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
try (ProjectConfigUpdate u = updateProject(project)) {
|
||||
u.getConfig().getLabelSections().put(verified.getName(), verified);
|
||||
u.getConfig().getLabelSections().put(custom1.getName(), custom1);
|
||||
|
||||
@@ -27,7 +27,7 @@ import static com.google.gerrit.extensions.client.ListChangesOption.CURRENT_COMM
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.CURRENT_REVISION;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.DETAILED_LABELS;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
import static org.eclipse.jgit.lib.Constants.HEAD;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class StickyApprovalsIT extends AbstractDaemonTest {
|
||||
// Overwrite "Code-Review" label that is inherited from All-Projects.
|
||||
// This way changes to the "Code Review" label don't affect other tests.
|
||||
LabelType codeReview =
|
||||
category(
|
||||
label(
|
||||
"Code-Review",
|
||||
value(2, "Looks good to me, approved"),
|
||||
value(1, "Looks good to me, but someone else must approve"),
|
||||
@@ -82,7 +82,7 @@ public class StickyApprovalsIT extends AbstractDaemonTest {
|
||||
u.getConfig().getLabelSections().put(codeReview.getName(), codeReview);
|
||||
|
||||
LabelType verified =
|
||||
category("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
label("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
verified.setCopyAllScoresIfNoChange(false);
|
||||
u.getConfig().getLabelSections().put(verified.getName(), verified);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import static com.google.gerrit.extensions.common.testing.EditInfoSubject.assert
|
||||
import static com.google.gerrit.server.git.receive.ReceiveConstants.PUSH_OPTION_SKIP_VALIDATION;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
import static java.util.Comparator.comparing;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
@@ -1202,7 +1202,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void pushWithMultipleApprovals() throws Exception {
|
||||
LabelType Q =
|
||||
category("Custom-Label", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
label("Custom-Label", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
String heads = "refs/heads/*";
|
||||
try (ProjectConfigUpdate u = updateProject(project)) {
|
||||
u.getConfig().getLabelSections().put(Q.getName(), Q);
|
||||
|
||||
@@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.allowLabel;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.DETAILED_LABELS;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
|
||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||
@@ -45,10 +45,10 @@ public class CommentAddedEventIT extends AbstractDaemonTest {
|
||||
@Inject private ProjectOperations projectOperations;
|
||||
|
||||
private final LabelType label =
|
||||
category("CustomLabel", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
label("CustomLabel", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
|
||||
private final LabelType pLabel =
|
||||
category("CustomLabel2", value(1, "Positive"), value(0, "No score"));
|
||||
label("CustomLabel2", value(1, "Positive"), value(0, "No score"));
|
||||
|
||||
private RegistrationHandle eventListenerRegistration;
|
||||
private CommentAddedListener.Event lastCommentAddedEvent;
|
||||
|
||||
@@ -27,7 +27,7 @@ import static com.google.gerrit.extensions.client.ListChangesOption.LABELS;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.SUBMITTABLE;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
|
||||
|
||||
@@ -59,9 +59,9 @@ public class CustomLabelIT extends AbstractDaemonTest {
|
||||
@Inject private ProjectOperations projectOperations;
|
||||
|
||||
private final LabelType label =
|
||||
category("CustomLabel", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
label("CustomLabel", value(1, "Positive"), value(0, "No score"), value(-1, "Negative"));
|
||||
|
||||
private final LabelType P = category("CustomLabel2", value(1, "Positive"), value(0, "No score"));
|
||||
private final LabelType P = label("CustomLabel2", value(1, "Positive"), value(0, "No score"));
|
||||
|
||||
private RegistrationHandle eventListenerRegistration;
|
||||
private CommentAddedListener.Event lastCommentAddedEvent;
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.google.gerrit.server.change;
|
||||
import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.allowLabel;
|
||||
import static com.google.gerrit.common.data.Permission.forLabel;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class LabelNormalizerTest {
|
||||
}
|
||||
}
|
||||
LabelType lt =
|
||||
category("Verified", value(1, "Verified"), value(0, "No score"), value(-1, "Fails"));
|
||||
label("Verified", value(1, "Verified"), value(0, "No score"), value(-1, "Fails"));
|
||||
pc.getLabelSections().put(lt.getName(), lt);
|
||||
save(pc);
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public class ProjectConfigTest {
|
||||
cfg.getLabelSections()
|
||||
.put(
|
||||
"My-Label",
|
||||
TestLabels.category(
|
||||
TestLabels.label(
|
||||
"My-Label",
|
||||
TestLabels.value(-1, "Negative"),
|
||||
TestLabels.value(0, "No score"),
|
||||
|
||||
@@ -22,7 +22,7 @@ import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.a
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.DETAILED_LABELS;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.REVIEWED;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.category;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.label;
|
||||
import static com.google.gerrit.server.project.testing.TestLabels.value;
|
||||
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
|
||||
import static java.util.concurrent.TimeUnit.HOURS;
|
||||
@@ -1053,7 +1053,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
Project.nameKey(repo.getRepository().getDescription().getRepositoryName());
|
||||
|
||||
LabelType verified =
|
||||
category("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
label("Verified", value(1, "Passes"), value(0, "No score"), value(-1, "Failed"));
|
||||
try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
|
||||
ProjectConfig cfg = projectConfigFactory.create(project);
|
||||
cfg.load(md);
|
||||
|
||||
Reference in New Issue
Block a user