Skip to content

Commit 1bd4ce2

Browse files
authored
Merge branch 'master' into update/aws-java-sdk-s3-1.12.514
2 parents 32d34d2 + cb498fe commit 1bd4ce2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+247
-109
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ project/plugins/project/
1616
.scala_dependencies
1717
.worksheet
1818
.idea
19+
!/project/Versions.scala
1920
/project/
2021
!project/build.properties
2122
out

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ In this repository, we have classified the tests in 4 categories.
1111

1212

1313
Here is a table describing about the different categories of tests and how they can be executed in this project.
14+
Note that these commands are defined at the root level of the project and hence are accessible only from the root project(not directly within each submodule).
1415

1516
| Category | Sbt command | Test class location | Test class name format |
1617
|-------------------------|-------------------|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------|

build.sbt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
val scalaV = "2.13.11"
2-
val scala3Version = "3.2.2"
1+
val scalaV = ScalaVersions.scala2Version
2+
val scala3Version = ScalaVersions.scala3Version
33
ThisBuild / scalaVersion := scalaV
44
ThisBuild / version := "1.0-SNAPSHOT"
55
ThisBuild / organization := "com.baeldung"
@@ -10,7 +10,7 @@ val catsEffect = "org.typelevel" %% "cats-effect" % "3.5.1"
1010
val catEffectTest = "org.typelevel" %% "cats-effect-testkit" % "3.5.1" % Test
1111
val scalaReflection = "org.scala-lang" % "scala-reflect" % scalaV
1212
val logback = "ch.qos.logback" % "logback-classic" % "1.3.8"
13-
val embedMongoVersion = "4.7.0"
13+
val embedMongoVersion = "4.7.1"
1414

1515
val scalaTestDeps = Seq(
1616
"org.scalatest" %% "scalatest" % "3.2.16" % Test,
@@ -46,7 +46,7 @@ lazy val scala_core_3 = (project in file("scala-core-3"))
4646
libraryDependencies ++= scalaTestDeps,
4747
libraryDependencies += jUnitInterface,
4848
libraryDependencies += scalaReflection,
49-
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "2.1.0"
49+
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "2.2.0"
5050
)
5151

5252
lazy val scala_core_4 = (project in file("scala-core-4"))
@@ -175,7 +175,7 @@ lazy val scala_akka_dependencies: Seq[ModuleID] = Seq(
175175
"com.typesafe.akka" %% "akka-actor-testkit-typed" % AkkaVersion % Test,
176176
"com.lightbend.akka" %% "akka-stream-alpakka-mongodb" % "5.0.0",
177177
"com.typesafe.akka" %% "akka-stream" % AkkaVersion,
178-
"org.mongodb.scala" %% "mongo-scala-driver" % "4.10.1",
178+
"org.mongodb.scala" %% "mongo-scala-driver" % "4.10.2",
179179
"com.lightbend.akka" %% "akka-stream-alpakka-file" % "5.0.0",
180180
jUnitInterface,
181181
embeddedMongo % Test,
@@ -241,7 +241,7 @@ lazy val scala_libraries = (project in file("scala-libraries"))
241241
"com.github.julien-truffaut" %% "monocle-macro" % monocleVersion,
242242
"com.github.julien-truffaut" %% "monocle-law" % monocleVersion % "test",
243243
"com.typesafe.slick" %% "slick" % slickVersion,
244-
"com.h2database" % "h2" % "2.1.214",
244+
"com.h2database" % "h2" % "2.2.220",
245245
"com.chuusai" %% "shapeless" % shapelessVersion,
246246
"org.scalaz" %% "scalaz-core" % scalazVersion,
247247
"co.fs2" %% "fs2-core" % fs2Version,
@@ -260,7 +260,7 @@ lazy val scala_libraries = (project in file("scala-libraries"))
260260

261261
val circeVersion = "0.14.5"
262262
val monixVersion = "3.4.1"
263-
val elastic4sVersion = "8.7.1"
263+
val elastic4sVersion = "8.8.1"
264264
val sparkVersion = "3.4.1"
265265

266266
val sparkCoreDep = "org.apache.spark" %% "spark-core" % sparkVersion
@@ -280,7 +280,7 @@ lazy val scala_libraries_2 = (project in file("scala-libraries-2"))
280280
"com.github.cb372" %% "scalacache-guava" % "0.28.0",
281281
"com.github.cb372" %% "scalacache-cats-effect" % "0.28.0",
282282
"com.github.cb372" %% "scalacache-caffeine" % "0.28.0",
283-
"com.beachape" %% "enumeratum" % "1.7.2"
283+
"com.beachape" %% "enumeratum" % "1.7.3"
284284
),
285285
libraryDependencies ++= Seq(
286286
"com.typesafe.play" %% "play-slick" % "5.1.0",
@@ -308,7 +308,7 @@ lazy val scala_libraries_2 = (project in file("scala-libraries-2"))
308308
)
309309

