From 127156a2c8776d5848e98c0bec65c1988dd3e9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CWitchellJack=E2=80=9D?= Date: Thu, 21 Mar 2024 10:51:16 +0000 Subject: [PATCH 1/4] SASS-7493 - migrated to play 3.0 --- build.sbt | 25 +++++++++---------- conf/application.conf | 11 -------- conf/prod.routes | 1 - .../DataExchangeServiceConnectorISpec.scala | 0 .../IntegrationFrameworkConnectorISpec.scala | 0 .../connectors/SubmissionConnectorISpec.scala | 0 ...eBenefitsUserDataRepositoryImplISpec.scala | 0 .../support/ConnectorIntegrationTest.scala | 0 it/{ => test}/support/DatabaseHelper.scala | 0 it/{ => test}/support/IntegrationTest.scala | 0 .../support/helpers/WireMockServer.scala | 0 .../support/stubs/WireMockStubs.scala | 0 project/AppDependencies.scala | 21 +++++++--------- project/build.properties | 2 +- project/plugins.sbt | 8 +++--- test/actions/AuthorisedActionSpec.scala | 4 +-- .../ResultBodyConsumerProvider.scala | 2 +- 17 files changed, 29 insertions(+), 45 deletions(-) rename it/{ => test}/connectors/DataExchangeServiceConnectorISpec.scala (100%) rename it/{ => test}/connectors/IntegrationFrameworkConnectorISpec.scala (100%) rename it/{ => test}/connectors/SubmissionConnectorISpec.scala (100%) rename it/{ => test}/repositories/StateBenefitsUserDataRepositoryImplISpec.scala (100%) rename it/{ => test}/support/ConnectorIntegrationTest.scala (100%) rename it/{ => test}/support/DatabaseHelper.scala (100%) rename it/{ => test}/support/IntegrationTest.scala (100%) rename it/{ => test}/support/helpers/WireMockServer.scala (100%) rename it/{ => test}/support/stubs/WireMockStubs.scala (100%) diff --git a/build.sbt b/build.sbt index 9ecb2a2..7fbf040 100644 --- a/build.sbt +++ b/build.sbt @@ -14,12 +14,11 @@ * limitations under the License. */ -import uk.gov.hmrc.DefaultBuildSettings.integrationTestSettings -import uk.gov.hmrc.sbtdistributables.SbtDistributablesPlugin.publishingSettings +import uk.gov.hmrc.DefaultBuildSettings val appName = "income-tax-state-benefits" -lazy val coverageSettings: Seq[Setting[_]] = { +lazy val coverageSettings: Seq[Setting[?]] = { import scoverage.ScoverageKeys val excludedPackages = Seq( @@ -45,24 +44,24 @@ lazy val coverageSettings: Seq[Setting[_]] = { ) } +ThisBuild / majorVersion := 0 +ThisBuild / scalaVersion := "2.13.12" + lazy val microservice = Project(appName, file(".")) .enablePlugins(play.sbt.PlayScala, SbtDistributablesPlugin) .settings( - // To resolve a bug with version 2.x.x of the scoverage plugin - https://github.com/sbt/sbt/issues/6997 - libraryDependencySchemes ++= Seq("org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always) - ) - .settings( - majorVersion := 0, - scalaVersion := "2.13.10", libraryDependencies ++= AppDependencies.compile ++ AppDependencies.test, scalacOptions += "-Wconf:cat=unused-imports&src=html/.*:s", scalacOptions += "-Wconf:src=routes/.*:s" ) - .settings(publishingSettings: _*) - .configs(IntegrationTest extend Test) - .settings(integrationTestSettings(): _*) .settings(resolvers += Resolver.jcenterRepo) .settings(PlayKeys.playDefaultPort := 9377) .disablePlugins(sbt.plugins.JUnitXmlReportPlugin) .disablePlugins(JUnitXmlReportPlugin) - .settings(coverageSettings: _*) + .settings(coverageSettings *) + + +lazy val it = project + .enablePlugins(PlayScala) + .dependsOn(microservice % "test->test") // the "test->test" allows reusing test code and test dependencies + .settings(DefaultBuildSettings.itSettings()) \ No newline at end of file diff --git a/conf/application.conf b/conf/application.conf index bbcac23..951ca88 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -19,17 +19,6 @@ include "backend.conf" appName = income-tax-state-benefits -# Provides an implementation of AuditConnector. Use `uk.gov.hmrc.play.audit.AuditModule` or create your own. -# An audit connector must be provided. -play.modules.enabled += "uk.gov.hmrc.play.audit.AuditModule" - -# Provides an implementation of MetricsFilter. Use `uk.gov.hmrc.play.graphite.GraphiteMetricsModule` or create your own. -# A metric filter must be provided -play.modules.enabled += "uk.gov.hmrc.play.bootstrap.graphite.GraphiteMetricsModule" - -# Provides an implementation and configures all filters required by a Platform frontend microservice. -play.modules.enabled += "uk.gov.hmrc.play.bootstrap.backend.BackendModule" - # Default http client play.modules.enabled += "uk.gov.hmrc.play.bootstrap.HttpClientModule" diff --git a/conf/prod.routes b/conf/prod.routes index cc77eb6..a2dd7b5 100644 --- a/conf/prod.routes +++ b/conf/prod.routes @@ -2,4 +2,3 @@ -> /income-tax-state-benefits app.Routes -> / health.Routes -GET /admin/metrics com.kenshoo.play.metrics.MetricsController.metrics diff --git a/it/connectors/DataExchangeServiceConnectorISpec.scala b/it/test/connectors/DataExchangeServiceConnectorISpec.scala similarity index 100% rename from it/connectors/DataExchangeServiceConnectorISpec.scala rename to it/test/connectors/DataExchangeServiceConnectorISpec.scala diff --git a/it/connectors/IntegrationFrameworkConnectorISpec.scala b/it/test/connectors/IntegrationFrameworkConnectorISpec.scala similarity index 100% rename from it/connectors/IntegrationFrameworkConnectorISpec.scala rename to it/test/connectors/IntegrationFrameworkConnectorISpec.scala diff --git a/it/connectors/SubmissionConnectorISpec.scala b/it/test/connectors/SubmissionConnectorISpec.scala similarity index 100% rename from it/connectors/SubmissionConnectorISpec.scala rename to it/test/connectors/SubmissionConnectorISpec.scala diff --git a/it/repositories/StateBenefitsUserDataRepositoryImplISpec.scala b/it/test/repositories/StateBenefitsUserDataRepositoryImplISpec.scala similarity index 100% rename from it/repositories/StateBenefitsUserDataRepositoryImplISpec.scala rename to it/test/repositories/StateBenefitsUserDataRepositoryImplISpec.scala diff --git a/it/support/ConnectorIntegrationTest.scala b/it/test/support/ConnectorIntegrationTest.scala similarity index 100% rename from it/support/ConnectorIntegrationTest.scala rename to it/test/support/ConnectorIntegrationTest.scala diff --git a/it/support/DatabaseHelper.scala b/it/test/support/DatabaseHelper.scala similarity index 100% rename from it/support/DatabaseHelper.scala rename to it/test/support/DatabaseHelper.scala diff --git a/it/support/IntegrationTest.scala b/it/test/support/IntegrationTest.scala similarity index 100% rename from it/support/IntegrationTest.scala rename to it/test/support/IntegrationTest.scala diff --git a/it/support/helpers/WireMockServer.scala b/it/test/support/helpers/WireMockServer.scala similarity index 100% rename from it/support/helpers/WireMockServer.scala rename to it/test/support/helpers/WireMockServer.scala diff --git a/it/support/stubs/WireMockStubs.scala b/it/test/support/stubs/WireMockStubs.scala similarity index 100% rename from it/support/stubs/WireMockStubs.scala rename to it/test/support/stubs/WireMockStubs.scala diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index ef31491..e3a2ab3 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -14,29 +14,26 @@ * limitations under the License. */ -import play.core.PlayVersion.current -import sbt._ - +import sbt.* object AppDependencies { - private val bootstrapBackendPlay28Version = "7.15.0" - private val hmrcMongoPlay28Version = "1.1.0" + private val bootstrapBackendPlay30Version = "8.4.0" + private val hmrcMongoPlay30Version = "1.7.0" val compile: Seq[ModuleID] = Seq( - "uk.gov.hmrc" %% "bootstrap-backend-play-28" % bootstrapBackendPlay28Version, - "uk.gov.hmrc.mongo" %% "hmrc-mongo-play-28" % hmrcMongoPlay28Version, + "uk.gov.hmrc" %% "bootstrap-backend-play-30" % bootstrapBackendPlay30Version, + "uk.gov.hmrc.mongo" %% "hmrc-mongo-play-30" % hmrcMongoPlay30Version, "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.14.2", "org.typelevel" %% "cats-core" % "2.9.0" ) val test: Seq[ModuleID] = Seq( - "uk.gov.hmrc" %% "bootstrap-test-play-28" % bootstrapBackendPlay28Version % "test, it", - "com.typesafe.play" %% "play-test" % current % Test, - "uk.gov.hmrc.mongo" %% "hmrc-mongo-test-play-28" % hmrcMongoPlay28Version % Test, + "uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapBackendPlay30Version % Test, + "uk.gov.hmrc.mongo" %% "hmrc-mongo-test-play-30" % hmrcMongoPlay30Version % Test, "org.scalamock" %% "scalamock" % "5.2.0" % Test, "org.scalatest" %% "scalatest" % "3.2.15" % Test, - "com.vladsch.flexmark" % "flexmark-all" % "0.64.0" % "test, it", - "com.github.tomakehurst" % "wiremock-jre8" % "2.35.0" % "test, it" + "com.vladsch.flexmark" % "flexmark-all" % "0.64.0" % Test, + "com.github.tomakehurst" % "wiremock-jre8-standalone" % "2.35.0" % Test ) } diff --git a/project/build.properties b/project/build.properties index 563a014..e8a1e24 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.7.2 +sbt.version=1.9.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index 1934319..45d8c0d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -22,8 +22,8 @@ ThisBuild / libraryDependencySchemes ++= Seq( "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always ) -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.9.0") -addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.2.0") -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.19") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.20.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0") +addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.1") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") diff --git a/test/actions/AuthorisedActionSpec.scala b/test/actions/AuthorisedActionSpec.scala index cc52ad8..8b14af5 100644 --- a/test/actions/AuthorisedActionSpec.scala +++ b/test/actions/AuthorisedActionSpec.scala @@ -16,8 +16,8 @@ package actions -import akka.actor.ActorSystem -import akka.stream.SystemMaterializer +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.stream.SystemMaterializer import models.authorisation.Enrolment.{Agent, Individual, Nino} import models.requests.AuthorisationRequest import play.api.http.Status._ diff --git a/test/support/providers/ResultBodyConsumerProvider.scala b/test/support/providers/ResultBodyConsumerProvider.scala index 0eca473..2064ce6 100644 --- a/test/support/providers/ResultBodyConsumerProvider.scala +++ b/test/support/providers/ResultBodyConsumerProvider.scala @@ -16,7 +16,7 @@ package support.providers -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import play.api.mvc.Result import play.api.test.DefaultAwaitTimeout import play.api.test.Helpers.await From 1b086041886fb5fb49fc5d0357a749aaa222cc6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CWitchellJack=E2=80=9D?= Date: Thu, 21 Mar 2024 10:58:46 +0000 Subject: [PATCH 2/4] SASS-7493 - addressed bot comments --- conf/application.conf | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/conf/application.conf b/conf/application.conf index 951ca88..85d687e 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -56,29 +56,8 @@ controllers { } -# Metrics plugin settings - graphite reporting is configured on a per env basis -metrics { - name = ${appName} - rateUnit = SECONDS - durationUnit = SECONDS - showSamples = true - jvm = true - enabled = false -} - # Microservice specific config -auditing { - enabled = true - traceRequests = true - consumer { - baseUri { - host = localhost - port = 8100 - } - } -} - mongodb { encryption.key = "QmFyMTIzNDVCYXIxMjM0NQ==" uri = "mongodb://localhost:27017/"${appName} @@ -88,14 +67,6 @@ mongodb { useEncryption = false microservice { - metrics { - graphite { - host = graphite - port = 2003 - prefix = play.${appName}. - enabled = false - } - } services { auth { From d32ea2fd95f161c6c6ea03973d45ac9947c87121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CWitchellJack=E2=80=9D?= Date: Mon, 25 Mar 2024 03:23:42 +0000 Subject: [PATCH 3/4] SASS-7493 - updated backend version --- project/AppDependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index e3a2ab3..68647ec 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -18,7 +18,7 @@ import sbt.* object AppDependencies { - private val bootstrapBackendPlay30Version = "8.4.0" + private val bootstrapBackendPlay30Version = "8.5.0" private val hmrcMongoPlay30Version = "1.7.0" val compile: Seq[ModuleID] = Seq( From 9fce9418b65665205dfbbae7f31ca598d46f7f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CWitchellJack=E2=80=9D?= Date: Mon, 25 Mar 2024 10:28:03 +0000 Subject: [PATCH 4/4] SASS-7493 - updated library version to address comment --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 45d8c0d..4b0f686 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -24,6 +24,6 @@ ThisBuild / libraryDependencySchemes ++= Seq( addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.20.0") addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0") -addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.1") +addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.2") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")