From 07d84866d01f4552e23f5566949c800a68830f53 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Mon, 3 May 2021 22:21:54 +0200 Subject: [PATCH] Remove now-unneeded reflection (#894) * Remove now-unneeded reflection Since we can now require Akka 2.6.14 Refs #830 * Remove test for now-disappeared scenario * Make version in pom consistent as well Doh --- .../scaladsl/ClusterHttpManagementRoutes.scala | 11 ++--------- .../scaladsl/ClusterHttpManagementRoutesSpec.scala | 11 ----------- integration-test/kubernetes-api-java/pom.xml | 2 +- project/Dependencies.scala | 2 +- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala b/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala index d9f224144..2850a60fa 100644 --- a/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala +++ b/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala @@ -273,15 +273,8 @@ object ClusterHttpManagementRoutes extends ClusterHttpManagementJsonProtocol { put { formField('operation) { operation => if (operation.toLowerCase == "prepare-for-full-shutdown") { - try { - // FIXME once we move to Akka 2.6 https://github.com/akka/akka-management/issues/830 - val m = cluster.getClass.getMethod("prepareForFullClusterShutdown") - m.invoke(cluster) - complete(ClusterHttpManagementMessage(s"Preparing for full cluster shutdown")) - } catch { - case NonFatal(_) => - complete(StatusCodes.BadRequest, "prepare-for-full-shutdown not supported in this Akka version") - } + cluster.prepareForFullClusterShutdown() + complete(ClusterHttpManagementMessage(s"Preparing for full cluster shutdown")) } else { complete(StatusCodes.BadRequest -> ClusterHttpManagementMessage("Operation not supported")) } diff --git a/cluster-http/src/test/scala/akka/cluster/http/management/scaladsl/ClusterHttpManagementRoutesSpec.scala b/cluster-http/src/test/scala/akka/cluster/http/management/scaladsl/ClusterHttpManagementRoutesSpec.scala index be8b646af..42ac1a0be 100644 --- a/cluster-http/src/test/scala/akka/cluster/http/management/scaladsl/ClusterHttpManagementRoutesSpec.scala +++ b/cluster-http/src/test/scala/akka/cluster/http/management/scaladsl/ClusterHttpManagementRoutesSpec.scala @@ -60,17 +60,6 @@ class ClusterHttpManagementRoutesSpec val version = new Version("1.42") "Http Cluster Management Routes" should { - "prepare cluster for shutdown" when { - "calling PUT on /cluster/ in an unsupported akka version" in { - val mockedCluster = mock(classOf[Cluster]) - Put("/cluster/", FormData("operation" -> "prepare-for-full-shutdown")) ~> ClusterHttpManagementRoutes( - mockedCluster) ~> check { - // at least makes sure the path matching works - status shouldEqual StatusCodes.BadRequest - } - } - } - "return list of members with cluster leader and oldest" when { "calling GET /cluster/members" in { val dcName = "one" diff --git a/integration-test/kubernetes-api-java/pom.xml b/integration-test/kubernetes-api-java/pom.xml index 064b1a07b..b79fdd996 100644 --- a/integration-test/kubernetes-api-java/pom.xml +++ b/integration-test/kubernetes-api-java/pom.xml @@ -18,7 +18,7 @@ 1.8 1.8 UTF-8 - 2.6.10 + 2.6.14 10.1.11 1.0.5 2.12 diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 32c156c80..029336b38 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -10,7 +10,7 @@ object Dependencies { val CrossScalaVersions = Seq(Dependencies.Scala212, Dependencies.Scala213) // Align the versions in integration-test/kubernetes-api-java/pom.xml - val AkkaVersion = "2.6.10" + val AkkaVersion = "2.6.14" val AkkaBinaryVersion = "2.6" // Align the versions in integration-test/kubernetes-api-java/pom.xml val AkkaHttp101 = "10.1.11"