diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5136ac79ae..1428dc179d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Scala uses: olafurpg/setup-scala@v10 with: - java-version: "adopt@1.8" + java-version: "adopt@11" - name: Build the docker-compose stack run: docker-compose up -d diff --git a/modules/admin/app/actors/cleanup/CleanupRunner.scala b/modules/admin/app/actors/cleanup/CleanupRunner.scala index 9abf24eb2d..360c944e61 100644 --- a/modules/admin/app/actors/cleanup/CleanupRunner.scala +++ b/modules/admin/app/actors/cleanup/CleanupRunner.scala @@ -1,7 +1,6 @@ package actors.cleanup import actors.Ticker -import actors.Ticker.Tick import akka.actor.{Actor, ActorLogging, ActorRef, Props} import play.api.Configuration import services.data.{DataService, EventForwarder} @@ -10,7 +9,7 @@ import services.ingest.{Cleanup, ImportLogService, IngestService} import java.time.LocalDateTime import java.util.concurrent.TimeUnit import scala.concurrent.ExecutionContext -import scala.concurrent.duration.{Duration, DurationInt, FiniteDuration} +import scala.concurrent.duration.{Duration, FiniteDuration} object CleanupRunner { diff --git a/modules/admin/app/client/json/package.scala b/modules/admin/app/client/json/package.scala index 83ebb4185e..ad189e6d23 100644 --- a/modules/admin/app/client/json/package.scala +++ b/modules/admin/app/client/json/package.scala @@ -1,10 +1,10 @@ package client import models.json._ -import models.{Entity, EntityType, _} +import models._ import play.api.Logger import play.api.libs.functional.syntax._ -import play.api.libs.json.{JsObject, KeyPathNode, _} +import play.api.libs.json._ import utils.EnumUtils package object json { @@ -68,7 +68,7 @@ package object json { } implicit object permissionGrantJson extends ClientWriteable[PermissionGrant] { - private implicit val permissionGrantFormat = Json.format[PermissionGrantF] + private implicit val permissionGrantFormat: OFormat[models.PermissionGrantF] = Json.format[PermissionGrantF] implicit val clientFormat: Format[PermissionGrant] = ( JsPath.format(permissionGrantFormat) and (__ \ "accessor").lazyFormatNullable[Accessor](accessorJson.clientFormat) and @@ -84,7 +84,7 @@ package object json { } implicit object linkJson extends ClientWriteable[Link] { - private implicit val linkFormat = Json.format[LinkF] + private implicit val linkFormat: OFormat[models.LinkF] = Json.format[LinkF] val clientFormat: Format[Link] = ( JsPath.format[LinkF](linkFormat) and (__ \ "targets").formatSeqOrEmpty(anyModelJson.clientFormat) and @@ -111,7 +111,7 @@ package object json { } implicit object versionJson extends ClientWriteable[Version] { - private implicit val fFormat = Json.format[VersionF] + private implicit val fFormat: OFormat[models.VersionF] = Json.format[VersionF] implicit val clientFormat: Format[Version] = ( JsPath.format[VersionF](fFormat) and (__ \ "event").lazyFormatNullable(systemEventJson.clientFormat) and @@ -130,7 +130,7 @@ package object json { } implicit object systemEventJson extends ClientWriteable[SystemEvent] { - private implicit val fFormat = Json.format[SystemEventF] + private implicit val fFormat: OFormat[models.SystemEventF] = Json.format[SystemEventF] implicit val clientFormat: Format[SystemEvent] = ( JsPath.format[SystemEventF](fFormat) and @@ -182,42 +182,42 @@ package object json { } implicit object documentaryUnitDescriptionJson extends ClientWriteable[DocumentaryUnitDescriptionF] { - private implicit val accessPointFormat = accessPointJson.clientFormat - private implicit val datePeriodFormat = datePeriodJson.clientFormat - private implicit val isadGIdentityFormat = Json.format[IsadGIdentity] - private implicit val isadGContextFormat = Json.format[IsadGContext] - private implicit val isadGContentFormat = Json.format[IsadGContent] - private implicit val isadGConditionsFormat = Json.format[IsadGConditions] - private implicit val isadGMaterialsFormat = Json.format[IsadGMaterials] - private implicit val isadGControlFormat = Json.format[IsadGControl] + private implicit val accessPointFormat: Format[models.AccessPoint] = accessPointJson.clientFormat + private implicit val datePeriodFormat: Format[models.DatePeriodF] = datePeriodJson.clientFormat + private implicit val isadGIdentityFormat: OFormat[models.IsadGIdentity] = Json.format[IsadGIdentity] + private implicit val isadGContextFormat: OFormat[models.IsadGContext] = Json.format[IsadGContext] + private implicit val isadGContentFormat: OFormat[models.IsadGContent] = Json.format[IsadGContent] + private implicit val isadGConditionsFormat: OFormat[models.IsadGConditions] = Json.format[IsadGConditions] + private implicit val isadGMaterialsFormat: OFormat[models.IsadGMaterials] = Json.format[IsadGMaterials] + private implicit val isadGControlFormat: OFormat[models.IsadGControl] = Json.format[IsadGControl] val clientFormat: Format[DocumentaryUnitDescriptionF] = Json.format[DocumentaryUnitDescriptionF] } implicit object historicalAgentDescriptionJson extends ClientWriteable[HistoricalAgentDescriptionF] { - private implicit val accessPointFormat = accessPointJson.clientFormat - private implicit val datePeriodFormat = datePeriodJson.clientFormat - private implicit val isaarDetailsFormat = Json.format[IsaarDetail] - private implicit val isaarControlFormat = Json.format[IsaarControl] + private implicit val accessPointFormat: Format[models.AccessPoint] = accessPointJson.clientFormat + private implicit val datePeriodFormat: Format[models.DatePeriodF] = datePeriodJson.clientFormat + private implicit val isaarDetailsFormat: OFormat[models.IsaarDetail] = Json.format[IsaarDetail] + private implicit val isaarControlFormat: OFormat[models.IsaarControl] = Json.format[IsaarControl] val clientFormat: Format[HistoricalAgentDescriptionF] = Json.format[HistoricalAgentDescriptionF] } implicit object repositoryDescriptionJson extends ClientWriteable[RepositoryDescriptionF] { - private implicit val addressFormat = addressJson.clientFormat - private implicit val accessPointFormat = accessPointJson.clientFormat - private implicit val isdiahDetailsFormat = Json.format[IsdiahDetails] - private implicit val isdiahAccessFormat = Json.format[IsdiahAccess] - private implicit val isdiahServicesFormat = Json.format[IsdiahServices] - private implicit val isdiahControlFormat = Json.format[IsdiahControl] + private implicit val addressFormat: Writes[models.AddressF] = addressJson.clientFormat + private implicit val accessPointFormat: Format[models.AccessPoint] = accessPointJson.clientFormat + private implicit val isdiahDetailsFormat: OFormat[models.IsdiahDetails] = Json.format[IsdiahDetails] + private implicit val isdiahAccessFormat: OFormat[models.IsdiahAccess] = Json.format[IsdiahAccess] + private implicit val isdiahServicesFormat: OFormat[models.IsdiahServices] = Json.format[IsdiahServices] + private implicit val isdiahControlFormat: OFormat[models.IsdiahControl] = Json.format[IsdiahControl] val clientFormat: Format[RepositoryDescriptionF] = Json.format[RepositoryDescriptionF] } implicit object conceptDescriptionJson extends ClientWriteable[ConceptDescriptionF] { - private implicit val accessPointFormat = accessPointJson.clientFormat + private implicit val accessPointFormat: Format[models.AccessPoint] = accessPointJson.clientFormat lazy val clientFormat: Format[ConceptDescriptionF] = Json.format[ConceptDescriptionF] } implicit object historicalAgentJson extends ClientWriteable[HistoricalAgent] { - private implicit val haDescFmt = historicalAgentDescriptionJson.clientFormat + private implicit val haDescFmt: Format[models.HistoricalAgentDescriptionF] = historicalAgentDescriptionJson.clientFormat private val fFormat = Json.format[HistoricalAgentF] val clientFormat: Format[HistoricalAgent] = ( @@ -230,7 +230,7 @@ package object json { } implicit object repositoryJson extends ClientWriteable[Repository] { - private implicit val repoDescFmt = repositoryDescriptionJson.clientFormat + private implicit val repoDescFmt: Format[models.RepositoryDescriptionF] = repositoryDescriptionJson.clientFormat private val fFormat = Json.format[RepositoryF] val clientFormat: Format[Repository] = ( @@ -243,7 +243,7 @@ package object json { } implicit object documentaryUnitJson extends ClientWriteable[DocumentaryUnit] { - private implicit val docDescFmt = documentaryUnitDescriptionJson.clientFormat + private implicit val docDescFmt: Format[models.DocumentaryUnitDescriptionF] = documentaryUnitDescriptionJson.clientFormat private val fFormat = Json.format[DocumentaryUnitF] lazy val clientFormat: Format[DocumentaryUnit] = ( JsPath.format(fFormat) and @@ -256,7 +256,7 @@ package object json { } implicit object virtualUnitJson extends ClientWriteable[VirtualUnit] { - private implicit val vuDescFmt = documentaryUnitDescriptionJson.clientFormat + private implicit val vuDescFmt: Format[models.DocumentaryUnitDescriptionF] = documentaryUnitDescriptionJson.clientFormat private val fFormat = Json.format[VirtualUnitF] lazy val clientFormat: Format[VirtualUnit] = ( @@ -297,7 +297,7 @@ package object json { implicit object conceptJson extends ClientWriteable[Concept] { - private implicit val fdFormat = conceptDescriptionJson.clientFormat + private implicit val fdFormat: Format[models.ConceptDescriptionF] = conceptDescriptionJson.clientFormat implicit val fFormat: Format[ConceptF] = Json.format[ConceptF] val clientFormat: Format[Concept] = ( JsPath.format[ConceptF](fFormat) and diff --git a/modules/admin/app/controllers/users/UserProfiles.scala b/modules/admin/app/controllers/users/UserProfiles.scala index b90aba6de2..999bdb8678 100644 --- a/modules/admin/app/controllers/users/UserProfiles.scala +++ b/modules/admin/app/controllers/users/UserProfiles.scala @@ -211,7 +211,7 @@ case class UserProfiles @Inject()( Ok(views.html.admin.userProfile.list(request.page, request.params)) } - def export: Action[AnyContent] = AdminAction.async { implicit request => + def `export`: Action[AnyContent] = AdminAction.async { implicit request => for { accounts <- accounts.findAll(PageParams.empty.withoutLimit) users <- userDataApi.list[UserProfile](PageParams.empty.withoutLimit) diff --git a/modules/admin/app/models/OaiPmhIdentity.scala b/modules/admin/app/models/OaiPmhIdentity.scala index 3de2f5326e..00775f2ceb 100644 --- a/modules/admin/app/models/OaiPmhIdentity.scala +++ b/modules/admin/app/models/OaiPmhIdentity.scala @@ -15,7 +15,7 @@ object OaiPmhIdentity { val Day = Value("YYYY-MM-DD") val Second = Value("YYYY-MM-DDThh:mm:ssZ") - implicit val _format = EnumUtils.enumFormat(Granularity) + implicit val _format: Format[models.OaiPmhIdentity.Granularity.Value] = EnumUtils.enumFormat(Granularity) } implicit val _format: Format[OaiPmhIdentity] = Json.format[OaiPmhIdentity] diff --git a/modules/admin/app/models/UrlSetConfig.scala b/modules/admin/app/models/UrlSetConfig.scala index d65a3351ce..866100aacc 100644 --- a/modules/admin/app/models/UrlSetConfig.scala +++ b/modules/admin/app/models/UrlSetConfig.scala @@ -1,6 +1,5 @@ package models -import play.api.libs.json.Reads case class UrlNameMap(url: String, name: String) diff --git a/modules/admin/app/services/datasets/SqlImportDatasetService.scala b/modules/admin/app/services/datasets/SqlImportDatasetService.scala index f2a80aae4a..828f5038a4 100644 --- a/modules/admin/app/services/datasets/SqlImportDatasetService.scala +++ b/modules/admin/app/services/datasets/SqlImportDatasetService.scala @@ -95,15 +95,15 @@ case class SqlImportDatasetService @Inject()(db: Database, actorSystem: ActorSys db.withTransaction { implicit conn => val inserts = info.map { item => Seq[NamedParameter]( - 'repo_id -> repoId, - 'id -> item.id, - 'name -> item.name, - 'type -> item.src, - 'content_type -> item.contentType, - 'item_id -> item.fonds.filter(_.trim.nonEmpty), - 'sync -> item.sync, - 'status -> item.status, - 'comments -> item.notes + Symbol("repo_id") -> repoId, + Symbol("id") -> item.id, + Symbol("name") -> item.name, + Symbol("type") -> item.src, + Symbol("content_type") -> item.contentType, + Symbol("item_id") -> item.fonds.filter(_.trim.nonEmpty), + Symbol("sync") -> item.sync, + Symbol("status") -> item.status, + Symbol("comments") -> item.notes ) } val q = """INSERT INTO import_dataset (repo_id, id, name, type, content_type, item_id, sync, status, comments) diff --git a/modules/backend/src/main/scala/utils/EnumUtils.scala b/modules/backend/src/main/scala/utils/EnumUtils.scala index d78341897b..0e4ca6ade5 100644 --- a/modules/backend/src/main/scala/utils/EnumUtils.scala +++ b/modules/backend/src/main/scala/utils/EnumUtils.scala @@ -24,7 +24,7 @@ object EnumUtils { def enumWrites[E <: Enumeration]: Writes[E#Value] = Writes[E#Value](v => JsString(v.toString)) - def enumFormat[E <: Enumeration](enum: E): Format[E#Value] = Format(enumReads(enum), enumWrites) + def enumFormat[E <: Enumeration](`enum`: E): Format[E#Value] = Format(enumReads(enum), enumWrites) /** * Constructs a simple mapping for a text field (mapped as `scala.Enumeration`) @@ -36,7 +36,7 @@ object EnumUtils { * * @param enum the Enumeration#Value */ - def enumMapping[E <: Enumeration](enum: E): Mapping[E#Value] = Forms.of(enumFormBinder(enum)) + def enumMapping[E <: Enumeration](`enum`: E): Mapping[E#Value] = Forms.of(enumFormBinder(enum)) /** * Default formatter for `scala.Enumeration` diff --git a/modules/backend/src/main/scala/utils/binders/package.scala b/modules/backend/src/main/scala/utils/binders/package.scala index b2c755e2f5..7eb59b3c1b 100644 --- a/modules/backend/src/main/scala/utils/binders/package.scala +++ b/modules/backend/src/main/scala/utils/binders/package.scala @@ -17,7 +17,7 @@ import scala.annotation.tailrec */ package object binders { - def bindableEnum[E <: Enumeration](enum: E): PathBindable[E#Value] = new PathBindable[E#Value] { + def bindableEnum[E <: Enumeration](`enum`: E): PathBindable[E#Value] = new PathBindable[E#Value] { def bind(key: String, value: String): Either[String, enum.Value] = enum.values.find(_.toString.toLowerCase == value.toLowerCase) match { case Some(v) => Right(v) @@ -27,7 +27,7 @@ package object binders { def unbind(key: String, value: E#Value): String = value.toString.toLowerCase } - def queryStringBinder[E <: Enumeration](enum: E)(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[E#Value] = + def queryStringBinder[E <: Enumeration](`enum`: E)(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[E#Value] = new QueryStringBindable[E#Value] { override def bind(key: String, params: Map[String, Seq[String]]): Option[Either[String, E#Value]] = for (v <- stringBinder.bind(key, params)) yield v match { diff --git a/modules/backend/src/test/scala/services/data/streams/ByteStringResizerSpec.scala b/modules/backend/src/test/scala/services/data/streams/ByteStringResizerSpec.scala index d5abc28b3f..41ac02ff73 100644 --- a/modules/backend/src/test/scala/services/data/streams/ByteStringResizerSpec.scala +++ b/modules/backend/src/test/scala/services/data/streams/ByteStringResizerSpec.scala @@ -11,8 +11,8 @@ import scala.concurrent.duration._ class ByteStringResizerSpec extends PlaySpecification { - private implicit val as = ActorSystem.create("testing") - private implicit val mat = Materializer(as) + private implicit val as: akka.actor.ActorSystem = ActorSystem.create("testing") + private implicit val mat: akka.stream.Materializer = Materializer(as) def count(size: Int, bytes: ByteString*): Int = Await.result( Source.apply(bytes.toList) diff --git a/modules/core/src/main/scala/models/Annotation.scala b/modules/core/src/main/scala/models/Annotation.scala index 3a7944bdd1..4e2b8c5a91 100644 --- a/modules/core/src/main/scala/models/Annotation.scala +++ b/modules/core/src/main/scala/models/Annotation.scala @@ -62,10 +62,10 @@ object Annotation { import Ontology._ import EnumUtils.enumMapping - private implicit val anyModelReads = Model.Converter.restReads - private implicit val userProfileMetaReads = UserProfile.UserProfileResource.restReads - private lazy implicit val systemEventReads = SystemEvent.SystemEventResource.restReads - private implicit val accessorReads = Accessor.Converter.restReads + private implicit val anyModelReads: Reads[models.Model] = Model.Converter.restReads + private implicit val userProfileMetaReads: Reads[models.UserProfile] = UserProfile.UserProfileResource.restReads + private lazy implicit val systemEventReads: Reads[models.SystemEvent] = SystemEvent.SystemEventResource.restReads + private implicit val accessorReads: Reads[models.Accessor] = Accessor.Converter.restReads implicit val metaReads: Reads[Annotation] = ( __.read[AnnotationF] and diff --git a/modules/core/src/main/scala/models/AuthoritativeSet.scala b/modules/core/src/main/scala/models/AuthoritativeSet.scala index 56b1d3f5f2..69ca0246da 100644 --- a/modules/core/src/main/scala/models/AuthoritativeSet.scala +++ b/modules/core/src/main/scala/models/AuthoritativeSet.scala @@ -47,8 +47,8 @@ object AuthoritativeSet { import Entity._ import eu.ehri.project.definitions.Ontology._ - private implicit val systemEventReads = SystemEvent.SystemEventResource.restReads - private implicit val accessorReads = Accessor.Converter.restReads + private implicit val systemEventReads: Reads[models.SystemEvent] = SystemEvent.SystemEventResource.restReads + private implicit val accessorReads: Reads[models.Accessor] = Accessor.Converter.restReads implicit val metaReads: Reads[AuthoritativeSet] = ( __.read[AuthoritativeSetF] and diff --git a/modules/core/src/main/scala/models/Concept.scala b/modules/core/src/main/scala/models/Concept.scala index a84557546e..0b95c6d37b 100644 --- a/modules/core/src/main/scala/models/Concept.scala +++ b/modules/core/src/main/scala/models/Concept.scala @@ -76,8 +76,8 @@ object Concept { import Entity._ import ConceptF._ - private implicit val systemEventReads = SystemEvent.SystemEventResource.restReads - private implicit val vocabularyReads = Vocabulary.VocabularyResource.restReads + private implicit val systemEventReads: Reads[models.SystemEvent] = SystemEvent.SystemEventResource.restReads + private implicit val vocabularyReads: Reads[models.Vocabulary] = Vocabulary.VocabularyResource.restReads implicit val metaReads: Reads[Concept] = ( __.read[ConceptF] and diff --git a/modules/core/src/main/scala/models/HistoricalAgent.scala b/modules/core/src/main/scala/models/HistoricalAgent.scala index 76db2ca950..4fbffd3d2a 100644 --- a/modules/core/src/main/scala/models/HistoricalAgent.scala +++ b/modules/core/src/main/scala/models/HistoricalAgent.scala @@ -59,8 +59,8 @@ object HistoricalAgent { import Ontology._ import utils.EnumUtils.enumMapping - private implicit val systemEventReads = SystemEvent.SystemEventResource.restReads - private implicit val authoritativeSetReads = AuthoritativeSet.AuthoritativeSetResource.restReads + private implicit val systemEventReads: Reads[models.SystemEvent] = SystemEvent.SystemEventResource.restReads + private implicit val authoritativeSetReads: Reads[models.AuthoritativeSet] = AuthoritativeSet.AuthoritativeSetResource.restReads implicit val metaReads: Reads[HistoricalAgent] = ( __.read[HistoricalAgentF] and diff --git a/modules/core/src/main/scala/models/Link.scala b/modules/core/src/main/scala/models/Link.scala index bb84697e88..d9454c5e12 100644 --- a/modules/core/src/main/scala/models/Link.scala +++ b/modules/core/src/main/scala/models/Link.scala @@ -84,9 +84,9 @@ object Link { import play.api.libs.functional.syntax._ import EnumUtils.enumMapping - private implicit val userProfileMetaReads = models.UserProfile.UserProfileResource.restReads - private implicit val accessPointReads = models.AccessPoint.Converter.restReads - private implicit val systemEventReads = SystemEvent.SystemEventResource.restReads + private implicit val userProfileMetaReads: Reads[models.UserProfile] = models.UserProfile.UserProfileResource.restReads + private implicit val accessPointReads: Reads[models.AccessPoint] = models.AccessPoint.Converter.restReads + private implicit val systemEventReads: Reads[models.SystemEvent] = SystemEvent.SystemEventResource.restReads implicit val metaReads: Reads[Link] = ( __.read[LinkF] and diff --git a/modules/core/src/main/scala/models/UserProfile.scala b/modules/core/src/main/scala/models/UserProfile.scala index 21aba8c947..e85af11977 100644 --- a/modules/core/src/main/scala/models/UserProfile.scala +++ b/modules/core/src/main/scala/models/UserProfile.scala @@ -86,8 +86,8 @@ object UserProfile { import Ontology._ import UserProfileF._ - private implicit val groupReads = Group.GroupResource.restReads - private implicit val systemEventReads = SystemEvent.SystemEventResource.restReads + private implicit val groupReads: Reads[models.Group] = Group.GroupResource.restReads + private implicit val systemEventReads: Reads[models.SystemEvent] = SystemEvent.SystemEventResource.restReads implicit val metaReads: Reads[UserProfile] = ( __.read[UserProfileF] and diff --git a/modules/core/src/main/scala/models/Vocabulary.scala b/modules/core/src/main/scala/models/Vocabulary.scala index 1afcee1375..203cc58a1d 100644 --- a/modules/core/src/main/scala/models/Vocabulary.scala +++ b/modules/core/src/main/scala/models/Vocabulary.scala @@ -50,7 +50,7 @@ object Vocabulary { import Ontology._ import VocabularyF._ - private implicit val systemEventReads = SystemEvent.SystemEventResource.restReads + private implicit val systemEventReads: Reads[models.SystemEvent] = SystemEvent.SystemEventResource.restReads implicit val metaReads: Reads[Vocabulary] = ( __.read[VocabularyF] and diff --git a/modules/guides/app/models/Guide.scala b/modules/guides/app/models/Guide.scala index 440b510b03..5166c88fa9 100644 --- a/modules/guides/app/models/Guide.scala +++ b/modules/guides/app/models/Guide.scala @@ -38,7 +38,7 @@ object Guide { val DEFAULT_PAGE = "default_page" val CSS = "css" - implicit val form = Form( + implicit val form: Form[models.Guide] = Form( mapping( OBJECTID -> ignored(Option.empty[Long]), NAME -> nonEmptyText, diff --git a/modules/guides/app/models/GuidePage.scala b/modules/guides/app/models/GuidePage.scala index b308b24b52..08532658c5 100644 --- a/modules/guides/app/models/GuidePage.scala +++ b/modules/guides/app/models/GuidePage.scala @@ -58,7 +58,7 @@ object GuidePage { val Nowhere = Value("nowhere") } - implicit val form = Form( + implicit val form: Form[models.GuidePage] = Form( mapping( OBJECTID -> ignored(Option.empty[Long]), LAYOUT -> enumMapping(Layout), diff --git a/modules/portal/app/models/CypherQuery.scala b/modules/portal/app/models/CypherQuery.scala index 3b509ecc75..41e52019e3 100644 --- a/modules/portal/app/models/CypherQuery.scala +++ b/modules/portal/app/models/CypherQuery.scala @@ -46,7 +46,7 @@ object CypherQuery { } } - implicit val form = Form( + implicit val form: Form[models.CypherQuery] = Form( mapping( "objectId" -> ignored(Option.empty[String]), ID -> optional(text), diff --git a/modules/portal/app/models/Feedback.scala b/modules/portal/app/models/Feedback.scala index afeb0d12bb..f22d85422c 100644 --- a/modules/portal/app/models/Feedback.scala +++ b/modules/portal/app/models/Feedback.scala @@ -36,7 +36,7 @@ object Feedback { val Data = Value("data") } - implicit val form = Form( + implicit val form: Form[models.Feedback] = Form( mapping( "objectId" -> ignored(Option.empty[String]), ID -> optional(text), diff --git a/modules/portal/app/services/feedback/SqlFeedbackService.scala b/modules/portal/app/services/feedback/SqlFeedbackService.scala index 2873263b51..ee08b71f87 100644 --- a/modules/portal/app/services/feedback/SqlFeedbackService.scala +++ b/modules/portal/app/services/feedback/SqlFeedbackService.scala @@ -36,7 +36,7 @@ case class SqlFeedbackService @Inject ()(db: Database, actorSystem: ActorSystem) } } - private implicit def modeEnumToStatement = new ToStatement[Option[play.api.Mode]] { + private implicit def modeEnumToStatement: ToStatement[Option[play.api.Mode]] = new ToStatement[Option[play.api.Mode]] { def set(s: java.sql.PreparedStatement, index: Int, value: Option[play.api.Mode]): Unit = s.setObject(index, value.map(_.toString).orNull) } @@ -52,7 +52,7 @@ case class SqlFeedbackService @Inject ()(db: Database, actorSystem: ActorSystem) } } - private implicit def typeEnumToStatement = new ToStatement[Option[Feedback.Type.Value]] { + private implicit def typeEnumToStatement: ToStatement[Option[models.Feedback.Type.Value]] = new ToStatement[Option[Feedback.Type.Value]] { def set(s: java.sql.PreparedStatement, index: Int, value: Option[Feedback.Type.Value]): Unit = s.setObject(index, value.map(_.toString).orNull) } @@ -74,7 +74,7 @@ case class SqlFeedbackService @Inject ()(db: Database, actorSystem: ActorSystem) } } - private implicit def contextToStatement = new ToStatement[Option[FeedbackContext]] { + private implicit def contextToStatement: ToStatement[Option[models.FeedbackContext]] = new ToStatement[Option[FeedbackContext]] { def set(s: java.sql.PreparedStatement, index: Int, value: Option[FeedbackContext]): Unit = s.setObject(index, value.map(v => Json.stringify(Json.toJson(v))).orNull) } diff --git a/modules/portal/app/services/redirects/SqlMovedPageLookup.scala b/modules/portal/app/services/redirects/SqlMovedPageLookup.scala index d40af7ca2e..026969b9ad 100644 --- a/modules/portal/app/services/redirects/SqlMovedPageLookup.scala +++ b/modules/portal/app/services/redirects/SqlMovedPageLookup.scala @@ -36,9 +36,9 @@ case class SqlMovedPageLookup @Inject ()(db: Database)(implicit actorSystem: Act db.withConnection { implicit conn => val inserts = moved.map { case (from, to) => Seq[NamedParameter]( - 'hash -> DigestUtils.sha1Hex(from), - 'original -> from, - 'path -> to + Symbol("hash") -> DigestUtils.sha1Hex(from), + Symbol("original") -> from, + Symbol("path") -> to ) } val q = """INSERT INTO moved_pages(original_path_sha1, original_path, new_path) diff --git a/modules/portal/app/views/Helpers.scala b/modules/portal/app/views/Helpers.scala index 6befbd86c6..4baef21a65 100644 --- a/modules/portal/app/views/Helpers.scala +++ b/modules/portal/app/views/Helpers.scala @@ -59,8 +59,8 @@ object Helpers { def argsWithConfig(fieldName: String, args: Seq[(Symbol,Any)])(implicit config: Option[forms.FormConfig], messages: Messages): Seq[(Symbol,Any)] = { (args - ++ config.flatMap(_.hint(fieldName)).map('_hint -> _).toSeq - ++ config.flatMap(_.required(fieldName)).map(_ => '_help -> Messages("constraint.required"))) + ++ config.flatMap(_.hint(fieldName)).map(Symbol("_hint") -> _).toSeq + ++ config.flatMap(_.required(fieldName)).map(_ => Symbol("_help") -> Messages("constraint.required"))) } /* diff --git a/test/actors/cleanup/CleanupRunnerManagerSpec.scala b/test/actors/cleanup/CleanupRunnerManagerSpec.scala index 45f1c9be87..f879d01148 100644 --- a/test/actors/cleanup/CleanupRunnerManagerSpec.scala +++ b/test/actors/cleanup/CleanupRunnerManagerSpec.scala @@ -4,7 +4,7 @@ import actors.LongRunningJob import actors.cleanup.CleanupRunner.CleanupJob import akka.actor.{ActorContext, ActorRef, Props} import com.google.inject.name.Names -import controllers.datasets.{CleanupConfirmation, LongRunningJobs} +import controllers.datasets.CleanupConfirmation import helpers.IntegrationTestRunner import mockdata.adminUserProfile import models._ diff --git a/test/integration/admin/IndexingSpec.scala b/test/integration/admin/IndexingSpec.scala index 01ce19c2f4..de2dfa979c 100644 --- a/test/integration/admin/IndexingSpec.scala +++ b/test/integration/admin/IndexingSpec.scala @@ -25,8 +25,7 @@ class IndexingSpec extends SearchTestRunner { TextMessage.Strict(Json.prettyPrint(Json.toJson(obj))) "Indexing views" should { - val port = 9902 - "index items correctly" in new ITestServer(app = appBuilder.build(), port = port) { + "index items correctly" in new ITestServer(app = appBuilder.build()) { val mediator = app.injector.instanceOf[SearchIndexMediator] val engine = app.injector.instanceOf[SearchEngine] @@ -39,7 +38,7 @@ class IndexingSpec extends SearchTestRunner { // Now initiate a full re-index request... val headers = collection.immutable.Seq(RawHeader(AUTH_TEST_HEADER_NAME, testAuthToken(privilegedUser.id))) - val wsUrl = s"ws://127.0.0.1:$port${controllers.admin.routes.Indexing.indexer()}" + val wsUrl = s"ws://127.0.0.1:${this.port}${controllers.admin.routes.Indexing.indexer()}" val src = Source.single(jsonMessage(IndexTypes(IndexTypes.all))) // NB: using the technique mentioned for "half-closed" websockets here to get output diff --git a/test/integration/admin/IngestSpec.scala b/test/integration/admin/IngestSpec.scala index d146cbe577..c5b23f1476 100644 --- a/test/integration/admin/IngestSpec.scala +++ b/test/integration/admin/IngestSpec.scala @@ -35,8 +35,7 @@ class IngestSpec extends IntegrationTestRunner with FakeMultipartUpload { "Ingest views" should { - val port = 9902 - "perform ead-sync and monitor progress correctly" in new ITestServer(app = appBuilder.configure(getConfig).build(), port = port) { + "perform ead-sync and monitor progress correctly" in new ITestServer(app = appBuilder.configure(getConfig).build()) { val damStorage = app.injector.instanceOf(BindingKey(classOf[FileStorage], Some(QualifierInstance(Names.named("dam"))))) val result = FakeRequest(controllers.admin.routes.Ingest @@ -58,7 +57,7 @@ class IngestSpec extends IntegrationTestRunner with FakeMultipartUpload { val relativeUrl = loc.get val jobId = relativeUrl.split("=")(1) - val wsUrl = s"ws://127.0.0.1:$port${controllers.admin.routes.Tasks.taskMonitorWS(jobId)}" + val wsUrl = s"ws://127.0.0.1:${this.port}${controllers.admin.routes.Tasks.taskMonitorWS(jobId)}" val headers = collection.immutable.Seq(RawHeader(AUTH_TEST_HEADER_NAME, testAuthToken(privilegedUser.id))) val outFlow: Flow[Message, Message, (Future[Seq[Message]], Promise[Option[Message]])] = diff --git a/test/integration/admin/SearchSpec.scala b/test/integration/admin/SearchSpec.scala index 530b216a44..2aa23dbd92 100644 --- a/test/integration/admin/SearchSpec.scala +++ b/test/integration/admin/SearchSpec.scala @@ -47,13 +47,12 @@ class SearchSpec extends IntegrationTestRunner { } "Search index mediator" should { - val port = 9902 "perform indexing correctly via Websocket endpoint" in new ITestServer( - app = appBuilder.configure(getConfig).build(), port = port) { + app = appBuilder.configure(getConfig).build()) { val cmd = List(EntityType.DocumentaryUnit) val data = IndexTypes(cmd) - val wsUrl = s"ws://127.0.0.1:$port${controllers.admin.routes.Indexing.indexer().url}" + val wsUrl = s"ws://127.0.0.1:${this.port}${controllers.admin.routes.Indexing.indexer().url}" val headers = collection.immutable.Seq(RawHeader(AUTH_TEST_HEADER_NAME, testAuthToken(privilegedUser.id))) // Ensure the buffer of index events is empty. diff --git a/test/integration/portal/AccountsSpec.scala b/test/integration/portal/AccountsSpec.scala index 8903bda48b..cecb1f3d95 100644 --- a/test/integration/portal/AccountsSpec.scala +++ b/test/integration/portal/AccountsSpec.scala @@ -8,6 +8,7 @@ import forms.TimeCheckForm._ import helpers.IntegrationTestRunner import mockdata.unprivilegedUser import models.SignupData +import play.api.Application import play.api.cache.SyncCacheApi import play.api.i18n.MessagesApi import play.api.test.{FakeRequest, Injecting, WithApplication} @@ -21,7 +22,7 @@ class AccountsSpec extends IntegrationTestRunner { private val accountRoutes = controllers.portal.account.routes.Accounts - private implicit def cache(implicit app: play.api.Application) = app.injector.instanceOf[SyncCacheApi] + private implicit def cache(implicit app: Application): SyncCacheApi = app.injector.instanceOf[SyncCacheApi] "Account views" should { "redirect to index page on log out" in new ITestApp { @@ -125,7 +126,7 @@ class AccountsSpec extends IntegrationTestRunner { } "error with bad session state" in new WithApplication with Injecting { - private implicit val messagesApi = inject[MessagesApi] + private implicit val messagesApi: play.api.i18n.MessagesApi = inject[MessagesApi] val singleUseKey = "useOnce" cache.set(singleUseKey, "jdjjjr") val login = FakeRequest( diff --git a/test/integration/portal/AnnotationsSpec.scala b/test/integration/portal/AnnotationsSpec.scala index 1a0a85018a..44937c40bb 100644 --- a/test/integration/portal/AnnotationsSpec.scala +++ b/test/integration/portal/AnnotationsSpec.scala @@ -121,8 +121,8 @@ class AnnotationsSpec extends IntegrationTestRunner { contentAsString(doc) must not contain testBody // Get a id via faff method and promote the item... - implicit val apiUser = DataUser(Some(privilegedUser.id)) - val aid = await(dataApi.annotations[Annotation]("c4")).headOption must beSome.which { aid => + implicit val apiUser: DataUser = DataUser(Some(privilegedUser.id)) + await(dataApi.annotations[Annotation]("c4")).headOption must beSome.which { aid => await(dataApi.promote[Annotation](aid.id)) // Ensure the unprivileged user CAN now see the annotation... diff --git a/test/services/MailerSpec.scala b/test/services/MailerSpec.scala index 1a885971f3..c218241d51 100644 --- a/test/services/MailerSpec.scala +++ b/test/services/MailerSpec.scala @@ -16,7 +16,7 @@ class MailerSpec extends PlaySpecification { "SMTP mailer" should { "send mails" in new WithApplication(app) { - val mailer = app.injector.instanceOf[MailerClient] + val mailer = this.app.injector.instanceOf[MailerClient] val email = Email( "Test Email", "Test FROM ",