Adapt to the latest changes on Gerrit master
Gerrit master introduced a new project cache that
requires the its-jira integration tests to be amended
to stop mutating the project cache directly.
And upstep wiremock to java 11 compatible version.
Co-authored-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Steven Aerts <steven.aerts@gmail.com>
Change-Id: I57b78cefed1004263bec20418cc86e67466259a3
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index f04d8fb..2d26664 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -25,6 +25,6 @@
maven_jar(
name = "wiremock",
- artifact = "com.github.tomakehurst:wiremock-standalone:2.12.0",
- sha1 = "25f45d45091627a3bae5510495c99a561b2633c4",
+ artifact = "com.github.tomakehurst:wiremock-standalone:2.27.2",
+ sha1 = "327647a19b2319af2526b9c33a5733a2241723e0",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/jira/workflow/MarkPropertyAsReleasedVersionParametersExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/jira/workflow/MarkPropertyAsReleasedVersionParametersExtractor.java
index d55e550..65d3aa6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/jira/workflow/MarkPropertyAsReleasedVersionParametersExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/jira/workflow/MarkPropertyAsReleasedVersionParametersExtractor.java
@@ -36,7 +36,8 @@
String[] parameters = actionRequest.getParameters();
if (parameters.length != 1) {
log.error(
- "Wrong number of received parameters. Received parameters are {}. Only one parameter is expected, the property id.",
+ "Wrong number of received parameters. Received parameters are {}. Only one parameter is"
+ + " expected, the property id.",
Arrays.toString(parameters));
return Optional.empty();
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraConfigTest.java
index 7f5d0be..782b459 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraConfigTest.java
@@ -65,7 +65,7 @@
@Test
public void testGetPluginConfigFor() throws NoSuchProjectException {
Project.NameKey project = Project.nameKey("$project");
- PluginConfig pluginCfg = new PluginConfig(PLUGIN_NAME, new Config());
+ PluginConfig pluginCfg = PluginConfig.create(PLUGIN_NAME, new Config(), null);
when(cfgFactory.getFromProjectConfigWithInheritance(project, PLUGIN_NAME))
.thenReturn(pluginCfg);
jiraConfig.getPluginConfigFor(project.get());
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraITTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraITTest.java
index 08e8e29..2a53aae 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraITTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/jira/JiraITTest.java
@@ -21,7 +21,6 @@
import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.google.gerrit.server.project.ProjectCache.illegalState;
import static java.lang.String.format;
import static java.net.HttpURLConnection.HTTP_CREATED;
import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
@@ -34,7 +33,9 @@
import com.google.gerrit.acceptance.TestPlugin;
import com.google.gerrit.acceptance.UseLocalDisk;
import com.google.gerrit.acceptance.config.GerritConfig;
+import com.google.gerrit.acceptance.testsuite.project.ProjectOperations;
import com.google.gerrit.testing.ConfigSuite;
+import com.google.inject.Inject;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -70,6 +71,7 @@
private Path its_dir;
@Rule public WireMockRule wireMockRule = new WireMockRule(PORT);
+ @Inject private ProjectOperations projectOperations;
@Override
public void beforeTest(Description description) throws Exception {
@@ -79,12 +81,11 @@
@Before
public void enablePluginInProjectConfig() throws Exception {
- projectCache
- .get(project)
- .orElseThrow(illegalState(project))
- .getConfig()
- .getPluginConfig(PLUGIN_NAME)
- .setString("enabled", "true");
+ projectOperations
+ .project(project)
+ .forInvalidation()
+ .addProjectConfigUpdater(cfg -> cfg.setBoolean("plugin", PLUGIN_NAME, "enabled", true))
+ .invalidate();
}
@Test