Bump Gerrit to v3.10.0-rc2

Update Gerrit API and test framework to v3.10.0-rc2
and amend all the associated dependencies accordingly.

Also adjust the SshModule due to the new signature
of the base class constructor and fix test daemon issues
associated with the dependency of the config and daemon
JUnit test rules.

Change-Id: I8438dd2d95472999b2e0d5a4cf4820a37066ca33
diff --git a/build.sbt b/build.sbt
index 4140349..017d30f 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,6 +1,6 @@
 enablePlugins(GitVersioning)
 
-val gerritApiVersion = "3.9.0-rc2"
+val gerritApiVersion = "3.10.0-rc2"
 
 val pluginName = "analytics"
 
@@ -21,14 +21,14 @@
       "io.fabric8" % "gitective-core" % "0.9.54"
         exclude ("org.eclipse.jgit", "org.eclipse.jgit"),
 
-      "com.google.inject" % "guice" % "5.0.1" % Provided,
+      "com.google.inject" % "guice" % "6.0.0" % Provided,
       "com.google.gerrit" % "gerrit-plugin-api" % gerritApiVersion % Provided withSources(),
-      "com.google.code.gson" % "gson" % "2.8.5" % Provided,
+      "com.google.code.gson" % "gson" % "2.9.0" % Provided,
       "joda-time" % "joda-time" % "2.9.9",
       "org.scala-lang.modules" %% "scala-java8-compat" % "0.9.1",
 
       "com.google.gerrit" % "gerrit-acceptance-framework" % gerritApiVersion % Test,
-      "org.bouncycastle" % "bcpg-jdk15on" % "1.61" % Test,
+      "org.bouncycastle" % "bcpg-jdk18on" % "1.72" % Test,
       "org.scalatest" %% "scalatest" % "3.2.16" % Test,
       "net.codingwell" %% "scala-guice" % "5.0.0" % Test),
 
diff --git a/src/main/scala/com/googlesource/gerrit/plugins/analytics/SshModule.scala b/src/main/scala/com/googlesource/gerrit/plugins/analytics/SshModule.scala
index 01fe36d..569d865 100644
--- a/src/main/scala/com/googlesource/gerrit/plugins/analytics/SshModule.scala
+++ b/src/main/scala/com/googlesource/gerrit/plugins/analytics/SshModule.scala
@@ -15,8 +15,10 @@
 package com.googlesource.gerrit.plugins.analytics
 
 import com.google.gerrit.sshd.PluginCommandModule
+import com.google.gerrit.extensions.annotations.PluginName
+import com.google.inject.Inject
 
-class SshModule extends PluginCommandModule {
+class SshModule @Inject()(@PluginName val pluginName: String) extends PluginCommandModule(pluginName) {
 
   override protected def configureCommands = {
     command(classOf[ContributorsCommand])
diff --git a/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/GerritTestDaemon.scala b/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/GerritTestDaemon.scala
index 4d0df87..d793a46 100644
--- a/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/GerritTestDaemon.scala
+++ b/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/GerritTestDaemon.scala
@@ -35,7 +35,7 @@
 import org.eclipse.jgit.revwalk.RevCommit
 import org.gitective.core.CommitUtils
 import org.junit.runner.Description
-import org.junit.runners.model.Statement
+import org.junit.runners.model.{Statement, TestClass}
 import org.scalatest._
 
 trait GerritTestDaemon extends BeforeAndAfterEach {
@@ -45,18 +45,8 @@
 
   val daemonTest = GerritTestDaemon
 
-  protected abstract override def runTest(testName: String, args: Args): Status = {
-    var status: Status = FailedStatus
-    val runLambda = () => super.runTest(testName, args)
-
-    daemonTest.testRunner.apply(new Statement() {
-      override def evaluate(): Unit = {
-        status = runLambda.apply()
-      }
-    }, Description.createTestDescription(getClass.getName, testName)).evaluate()
-
-    status
-  }
+  protected abstract override def runTest(testName: String, args: Args): Status =
+    daemonTest.apply(getClass, testName, () => super.runTest(testName, args))
 
   var testFileRepository: TestFileRepository = _
 
@@ -175,6 +165,18 @@
 
   def restSession: RestSession = adminRestSession
 
+  def apply(testClass: Class[_], testName: String, runLambda: () => Status): Status = {
+    var status: Status = FailedStatus
+    val testDescription = Description.createTestDescription(testClass, testName)
+    val statement = new Statement() {
+      override def evaluate(): Unit = {
+        status = runLambda.apply()
+      }
+    }
+    configRule.apply(() => testRunner.apply(statement, testDescription).evaluate(), testDescription).evaluate()
+    status
+  }
+
   class TestModule extends AbstractModule {
     override def configure(): Unit = {
       bind(classOf[CommitsStatisticsCache]).to(classOf[CommitsStatisticsNoCache])