Skip to content

Commit cc54b9b

Browse files
committed
Bumping Play from 2.7.9 to 2.8.18
* No longer relying on Anorm's deprecated namedWithSymbol implicit conversions * Fix some typecase warnings
1 parent e6ec40e commit cc54b9b

File tree

7 files changed

+27
-23
lines changed

7 files changed

+27
-23
lines changed

app/controllers/ApiController.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ class ApiController @Inject()(authActionFactory: AuthActionFactory,
433433
}
434434
private def lookupUserInfo(request: Request[AnyContent]) = {
435435
val userInfo: Option[String] = request match {
436-
case _: UserRequest[A] => Option(request.asInstanceOf[UserRequest[A]].username)
436+
case _: UserRequest[_] => Option(request.asInstanceOf[UserRequest[_]].username)
437437
case _ => None
438438
}
439439
userInfo

app/models/Id.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class IdObject[T <: Id](fromString: String => T) {
3333

3434
def apply(str: String): T = fromString(str)
3535

36-
implicit val jsonWrites: Writes[T] = Id.jsonWrites
36+
implicit val jsonWrites: Writes[T] = Id.jsonWrites.asInstanceOf[Writes[T]]
3737
implicit val jsonReads: Reads[T] = Reads[T](_.validate[String].map(apply))
3838

3939
def apply(): T = apply(UUID.randomUUID().toString)

app/models/SearchManagementRepository.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ class SearchManagementRepository @Inject()(dbapi: DBApi, toggleService: FeatureT
234234
def addNewDeploymentLogOk(solrIndexId: String, targetPlatform: String): Boolean = db.withConnection { implicit connection =>
235235
SQL("insert into deployment_log(id, solr_index_id, target_platform, last_update, result) values ({id}, {solr_index_id}, {target_platform}, {last_update}, {result})")
236236
.on(
237-
'id -> UUID.randomUUID().toString,
238-
'solr_index_id -> solrIndexId,
239-
'target_platform -> targetPlatform,
240-
'last_update -> new Date(),
241-
'result -> 0
237+
"id" -> UUID.randomUUID().toString,
238+
"solr_index_id" -> solrIndexId,
239+
"target_platform" -> targetPlatform,
240+
"last_update" -> new Date(),
241+
"result" -> 0
242242
)
243243
.execute()
244244
}

app/models/eventhistory/InputEvent.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ object InputEvent extends Logging {
271271
s"order by $EVENT_TIME asc"
272272
)
273273
.on(
274-
'dateFrom -> dateFrom,
275-
'dateTo -> dateTo
274+
"dateFrom" -> dateFrom,
275+
"dateTo" -> dateTo
276276
)
277277
.as(sqlParser.*)
278278

@@ -304,8 +304,8 @@ object InputEvent extends Logging {
304304
s"limit 1"
305305
)
306306
.on(
307-
'inputId -> inputEvent.inputId,
308-
'dateFrom -> inputEvent.eventTime,
307+
"inputId" -> inputEvent.inputId,
308+
"dateFrom" -> inputEvent.eventTime,
309309
)
310310
.as(sqlParser.*)
311311

@@ -340,9 +340,9 @@ object InputEvent extends Logging {
340340
s"order by $EVENT_TIME asc"
341341
)
342342
.on(
343-
'inputId -> inputId,
344-
'dateFrom -> dateFrom,
345-
'dateTo -> dateTo
343+
"inputId" -> inputId,
344+
"dateFrom" -> dateFrom,
345+
"dateTo" -> dateTo
346346
)
347347
.as(sqlParser.*)
348348

@@ -359,8 +359,8 @@ object InputEvent extends Logging {
359359
s"limit 1"
360360
)
361361
.on(
362-
'inputId -> inputId,
363-
'dateFrom -> dateFrom,
362+
"inputId" -> inputId,
363+
"dateFrom" -> dateFrom,
364364
)
365365
.as(sqlParser.*)
366366

build.sbt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import com.typesafe.sbt.GitBranchPrompt
22

33
name := "search-management-ui"
4-
version := "3.15.4"
4+
version := "3.16.0"
55

66
scalaVersion := "2.12.17"
77

@@ -50,7 +50,7 @@ libraryDependencies ++= {
5050
"org.postgresql" % "postgresql" % "42.5.1",
5151
"org.xerial" % "sqlite-jdbc" % "3.40.0.0",
5252
"org.playframework.anorm" %% "anorm" % "2.7.0",
53-
"com.typesafe.play" %% "play-json" % "2.6.12",
53+
"com.typesafe.play" %% "play-json" % "2.9.3",
5454
"com.pauldijou" %% "jwt-play" % "4.1.0",
5555
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.0" % Test,
5656
"org.mockito" % "mockito-all" % "1.10.19" % Test,
@@ -68,7 +68,8 @@ dependencyOverrides ++= {
6868
Seq(
6969
"com.fasterxml.jackson.core" % "jackson-annotations" % jacksonVersion,
7070
"com.fasterxml.jackson.core" % "jackson-core" % jacksonVersion,
71-
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion
71+
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion,
72+
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion
7273
)
7374
}
7475

@@ -81,6 +82,8 @@ assembly / assemblyMergeStrategy := {
8182
// one with the given settings
8283
MergeStrategy.discard
8384
case x if x.endsWith("module-info.class") => MergeStrategy.discard
85+
// Protobuf schemas, we just use the first one as we don't use Protobuf at all
86+
case x if x.endsWith(".proto") => MergeStrategy.first
8487
case "play/reference-overrides.conf" => MergeStrategy.concat
8588
case x =>
8689
val oldStrategy = (assembly / assemblyMergeStrategy).value

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.9")
1+
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.18")
22
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2")
33
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
44
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.0.0")

test/models/DBCompatibilitySpec.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package models
22

33
import java.time.LocalDateTime
4-
import scala.util.{Try, Failure}
5-
4+
import scala.util.Try
65
import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers}
76
import play.api.db.Database
87
import models.input.{InputTag, InputTagId, SearchInput, SearchInputWithRules}
@@ -109,7 +108,9 @@ abstract class DBCompatibilitySpec extends FlatSpec with Matchers with TestData
109108
val trySecondCreate = Try(
110109
SmuiMigrationLock.create(MIGRATION_KEY)
111110
)
112-
trySecondCreate shouldBe Failure
111+
// Postgres: ERROR: duplicate key value violates unique constraint "smui_migration_lock_pkey"
112+
// SQLite: [SQLITE_CONSTRAINT_PRIMARYKEY] A PRIMARY KEY constraint failed (UNIQUE constraint failed: smui_migration_lock.migration_key)
113+
trySecondCreate.isFailure shouldBe true
113114
// thread#1: make sure, the test migration can be selected (while its locked), but is not completed yet
114115
val migrationLockEntry = SmuiMigrationLock.select(MIGRATION_KEY).get
115116
migrationLockEntry.migrationKey shouldBe MIGRATION_KEY

0 commit comments

Comments
 (0)