310310
val http4sBlaze = "0.23.15"
311-
val http4sVersion = "0.23.22"
311+
val http4sVersion = "0.23.23"
312312
val osLibVersion = "0.9.1"
313313
lazy val scala_libraries_3 = (project in file("scala-libraries-3"))
314314
.settings(
@@ -322,7 +322,7 @@ lazy val scala_libraries_3 = (project in file("scala-libraries-3"))
322322
"org.http4s" %% "http4s-dsl" % http4sVersion,
323323
"org.http4s" %% "http4s-blaze-server" % http4sBlaze,
324324
"org.http4s" %% "http4s-blaze-client" % http4sBlaze,
325-
"com.beachape" %% "enumeratum" % "1.7.2",
325+
"com.beachape" %% "enumeratum" % "1.7.3",
326326
"com.github.pureconfig" %% "pureconfig" % "0.17.4",
327327
"com.github.pureconfig" %% "pureconfig-enumeratum" % "0.17.4",
328328
"com.typesafe" % "config" % "1.4.2",
@@ -373,7 +373,7 @@ lazy val scala_libraries_4 = (project in file("scala-libraries-4"))
373373
"org.testcontainers" % "pulsar" % "1.18.3" % IntegrationTest
374374
),
375375
libraryDependencies ++= Seq(
376-
"software.amazon.awssdk" % "s3" % "2.20.98",
376+
"software.amazon.awssdk" % "s3" % "2.20.111",
377377
"com.amazonaws" % "aws-java-sdk-s3" % "1.12.514" % IntegrationTest,
378378
"com.dimafeng" %% "testcontainers-scala-scalatest" % "0.40.17" % IntegrationTest,
379379
"com.dimafeng" %% "testcontainers-scala-localstack-v2" % "0.40.17" % IntegrationTest
@@ -483,7 +483,7 @@ Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-eG")
483483

484484
lazy val scala212 = (project in file("scala-2-modules/scala212"))
485485
.settings(
486-
scalaVersion := "2.12.18",
486+
scalaVersion := ScalaVersions.scala212Version,
487487
name := "scala212",
488488
libraryDependencies ++= scalaTestDeps
489489
)
@@ -512,3 +512,5 @@ addCommandAlias(
512512
"liveTests",
513513
""";ci; set ThisBuild/IntegrationTest/testOptions += Tests.Filter(t => t.endsWith("LiveTest")); it:test""".stripMargin
514514
)
515+
516+
lazy val playGroup = (project in file("play-scala"))

play-scala/application-tests/app/com/baeldung/arrival/controller/ArrivalController.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import play.api.mvc.{BaseController, ControllerComponents}
77
import javax.inject.Inject
88
import scala.concurrent.ExecutionContext
99

10-
class ArrivalController @Inject()(arrivalService: ArrivalService, val controllerComponents: ControllerComponents)(implicit ec: ExecutionContext) extends BaseController {
10+
class ArrivalController @Inject() (
11+
arrivalService: ArrivalService,
12+
val controllerComponents: ControllerComponents
13+
)(implicit ec: ExecutionContext)
14+
extends BaseController {
1115

1216
def index() = Action.async { _ =>
1317
arrivalService.getArrivals().map(arrivals => Ok(Json.toJson(arrivals)))

play-scala/application-tests/app/com/baeldung/arrival/controller/action/SourceActions.scala

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,27 @@ import scala.concurrent.{ExecutionContext, Future}
66

77
trait SourceActions {
88

9-
def SourceActionFilter(implicit ec: ExecutionContext): ActionFilter[Request] = new ActionFilter[Request] {
10-
override protected def filter[A](request: Request[A]): Future[Option[Result]] = {
11-
Future.successful {
12-
request.headers.get("source") match {
13-
case Some(_) => None
14-
case None => Some(Results.BadRequest("Source header is absent"))
9+
def SourceActionFilter(implicit ec: ExecutionContext): ActionFilter[Request] =
10+
new ActionFilter[Request] {
11+
override protected def filter[A](
12+
request: Request[A]
13+
): Future[Option[Result]] = {
14+
Future.successful {
15+
request.headers.get("source") match {
16+
case Some(_) => None
17+
case None => Some(Results.BadRequest("Source header is absent"))
18+
}
1519
}
1620
}
17-
}
1821

19-
override protected def executionContext: ExecutionContext = ec
20-
}
22+
override protected def executionContext: ExecutionContext = ec
23+
}
2124

22-
def SourceAction(anyContentParser: BodyParser[AnyContent])(implicit ec: ExecutionContext): ActionBuilder[Request, AnyContent] =
23-
new ActionBuilderImpl[AnyContent](anyContentParser) andThen SourceActionFilter
25+
def SourceAction(
26+
anyContentParser: BodyParser[AnyContent]
27+
)(implicit ec: ExecutionContext): ActionBuilder[Request, AnyContent] =
28+
new ActionBuilderImpl[AnyContent](
29+
anyContentParser
30+
) andThen SourceActionFilter
2431

2532
}

play-scala/application-tests/app/com/baeldung/arrival/db/manager/H2Manager.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ import slick.jdbc.H2Profile
55

66
import javax.inject.Inject
77

8-
class H2Manager @Inject()(val dbConfig: DatabaseConfig[H2Profile]) extends DbManager
8+
class H2Manager @Inject() (val dbConfig: DatabaseConfig[H2Profile])
9+
extends DbManager

play-scala/application-tests/app/com/baeldung/arrival/db/manager/PostgresManager.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ import slick.jdbc.PostgresProfile
55

66
import javax.inject.Inject
77

8-
class PostgresManager @Inject()(val dbConfig: DatabaseConfig[PostgresProfile]) extends DbManager
8+
class PostgresManager @Inject() (val dbConfig: DatabaseConfig[PostgresProfile])
9+
extends DbManager

play-scala/application-tests/app/com/baeldung/arrival/db/repository/ArrivalRepository.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ package com.baeldung.arrival.db.repository
33
import play.api.libs.json.{Json, OFormat}
44
import slick.dbio.DBIO
55

6-
case class Arrival(planeId: Long, origin: String, destination: String, plane: String)
6+
case class Arrival(
7+
planeId: Long,
8+
origin: String,
9+
destination: String,
10+
plane: String
11+
)
712

813
object Arrival {
914
implicit val format: OFormat[Arrival] = Json.format[Arrival]

play-scala/application-tests/app/com/baeldung/arrival/db/repository/SlickArrivalRepository.scala

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import slick.jdbc.JdbcProfile
55
import javax.inject.Inject
66
import scala.concurrent.ExecutionContext
77

8-
class SlickArrivalRepository @Inject()(val dbProfile: JdbcProfile)(implicit ec: ExecutionContext) extends ArrivalRepository {
9-
8+
class SlickArrivalRepository @Inject() (val dbProfile: JdbcProfile)(implicit
9+
ec: ExecutionContext
10+
) extends ArrivalRepository {
1011

1112
import dbProfile.api._
1213

@@ -20,14 +21,18 @@ class SlickArrivalRepository @Inject()(val dbProfile: JdbcProfile)(implicit ec:
2021

2122
def plane = column[String]("plane")
2223

23-
def * = (id, origin, destination, plane) <> ((Arrival.apply _).tupled, Arrival.unapply)
24+
def * = (
25+
id,
26+
origin,
27+
destination,
28+
plane
29+
) <> ((Arrival.apply _).tupled, Arrival.unapply)
2430
}
2531

26-
/**
27-
* The starting point for all queries on the people table.
28-
*/
32+
/** The starting point for all queries on the people table.
33+
*/
2934
private val arrivals = TableQuery[ArrivalTable]
3035

3136
def getArrivals: DBIO[Seq[Arrival]] = arrivals.result
3237

33-
}
38+
}

play-scala/application-tests/app/com/baeldung/arrival/modules/H2Module.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ class H2Module extends AbstractModule {
1414
}
1515

1616
@Provides
17-
def dbProfile(@NamedDatabase("h2") dbConfigProvider: DatabaseConfigProvider): JdbcProfile = {
17+
def dbProfile(
18+
@NamedDatabase("h2") dbConfigProvider: DatabaseConfigProvider
19+
): JdbcProfile = {
1820
dbConfigProvider.get[H2Profile].profile
1921
}
2022

2123
@Provides
22-
def dbConfig(@NamedDatabase("h2") dbConfigProvider: DatabaseConfigProvider): DatabaseConfig[H2Profile] = {
24+
def dbConfig(
25+
@NamedDatabase("h2") dbConfigProvider: DatabaseConfigProvider
26+
): DatabaseConfig[H2Profile] = {
2327
dbConfigProvider.get[H2Profile]
2428
}
2529

0 commit comments

Comments
 (0)