From ddbcf793a07f33045942e59770bd344163af9783 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Fri, 25 Oct 2024 08:35:30 +0000 Subject: [PATCH 01/18] Update s3-utils, sns-utils to 0.1.216 in scala-steward-dependencies --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 9c397891e..039b153d3 100644 --- a/build.sbt +++ b/build.sbt @@ -31,8 +31,8 @@ libraryDependencies ++= Seq( "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.217", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.390", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", - "uk.gov.nationalarchives" %% "s3-utils" % "0.1.215", - "uk.gov.nationalarchives" %% "sns-utils" % "0.1.215", + "uk.gov.nationalarchives" %% "s3-utils" % "0.1.216", + "uk.gov.nationalarchives" %% "sns-utils" % "0.1.216", "ch.qos.logback" % "logback-classic" % "1.5.11", ws, "io.opentelemetry" % "opentelemetry-api" % "1.43.0", From 88cb3452c0191e2cc4715f1cecbd43724c34209a Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Fri, 25 Oct 2024 08:35:35 +0000 Subject: [PATCH 02/18] Update tdr-auth-utils to 0.0.218 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 9c397891e..9ab68635e 100644 --- a/build.sbt +++ b/build.sbt @@ -28,7 +28,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "circe" % sttpVersion, "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.190", - "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.217", + "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.390", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", "uk.gov.nationalarchives" %% "s3-utils" % "0.1.215", From a628d565765b0efe42e67d317de9a91945e97217 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Mon, 28 Oct 2024 08:29:59 +0000 Subject: [PATCH 03/18] Update logback-classic to 1.5.12 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b2ae24f5a..7b00b5a27 100644 --- a/build.sbt +++ b/build.sbt @@ -33,7 +33,7 @@ libraryDependencies ++= Seq( "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", "uk.gov.nationalarchives" %% "s3-utils" % "0.1.216", "uk.gov.nationalarchives" %% "sns-utils" % "0.1.216", - "ch.qos.logback" % "logback-classic" % "1.5.11", + "ch.qos.logback" % "logback-classic" % "1.5.12", ws, "io.opentelemetry" % "opentelemetry-api" % "1.43.0", "io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.43.0", From 7b564d5fc93e5b55c2153200b3eb5c6c608048e3 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Mon, 28 Oct 2024 08:30:04 +0000 Subject: [PATCH 04/18] Update tdr-generated-graphql to 0.0.391 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b2ae24f5a..45c06d9a7 100644 --- a/build.sbt +++ b/build.sbt @@ -29,7 +29,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.190", "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", - "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.390", + "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", "uk.gov.nationalarchives" %% "s3-utils" % "0.1.216", "uk.gov.nationalarchives" %% "sns-utils" % "0.1.216", From cf64531f37ed8f7a16a63c6c0697d7b00fe8b212 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Mon, 28 Oct 2024 08:30:09 +0000 Subject: [PATCH 05/18] Update tdr-graphql-client to 0.0.191 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b2ae24f5a..86ac673cd 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "core" % sttpVersion, "com.softwaremill.sttp.client" %% "circe" % sttpVersion, "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, - "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.190", + "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.191", "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.390", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", From ecbcf65910b934f74fccd3cb6ff724bce087843e Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Thu, 31 Oct 2024 08:32:53 +0000 Subject: [PATCH 06/18] Update sbt to 1.10.4 in scala-steward-dependencies --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index caeacc5ee..c0685085e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.3 \ No newline at end of file +sbt.version=1.10.4 \ No newline at end of file From 67580c84ec1c5d889b31821ca32e9c39972a49cc Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Thu, 31 Oct 2024 08:32:57 +0000 Subject: [PATCH 07/18] Update s3-utils, sns-utils to 0.1.218 in scala-steward-dependencies --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 755bf82c6..d1e88da88 100644 --- a/build.sbt +++ b/build.sbt @@ -31,8 +31,8 @@ libraryDependencies ++= Seq( "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", - "uk.gov.nationalarchives" %% "s3-utils" % "0.1.216", - "uk.gov.nationalarchives" %% "sns-utils" % "0.1.216", + "uk.gov.nationalarchives" %% "s3-utils" % "0.1.218", + "uk.gov.nationalarchives" %% "sns-utils" % "0.1.218", "ch.qos.logback" % "logback-classic" % "1.5.12", ws, "io.opentelemetry" % "opentelemetry-api" % "1.43.0", From 8b09feb4c827878bf7f86ae8f877cd536dee48cf Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Thu, 31 Oct 2024 08:33:07 +0000 Subject: [PATCH 08/18] Update tdr-graphql-client to 0.0.192 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 755bf82c6..b94ae141b 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "core" % sttpVersion, "com.softwaremill.sttp.client" %% "circe" % sttpVersion, "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, - "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.191", + "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.192", "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", From 17a9ba499516ec9e569d9d5e3f5e4729233b8e79 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:31:35 +0000 Subject: [PATCH 09/18] Update s3-utils, sns-utils to 0.1.219 in scala-steward-dependencies --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 50366c267..2ba1d41df 100644 --- a/build.sbt +++ b/build.sbt @@ -31,8 +31,8 @@ libraryDependencies ++= Seq( "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", - "uk.gov.nationalarchives" %% "s3-utils" % "0.1.218", - "uk.gov.nationalarchives" %% "sns-utils" % "0.1.218", + "uk.gov.nationalarchives" %% "s3-utils" % "0.1.219", + "uk.gov.nationalarchives" %% "sns-utils" % "0.1.219", "ch.qos.logback" % "logback-classic" % "1.5.12", ws, "io.opentelemetry" % "opentelemetry-api" % "1.43.0", From 2e289e075aad2563310f4649f0eb054090d9dfc0 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:31:40 +0000 Subject: [PATCH 10/18] Update tdr-auth-utils to 0.0.219 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 50366c267..3b003ede6 100644 --- a/build.sbt +++ b/build.sbt @@ -28,7 +28,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "circe" % sttpVersion, "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.192", - "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", + "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.219", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", "uk.gov.nationalarchives" %% "s3-utils" % "0.1.218", From 28ecc841925a2742ff0364ae53b784ed8b4fce95 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:31:51 +0000 Subject: [PATCH 11/18] Update tdr-graphql-client to 0.0.193 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 50366c267..458d3664c 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "core" % sttpVersion, "com.softwaremill.sttp.client" %% "circe" % sttpVersion, "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, - "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.192", + "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.193", "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.218", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", From eecbc4143ac698e1d1d28461e079853dcaecf2c0 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Mon, 4 Nov 2024 08:29:28 +0000 Subject: [PATCH 12/18] Update sbt to 1.10.5 in scala-steward-dependencies --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index c0685085e..c7450fc2a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.4 \ No newline at end of file +sbt.version=1.10.5 \ No newline at end of file From cb21a913d38ec460d6cd8d2edc533d74af7ca4b0 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:33:05 +0000 Subject: [PATCH 13/18] Update jackson-core, jackson-databind to 2.17.3 in scala-steward-dependencies --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 9cbb092f9..017b328ba 100644 --- a/build.sbt +++ b/build.sbt @@ -48,8 +48,8 @@ libraryDependencies ++= Seq( ) libraryDependencies += "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.2" -dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.0" -dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-core" % "2.17.0" +dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.3" +dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-core" % "2.17.3" disablePlugins(PlayLogback) scalacOptions ++= Seq("-language:implicitConversions") From 400925fe353bb921a452467d8a300f6f4b94865d Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:33:29 +0000 Subject: [PATCH 14/18] Update s3-utils, sns-utils to 0.1.221 in scala-steward-dependencies --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 9cbb092f9..853397b92 100644 --- a/build.sbt +++ b/build.sbt @@ -31,8 +31,8 @@ libraryDependencies ++= Seq( "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.219", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", - "uk.gov.nationalarchives" %% "s3-utils" % "0.1.219", - "uk.gov.nationalarchives" %% "sns-utils" % "0.1.219", + "uk.gov.nationalarchives" %% "s3-utils" % "0.1.221", + "uk.gov.nationalarchives" %% "sns-utils" % "0.1.221", "ch.qos.logback" % "logback-classic" % "1.5.12", ws, "io.opentelemetry" % "opentelemetry-api" % "1.43.0", From bc0402cffa76a486ffcaeff42314fd8de77ece51 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:33:38 +0000 Subject: [PATCH 15/18] Update tdr-graphql-client to 0.0.194 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 9cbb092f9..df4045dba 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "core" % sttpVersion, "com.softwaremill.sttp.client" %% "circe" % sttpVersion, "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, - "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.193", + "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.194", "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.219", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", From 5921f3e64a1d87b8e76b3bff166a38f7477b9997 Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Sun, 10 Nov 2024 08:27:49 +0000 Subject: [PATCH 16/18] Update opentelemetry-api, ... to 1.44.1 in scala-steward-dependencies --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 2e9a645c9..b9af9d136 100644 --- a/build.sbt +++ b/build.sbt @@ -35,9 +35,9 @@ libraryDependencies ++= Seq( "uk.gov.nationalarchives" %% "sns-utils" % "0.1.221", "ch.qos.logback" % "logback-classic" % "1.5.12", ws, - "io.opentelemetry" % "opentelemetry-api" % "1.43.0", - "io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.43.0", - "io.opentelemetry" % "opentelemetry-sdk" % "1.43.0", + "io.opentelemetry" % "opentelemetry-api" % "1.44.1", + "io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.44.1", + "io.opentelemetry" % "opentelemetry-sdk" % "1.44.1", "io.opentelemetry" % "opentelemetry-extension-aws" % "1.20.1", "io.opentelemetry" % "opentelemetry-sdk-extension-aws" % "1.19.0", "io.opentelemetry.contrib" % "opentelemetry-aws-xray" % "1.40.0", From 19acf4bed72b4f65d02a7e26ff1702800fc702ec Mon Sep 17 00:00:00 2001 From: tna-da-bot <181243999+tna-da-bot@users.noreply.github.com> Date: Sun, 10 Nov 2024 08:27:57 +0000 Subject: [PATCH 17/18] Update tdr-auth-utils to 0.0.220 in scala-steward-dependencies --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2e9a645c9..40c1a19a4 100644 --- a/build.sbt +++ b/build.sbt @@ -28,7 +28,7 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.client" %% "circe" % sttpVersion, "com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion, "uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.194", - "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.219", + "uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.220", "uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.391", "uk.gov.nationalarchives" %% "tdr-metadata-validation" % "0.0.60", "uk.gov.nationalarchives" %% "s3-utils" % "0.1.221", From 94ed177f1d5b13b357738a9d9782b2cb5f375cf0 Mon Sep 17 00:00:00 2001 From: VimleshGupta Date: Wed, 13 Nov 2024 11:32:55 +0000 Subject: [PATCH 18/18] TDRD-591 - Set DraftMetadata status to InProgress while uploading draft metadata --- app/controllers/DraftMetadataUploadController.scala | 5 +++++ test/controllers/DraftMetadataUploadControllerSpec.scala | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/DraftMetadataUploadController.scala b/app/controllers/DraftMetadataUploadController.scala index 1a2e0dce1..0590fda50 100644 --- a/app/controllers/DraftMetadataUploadController.scala +++ b/app/controllers/DraftMetadataUploadController.scala @@ -5,11 +5,13 @@ import cats.effect.IO import cats.effect.IO.fromOption import cats.effect.unsafe.implicits.global import configuration.{ApplicationConfig, KeycloakConfiguration} +import graphql.codegen.types.ConsignmentStatusInput import org.pac4j.play.scala.SecurityComponents import play.api._ import play.api.i18n.I18nSupport import play.api.libs.Files.TemporaryFile import play.api.mvc._ +import services.Statuses.{DraftMetadataType, InProgressValue} import services._ import viewsapi.Caching.preventCaching @@ -26,6 +28,7 @@ class DraftMetadataUploadController @Inject() ( val consignmentService: ConsignmentService, val uploadService: UploadService, val draftMetadataService: DraftMetadataService, + val consignmentStatusService: ConsignmentStatusService, val applicationConfig: ApplicationConfig )(implicit val ec: ExecutionContext) extends TokenSecurity @@ -54,8 +57,10 @@ class DraftMetadataUploadController @Inject() ( val uploadFileName = applicationConfig.draftMetadataFileName val uploadKey = s"$consignmentId/$uploadFileName" val noDraftMetadataFileUploaded: String = "No meta data file provided" + val consignmentStatusInput = ConsignmentStatusInput(consignmentId, DraftMetadataType.id, Some(InProgressValue.value)) def uploadDraftMetadata: IO[Result] = for { + _ <- IO.fromFuture(IO(consignmentStatusService.updateConsignmentStatus(consignmentStatusInput, token.bearerAccessToken))) firstFilePart <- fromOption(request.body.files.headOption)(new RuntimeException(noDraftMetadataFileUploaded)) file <- fromOption(request.body.file(firstFilePart.key))(new RuntimeException(noDraftMetadataFileUploaded)) draftMetadata <- fromOption(Using(scala.io.Source.fromFile(file.ref.getAbsoluteFile))(_.mkString).toOption)(new RuntimeException(noDraftMetadataFileUploaded)) diff --git a/test/controllers/DraftMetadataUploadControllerSpec.scala b/test/controllers/DraftMetadataUploadControllerSpec.scala index 2c81ef6b9..1f4bdde14 100644 --- a/test/controllers/DraftMetadataUploadControllerSpec.scala +++ b/test/controllers/DraftMetadataUploadControllerSpec.scala @@ -15,7 +15,7 @@ import play.api.mvc.{MultipartFormData, Result} import play.api.test.CSRFTokenHelper._ import play.api.test.Helpers.{status => playStatus, _} import play.api.test.{FakeHeaders, FakeRequest} -import services.{ConsignmentService, DraftMetadataService, FileError, UploadService} +import services.{ConsignmentService, ConsignmentStatusService, DraftMetadataService, FileError, UploadService} import software.amazon.awssdk.services.s3.model.PutObjectResponse import testUtils.FrontEndTestHelper @@ -41,7 +41,7 @@ class DraftMetadataUploadControllerSpec extends FrontEndTestHelper { wiremockServer.stop() } - "DraftMetadataUploadControllerSpec GET" should { + "DraftMetadataUploadController GET" should { "render 'draft metadata upload' page when 'blockDraftMetadataUpload' set to 'false'" in { val controller = instantiateDraftMetadataUploadController(blockDraftMetadataUpload = false) @@ -101,12 +101,15 @@ class DraftMetadataUploadControllerSpec extends FrontEndTestHelper { .apply(FakeRequest(GET, "/draft-metadata/upload").withCSRFToken) playStatus(draftMetadataUploadPage) mustBe FORBIDDEN } + } + "DraftMetadataUploadController saveDraftMetadata" should { "redirect to draft metadata checks page when upload successful" in { val uploadServiceMock = mock[UploadService] when(configuration.get[String]("draftMetadata.fileName")).thenReturn(uploadFilename) val putObjectResponse = PutObjectResponse.builder().eTag("testEtag").build() when(uploadServiceMock.uploadDraftMetadata(anyString, anyString, anyString)).thenReturn(Future.successful(putObjectResponse)) + setUpdateConsignmentStatus(wiremockServer) val draftMetadataServiceMock = mock[DraftMetadataService] when(draftMetadataServiceMock.triggerDraftMetadataValidator(any[UUID], anyString, anyString)).thenReturn(Future.successful(true)) @@ -163,6 +166,7 @@ class DraftMetadataUploadControllerSpec extends FrontEndTestHelper { val applicationConfig: ApplicationConfig = new ApplicationConfig(configuration) val graphQLConfiguration = new GraphQLConfiguration(app.configuration) val consignmentService = new ConsignmentService(graphQLConfiguration) + val consignmentStatusService = new ConsignmentStatusService(graphQLConfiguration) new DraftMetadataUploadController( securityComponents, @@ -171,6 +175,7 @@ class DraftMetadataUploadControllerSpec extends FrontEndTestHelper { consignmentService, uploadService, draftMetadataService, + consignmentStatusService, applicationConfig ) }