Merge branch 'stable-3.1' into stable-3.2
* stable-3.1:
Fix test due to change in Gerrit core
ChecksSubmitRule.Module: Demote base class to AbstractModule
Change-Id: Id9c2833b75419c9fecc430636b0258a235ea9bb9
diff --git a/java/com/google/gerrit/plugins/checks/rules/ChecksSubmitRule.java b/java/com/google/gerrit/plugins/checks/rules/ChecksSubmitRule.java
index 501785d..6d3ac4e 100644
--- a/java/com/google/gerrit/plugins/checks/rules/ChecksSubmitRule.java
+++ b/java/com/google/gerrit/plugins/checks/rules/ChecksSubmitRule.java
@@ -23,10 +23,10 @@
import com.google.gerrit.entities.PatchSet;
import com.google.gerrit.entities.Project;
import com.google.gerrit.extensions.annotations.Exports;
-import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.plugins.checks.Checks;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gerrit.server.rules.SubmitRule;
+import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.io.IOException;
@@ -42,7 +42,7 @@
.setType("checks_pass")
.build();
- public static class Module extends FactoryModule {
+ public static class Module extends AbstractModule {
@Override
public void configure() {
bind(SubmitRule.class)
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java
index 8848278..b1e0273 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java
@@ -349,16 +349,20 @@
@Test
public void createCheckOnChangeEditRejected() throws Exception {
- int changeId = patchSetId.changeId().get();
- gApi.changes().id(changeId).edit().modifyCommitMessage("new message");
- assertThat(gApi.changes().id(changeId).edit().get()).isPresent();
+ int numChangeId = patchSetId.changeId().get();
+ String changeId = gApi.changes().id(numChangeId).get().changeId;
+ gApi.changes()
+ .id(numChangeId)
+ .edit()
+ .modifyCommitMessage("Change edit\n\nChange-Id: " + changeId);
+ assertThat(gApi.changes().id(numChangeId).edit().get()).isPresent();
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(project).create();
CheckInput input = new CheckInput();
input.checkerUuid = checkerUuid.get();
input.state = CheckState.RUNNING;
RestResponse response =
- adminRestSession.post("/changes/" + changeId + "/revisions/edit/checks~checks", input);
+ adminRestSession.post("/changes/" + numChangeId + "/revisions/edit/checks~checks", input);
response.assertConflict();
assertThat(response.getEntityContent()).isEqualTo("checks are not supported on a change edit");
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
index 97fa1a6..ee3c261 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
@@ -554,8 +554,9 @@
@Test
public void getCheckOnChangeEditRejected() throws Exception {
- int changeId = patchSetId.changeId().get();
- gApi.changes().id(changeId).edit().modifyCommitMessage("new message");
+ int numChangeId = patchSetId.changeId().get();
+ String changeId = gApi.changes().id(numChangeId).get().changeId;
+ gApi.changes().id(changeId).edit().modifyCommitMessage("Change edit\n\nChange-Id: " + changeId);
Optional<EditInfo> editInfo = gApi.changes().id(changeId).edit().get();
assertThat(editInfo).isPresent();
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java
index 1be5870..d21488f 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java
@@ -349,7 +349,7 @@
@Test
public void listAllOnChangeEditRejected() throws Exception {
- gApi.changes().id(changeId).edit().modifyCommitMessage("new message");
+ gApi.changes().id(changeId).edit().modifyCommitMessage("Change edit\n\nChange-Id: " + changeId);
Optional<EditInfo> editInfo = gApi.changes().id(changeId).edit().get();
assertThat(editInfo).isPresent();