Skip to content

Commit

Permalink
GG-7600 upgrade to play 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
david-walters-HMRC committed Mar 20, 2024
1 parent a92bd24 commit 3cd3309
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app/filters/MicroserviceAuthFilter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package filters

import akka.stream.Materializer
import javax.inject.{Inject, Singleton}
import play.api.Configuration
import play.api.libs.json.Json
Expand All @@ -25,6 +24,7 @@ import play.api.routing.Router
import uk.gov.hmrc.auth.core.{AuthorisationException, AuthorisedFunctions}
import connectors.AuthConnector
import controllers.ErrorUnauthorized
import org.apache.pekko.stream.Materializer
import uk.gov.hmrc.play.http.HeaderCarrierConverter

import scala.concurrent.{ExecutionContext, Future}
Expand Down
7 changes: 1 addition & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import scala.collection.Seq
val appName = "openid-connect-userinfo"
ThisBuild / majorVersion := 1
ThisBuild / scalaVersion := "2.13.12"
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always // it should not be needed but the build still fails without it

lazy val microservice = Project(appName, file("."))
.enablePlugins(PlayScala, SbtDistributablesPlugin)
.settings(DefaultBuildSettings.defaultSettings(): _*)
.disablePlugins(JUnitXmlReportPlugin) // Required to prevent https://github.com/scalatest/scalatest/issues/1427
.settings(
playDefaultPort := 9836,
Expand All @@ -29,8 +29,3 @@ lazy val it = project
.enablePlugins(PlayScala)
.dependsOn(microservice % "test->test") // the "test->test" allows reusing test code and test dependencies
.settings(DefaultBuildSettings.itSettings())
.settings(Test / unmanagedResourceDirectories += baseDirectory.value / "test" / "resources")
.settings(
Test / parallelExecution := false,
Test / fork := false
)
36 changes: 18 additions & 18 deletions project/AppDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ import sbt.*

object AppDependencies {

private val bootstrapPlayVersion = "8.4.0"
private val bootstrapPlayVersion = "8.5.0"

private val compile: Seq[ModuleID] = Seq(
ws,
"uk.gov.hmrc" %% "bootstrap-backend-play-28" % bootstrapPlayVersion,
"uk.gov.hmrc" %% "domain" % "8.3.0-play-28",
"uk.gov.hmrc" %% "play-hmrc-api" % "7.2.0-play-28"
"uk.gov.hmrc" %% "bootstrap-backend-play-30" % bootstrapPlayVersion,
"uk.gov.hmrc" %% "domain-play-30" % "9.0.0",
"uk.gov.hmrc" %% "play-hmrc-api-play-30" % "8.0.0"
)

private val test: Seq[ModuleID] = Seq(
"org.scalatest" %% "scalatest" % "3.2.17",
"org.scalatestplus" %% "scalacheck-1-17" % "3.2.17.0",
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0",
"com.typesafe.play" %% "play-test" % PlayVersion.current,
"com.github.tomakehurst" % "wiremock" % "2.27.2",
"uk.gov.hmrc" %% "bootstrap-test-play-28" % bootstrapPlayVersion,
"org.pegdown" % "pegdown" % "1.6.0",
"org.jsoup" % "jsoup" % "1.17.2",
"org.scalaj" %% "scalaj-http" % "2.4.2",
"org.mockito" %% "mockito-scala-scalatest" % "1.17.30",
"org.scalacheck" %% "scalacheck" % "1.17.0",
"com.github.java-json-tools" % "json-schema-validator" % "2.2.14",
"com.vladsch.flexmark" % "flexmark-all" % "0.64.0"
).map(_ % Test)
"org.scalatest" %% "scalatest" % "3.2.17" % Test,
"org.scalatestplus" %% "scalacheck-1-17" % "3.2.17.0" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test,
"org.playframework" %% "play-test" % PlayVersion.current % Test,
"com.github.tomakehurst" % "wiremock" % "2.27.2" % Test,
"uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapPlayVersion % Test,
"org.pegdown" % "pegdown" % "1.6.0" % Test,
"org.jsoup" % "jsoup" % "1.17.2" % Test,
"org.scalaj" %% "scalaj-http" % "2.4.2" % Test,
"org.mockito" %% "mockito-scala-scalatest" % "1.17.30" % Test,
"org.scalacheck" %% "scalacheck" % "1.17.0" % Test,
"com.github.java-json-tools" % "json-schema-validator" % "2.2.14" % Test,
"com.vladsch.flexmark" % "flexmark-all" % "0.64.0" % Test
)

def apply(): Seq[ModuleID] = compile ++ test

Expand Down
13 changes: 7 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
resolvers += "HMRC-open-artefacts-maven" at "https://open.artefacts.tax.service.gov.uk/maven2"
resolvers += Resolver.url("HMRC-open-artefacts-ivy", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns)
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always // it should not be needed but the build still fails without it

addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.4.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.19.0")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.21")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")

addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.20.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")
addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.2")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0" exclude("org.scala-lang.modules", "scala-xml_2.12"))
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
3 changes: 2 additions & 1 deletion test/controllers/UserInfoControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

package controllers

import akka.actor.ActorSystem
import config.AppContext
import domain.{Address, GovernmentGatewayDetails, UserInfo}
import org.apache.pekko.actor.ActorSystem

import java.time.LocalDate
import org.mockito.BDDMockito.given
import org.scalatest.concurrent.ScalaFutures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package controllers.testOnly

import akka.actor.ActorSystem
import org.scalatest.concurrent.ScalaFutures
import play.api.libs.json._
import play.api.mvc.{ControllerComponents, Request, Result}
import play.api.test.FakeRequest
import config.{FeatureSwitch, UserInfoFeatureSwitches}
import org.apache.pekko.actor.ActorSystem
import testSupport.UnitSpec

import scala.concurrent.ExecutionContext
Expand Down
4 changes: 2 additions & 2 deletions test/testSupport/UnitSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package testSupport

import java.nio.charset.Charset
import akka.stream.Materializer
import akka.util.ByteString
import org.apache.pekko.stream.Materializer
import org.apache.pekko.util.ByteString
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import play.api.libs.json.{JsValue, Json}
Expand Down

0 comments on commit 3cd3309

Please sign in to comment.