Fix compilation errors After change I35f1a785, the base class of SSHComandModule, the PluginComandModule API has changed and now takes a plugin name as a constructor argument. To conform to that change we inject the plugin name and pass it to the parent constructor. Secondly, after change I21bef286, the RestSession API is changed and declares a generic Exception instead of IOException to be thrown from their methods. Also removes duplicated static import of `assertThat` in ChronicleMapCacheIT. Bug: Issue 331383932 Change-Id: I4c12efa489665246932c6c65ab9e830c9dc18478
diff --git a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/SSHCommandModule.java b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/SSHCommandModule.java index abe1089..2de7fa9 100644 --- a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/SSHCommandModule.java +++ b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/SSHCommandModule.java
@@ -13,6 +13,7 @@ // limitations under the License. package com.googlesource.gerrit.modules.cache.chroniclemap; +import com.google.gerrit.extensions.annotations.PluginName; import com.google.gerrit.sshd.PluginCommandModule; import com.google.inject.Inject; import com.google.inject.Injector; @@ -22,7 +23,8 @@ private final Injector injector; @Inject - SSHCommandModule(Injector injector) { + SSHCommandModule(Injector injector, @PluginName String pluginName) { + super(pluginName); this.injector = injector; }
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java index 9367727..a40edc4 100644 --- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java +++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java
@@ -14,7 +14,6 @@ package com.googlesource.gerrit.modules.cache.chroniclemap; import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth8.assertThat; import com.google.common.cache.Cache; import com.google.gerrit.acceptance.AbstractDaemonTest;
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java index 3561051..e96f6fa 100644 --- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java +++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java
@@ -23,7 +23,6 @@ import com.google.gerrit.acceptance.RestResponse; import com.google.gerrit.acceptance.RestSession; import com.google.gerrit.acceptance.TestPlugin; -import java.io.IOException; import org.apache.http.message.BasicHeader; import org.junit.Test; @@ -59,12 +58,12 @@ .contains("Cannot run migration, cache directory is not configured"); } - private RestResponse runMigration(RestSession restSession) throws IOException { + private RestResponse runMigration(RestSession restSession) throws Exception { return runMigrationWithAcceptHeader(restSession, TEXT_PLAIN); } private RestResponse runMigrationWithAcceptHeader(RestSession restSession, String acceptHeader) - throws IOException { + throws Exception { return restSession.putWithHeaders(MIGRATION_ENDPOINT, new BasicHeader(ACCEPT, acceptHeader)); } }
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java index 469fcf8..c8d42b0 100644 --- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java +++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java
@@ -272,7 +272,7 @@ return (H2CacheImpl<K, V>) findClassBoundWithName(LoadingCache.class, named); } - private RestResponse runMigration(int sizeMultiplier, int maxBloatFactor) throws IOException { + private RestResponse runMigration(int sizeMultiplier, int maxBloatFactor) throws Exception { return adminRestSession.put( String.format( "%s?%s=%d&%s=%d", @@ -283,12 +283,12 @@ sizeMultiplier)); } - private RestResponse runMigration(RestSession restSession) throws IOException { + private RestResponse runMigration(RestSession restSession) throws Exception { return runMigrationWithAcceptHeader(restSession, TEXT_PLAIN); } private RestResponse runMigrationWithAcceptHeader(RestSession restSession, String acceptHeader) - throws IOException { + throws Exception { return restSession.putWithHeaders(MIGRATION_ENDPOINT, new BasicHeader(ACCEPT, acceptHeader)); }