diff --git a/.scalafmt.conf b/.scalafmt.conf
index e70ac47..5ac8eb7 100644
--- a/.scalafmt.conf
+++ b/.scalafmt.conf
@@ -1,4 +1,4 @@
-version="3.5.3"
+version="3.7.17"
runner.dialect = "scala213"
maxColumn = 180
diff --git a/build.sbt b/build.sbt
index 52ca7ca..8b4d258 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,73 +1,63 @@
-import uk.gov.hmrc.sbtdistributables.SbtDistributablesPlugin._
import uk.gov.hmrc.DefaultBuildSettings
-import AppDependencies._
-
-import bloop.integrations.sbt.BloopDefaults
+import uk.gov.hmrc.DefaultBuildSettings._
val appName = "api-platform-xml-services"
+Global / bloopAggregateSourceDependencies := true
+Global / bloopExportJarClassifiers := Some(Set("sources"))
-scalaVersion := "2.13.12"
-
+ThisBuild / scalaVersion := "2.13.12"
+ThisBuild / majorVersion := 0
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
-
lazy val microservice = Project(appName, file("."))
.enablePlugins(PlayScala, SbtDistributablesPlugin)
+ .disablePlugins(JUnitXmlReportPlugin)
.settings(
- name := appName,
- organization := "uk.gov.hmrc",
- majorVersion := 0,
- PlayKeys.playDefaultPort := 11116,
- libraryDependencies ++= AppDependencies(),
- retrieveManaged := true
+ PlayKeys.playDefaultPort := 11116,
+ libraryDependencies ++= AppDependencies(),
+ retrieveManaged := true,
+ // https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
+ // suppress warnings in generated routes files
+ scalacOptions += "-Wconf:src=routes/.*:s"
)
.settings(ScoverageSettings())
- .settings(Compile / unmanagedResourceDirectories += baseDirectory.value / "resources")
- .configs(IntegrationTest)
- .settings(DefaultBuildSettings.integrationTestSettings())
- .settings(inConfig(IntegrationTest)(scalafixConfigSettings(IntegrationTest)))
- .settings(inConfig(IntegrationTest)(ScalafmtPlugin.scalafmtConfigSettings))
- .settings(
- IntegrationTest / testOptions := Seq(Tests.Argument(TestFrameworks.ScalaTest, "-eT")),
- IntegrationTest / unmanagedSourceDirectories += baseDirectory.value / "testcommon",
- IntegrationTest / unmanagedSourceDirectories += baseDirectory.value / "it",
- IntegrationTest / parallelExecution := false
- )
+ .settings(Compile / unmanagedResourceDirectories += baseDirectory.value / "resources")
.settings(
Test / fork := false,
Test / parallelExecution := false,
- Test / testOptions := Seq(Tests.Argument(TestFrameworks.ScalaTest, "-eT")),
- Test / unmanagedSourceDirectories += baseDirectory.value / "testcommon",
- Test / unmanagedSourceDirectories += baseDirectory.value / "test"
+ Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-eT"),
+ Test / unmanagedSourceDirectories += baseDirectory.value / "testcommon"
)
.settings(
- routesImport ++= Seq(
- "uk.gov.hmrc.apiplatformxmlservices.controllers.binders._",
- "uk.gov.hmrc.apiplatformxmlservices.models._",
- "uk.gov.hmrc.apiplatform.modules.common.domain.models._",
- "uk.gov.hmrc.apiplatform.modules.apis.domain.models._"
- )
- )
- .settings(
- scalacOptions ++= Seq(
- "-Wconf:cat=unused&src=views/.*\\.scala:s",
- "-Wconf:cat=unused&src=.*RoutesPrefix\\.scala:s",
- "-Wconf:cat=unused&src=.*Routes\\.scala:s",
- "-Wconf:cat=unused&src=.*ReverseRoutes\\.scala:s"
+ routesImport ++= Seq(
+ "uk.gov.hmrc.apiplatformxmlservices.controllers.binders._",
+ "uk.gov.hmrc.apiplatformxmlservices.models._",
+ "uk.gov.hmrc.apiplatform.modules.common.domain.models._",
+ "uk.gov.hmrc.apiplatform.modules.apis.domain.models._"
)
)
- .disablePlugins(JUnitXmlReportPlugin)
-
-Global / bloopAggregateSourceDependencies := true
-commands ++= Seq(
- Command.command("run-all-tests") { state => "test" :: "it:test" :: state },
+lazy val it = (project in file("it"))
+ .enablePlugins(PlayScala)
+ .dependsOn(microservice % "test->test")
+ .settings(
+ name := "integration-tests",
+ Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-eT"),
+ DefaultBuildSettings.itSettings(),
+ addTestReportOption(Test, "int-test-reports")
+ )
- Command.command("clean-and-test") { state => "clean" :: "compile" :: "run-all-tests" :: state },
- // Coverage does not need compile !
- Command.command("pre-commit") { state => "clean" :: "scalafmtAll" :: "scalafixAll" :: "coverage" :: "run-all-tests" :: "coverageReport" :: "coverageOff" :: state }
+commands ++= Seq(
+ Command.command("cleanAll") { state => "clean" :: "it/clean" :: state },
+ Command.command("fmtAll") { state => "scalafmtAll" :: "it/scalafmtAll" :: state },
+ Command.command("fixAll") { state => "scalafixAll" :: "it/scalafixAll" :: state },
+ Command.command("testAll") { state => "test" :: "it/test" :: state },
+
+ Command.command("run-all-tests") { state => "testAll" :: state },
+ Command.command("clean-and-test") { state => "cleanAll" :: "compile" :: "run-all-tests" :: state },
+ Command.command("pre-commit") { state => "cleanAll" :: "fmtAll" :: "fixAll" :: "coverage" :: "testAll" :: "coverageOff" :: "coverageAggregate" :: state }
)
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/connectors/ThirdPartyDeveloperConnectorISpec.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/connectors/ThirdPartyDeveloperConnectorISpec.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/connectors/ThirdPartyDeveloperConnectorISpec.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/connectors/ThirdPartyDeveloperConnectorISpec.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/controllers/ApiControllerISpec.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/controllers/ApiControllerISpec.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/controllers/ApiControllerISpec.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/controllers/ApiControllerISpec.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/controllers/OrganisationControllerISpec.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/controllers/OrganisationControllerISpec.scala
similarity index 99%
rename from it/uk/gov/hmrc/apiplatformxmlservices/controllers/OrganisationControllerISpec.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/controllers/OrganisationControllerISpec.scala
index 0e8ca39..2aa6a74 100644
--- a/it/uk/gov/hmrc/apiplatformxmlservices/controllers/OrganisationControllerISpec.scala
+++ b/it/test/uk/gov/hmrc/apiplatformxmlservices/controllers/OrganisationControllerISpec.scala
@@ -223,7 +223,7 @@ class OrganisationControllerISpec extends ServerBaseISpec with BeforeAndAfterEac
val result = callGetEndpoint(s"$url/organisations")
result.status mustBe OK
val organisations = Json.parse(result.body).as[List[Organisation]]
- organisations must contain only (anOrganisation, organisation2)
+ organisations must contain.only(anOrganisation, organisation2)
}
"respond with 404 when VendorId not found" in new Setup {
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/controllers/TeamMemberControllerISpec.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/controllers/TeamMemberControllerISpec.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/controllers/TeamMemberControllerISpec.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/controllers/TeamMemberControllerISpec.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/repository/OrganisationRepositoryISpec.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/repository/OrganisationRepositoryISpec.scala
similarity index 99%
rename from it/uk/gov/hmrc/apiplatformxmlservices/repository/OrganisationRepositoryISpec.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/repository/OrganisationRepositoryISpec.scala
index f0b1cf5..0dabb29 100644
--- a/it/uk/gov/hmrc/apiplatformxmlservices/repository/OrganisationRepositoryISpec.scala
+++ b/it/test/uk/gov/hmrc/apiplatformxmlservices/repository/OrganisationRepositoryISpec.scala
@@ -223,7 +223,7 @@ class OrganisationRepositoryISpec
val results = await(repo.findByOrganisationName(OrganisationName("DEF")))
- results should contain allOf (org3, org4)
+ results should contain.allOf(org3, org4)
}
"return no organisations when there are no matches" in new Setup {
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/stubs/ThirdPartyDeveloperStub.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/stubs/ThirdPartyDeveloperStub.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/stubs/ThirdPartyDeveloperStub.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/stubs/ThirdPartyDeveloperStub.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/support/BaseISpec.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/support/BaseISpec.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/support/BaseISpec.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/support/BaseISpec.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/support/MongoApp.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/support/MongoApp.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/support/MongoApp.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/support/MongoApp.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/support/PortHelper.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/support/PortHelper.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/support/PortHelper.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/support/PortHelper.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/support/ServerBaseISpec.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/support/ServerBaseISpec.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/support/ServerBaseISpec.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/support/ServerBaseISpec.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/support/TestApplication.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/support/TestApplication.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/support/TestApplication.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/support/TestApplication.scala
diff --git a/it/uk/gov/hmrc/apiplatformxmlservices/support/WireMockSupport.scala b/it/test/uk/gov/hmrc/apiplatformxmlservices/support/WireMockSupport.scala
similarity index 100%
rename from it/uk/gov/hmrc/apiplatformxmlservices/support/WireMockSupport.scala
rename to it/test/uk/gov/hmrc/apiplatformxmlservices/support/WireMockSupport.scala
diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala
index d354224..fd3eab7 100644
--- a/project/AppDependencies.scala
+++ b/project/AppDependencies.scala
@@ -7,8 +7,8 @@ object AppDependencies {
lazy val mongoVersion = "1.7.0"
lazy val bootstrapVersion = "8.4.0"
- val apiDomainVersion = "0.11.0"
- val commonDomainVersion = "0.10.0"
+ val apiDomainVersion = "0.15.0"
+ val commonDomainVersion = "0.13.0"
def apply(): Seq[ModuleID] =
compile ++ test
@@ -25,8 +25,7 @@ object AppDependencies {
"uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapVersion,
"uk.gov.hmrc.mongo" %% "hmrc-mongo-test-play-30" % mongoVersion,
"org.pegdown" % "pegdown" % "1.6.0",
- "org.mockito" %% "mockito-scala-scalatest" % "1.17.29",
- "com.github.tomakehurst" % "wiremock-jre8-standalone" % "2.35.1",
+ "org.mockito" %% "mockito-scala-scalatest" % "1.17.30",
"uk.gov.hmrc" %% "api-platform-test-common-domain" % commonDomainVersion
- ).map(_ % "test, it")
+ ).map(_ % "test")
}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index c8bedb0..db7e480 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,13 +2,13 @@ resolvers += MavenRepository("HMRC-open-artefacts-maven2", "https://open.artefac
resolvers += Resolver.url("HMRC-open-artefacts-ivy2", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns)
resolvers += Resolver.typesafeRepo("releases")
-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")
-addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
-addSbtPlugin("ch.epfl.scala" %% "sbt-scalafix" % "0.11.1")
-addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.13")
+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")
+addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")
+addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.15")
-ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
\ No newline at end of file
+ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
diff --git a/run_all_tests.sh b/run_all_tests.sh
index 436171f..35a85cb 100755
--- a/run_all_tests.sh
+++ b/run_all_tests.sh
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
-sbt clean scalafmtAll scalafixAll scalastyle coverage test it:test coverageReport
+sbt pre-commit
diff --git a/scalastyle-config.xml b/scalastyle-config.xml
index 21d7958..4972199 100644
--- a/scalastyle-config.xml
+++ b/scalastyle-config.xml
@@ -1,15 +1,16 @@
Scalastyle standard configuration
-
+
-
-
-
-
+
+
+
+
+
@@ -25,7 +26,7 @@
-
+
@@ -41,14 +42,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -64,8 +65,8 @@
-
-
+
+
@@ -87,7 +88,7 @@
-
-
-
-
\ No newline at end of file
+
+
+
+