Skip to content

Commit

Permalink
Merge branch 'play_2_8'
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.sbt
  • Loading branch information
pbartusch committed Sep 7, 2023
2 parents e239bc4 + cc54b9b commit de13877
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/controllers/ApiController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class ApiController @Inject()(authActionFactory: AuthActionFactory,
}
private def lookupUserInfo(request: Request[AnyContent]) = {
val userInfo: Option[String] = request match {
case _: UserRequest[A] => Option(request.asInstanceOf[UserRequest[A]].username)
case _: UserRequest[_] => Option(request.asInstanceOf[UserRequest[_]].username)
case _ => None
}
userInfo
Expand Down
2 changes: 1 addition & 1 deletion app/models/Id.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class IdObject[T <: Id](fromString: String => T) {

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

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

def apply(): T = apply(UUID.randomUUID().toString)
Expand Down
10 changes: 5 additions & 5 deletions app/models/SearchManagementRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ class SearchManagementRepository @Inject()(dbapi: DBApi, toggleService: FeatureT
def addNewDeploymentLogOk(solrIndexId: String, targetPlatform: String): Boolean = db.withConnection { implicit connection =>
SQL("insert into deployment_log(id, solr_index_id, target_platform, last_update, result) values ({id}, {solr_index_id}, {target_platform}, {last_update}, {result})")
.on(
'id -> UUID.randomUUID().toString,
'solr_index_id -> solrIndexId,
'target_platform -> targetPlatform,
'last_update -> new Date(),
'result -> 0
"id" -> UUID.randomUUID().toString,
"solr_index_id" -> solrIndexId,
"target_platform" -> targetPlatform,
"last_update" -> new Date(),
"result" -> 0
)
.execute()
}
Expand Down
18 changes: 9 additions & 9 deletions app/models/eventhistory/InputEvent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ object InputEvent extends Logging {
s"order by $EVENT_TIME asc"
)
.on(
'dateFrom -> dateFrom,
'dateTo -> dateTo
"dateFrom" -> dateFrom,
"dateTo" -> dateTo
)
.as(sqlParser.*)

Expand Down Expand Up @@ -304,8 +304,8 @@ object InputEvent extends Logging {
s"limit 1"
)
.on(
'inputId -> inputEvent.inputId,
'dateFrom -> inputEvent.eventTime,
"inputId" -> inputEvent.inputId,
"dateFrom" -> inputEvent.eventTime,
)
.as(sqlParser.*)

Expand Down Expand Up @@ -340,9 +340,9 @@ object InputEvent extends Logging {
s"order by $EVENT_TIME asc"
)
.on(
'inputId -> inputId,
'dateFrom -> dateFrom,
'dateTo -> dateTo
"inputId" -> inputId,
"dateFrom" -> dateFrom,
"dateTo" -> dateTo
)
.as(sqlParser.*)

Expand All @@ -359,8 +359,8 @@ object InputEvent extends Logging {
s"limit 1"
)
.on(
'inputId -> inputId,
'dateFrom -> dateFrom,
"inputId" -> inputId,
"dateFrom" -> dateFrom,
)
.as(sqlParser.*)

Expand Down
9 changes: 6 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import com.typesafe.sbt.GitBranchPrompt

name := "search-management-ui"
version := "3.17.1"
version := "3.17.2"

scalaVersion := "2.12.17"

Expand Down Expand Up @@ -50,7 +50,7 @@ libraryDependencies ++= {
"org.postgresql" % "postgresql" % "42.5.1",
"org.xerial" % "sqlite-jdbc" % "3.40.0.0",
"org.playframework.anorm" %% "anorm" % "2.7.0",
"com.typesafe.play" %% "play-json" % "2.6.12",
"com.typesafe.play" %% "play-json" % "2.9.3",
"com.pauldijou" %% "jwt-play" % "4.1.0",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.0" % Test,
"org.mockito" % "mockito-all" % "1.10.19" % Test,
Expand All @@ -68,7 +68,8 @@ dependencyOverrides ++= {
Seq(
"com.fasterxml.jackson.core" % "jackson-annotations" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-core" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion
)
}

Expand All @@ -81,6 +82,8 @@ assembly / assemblyMergeStrategy := {
// one with the given settings
MergeStrategy.discard
case x if x.endsWith("module-info.class") => MergeStrategy.discard
// Protobuf schemas, we just use the first one as we don't use Protobuf at all
case x if x.endsWith(".proto") => MergeStrategy.first
case "play/reference-overrides.conf" => MergeStrategy.concat
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.9")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.18")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.0.0")
Expand Down
7 changes: 4 additions & 3 deletions test/models/DBCompatibilitySpec.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package models

import java.time.LocalDateTime
import scala.util.{Try, Failure}

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

0 comments on commit de13877

Please sign in to comment.