Browse Source

Bump latest Scala, sbt and dependencies versions + minor migrations due to api changes (#5967)

Co-authored-by: vbodnart <[email protected]>
Vladimir Bodnartchouk 5 years ago
parent
commit
d30d20a0ef

+ 8 - 7
frameworks/Scala/akka-http/akka-http/build.sbt

@@ -6,17 +6,18 @@ name := "akka-http-benchmark"
 
 
 version := "0.1.0-SNAPSHOT"
 version := "0.1.0-SNAPSHOT"
 
 
-scalaVersion := "2.13.0"
+scalaVersion := "2.13.3"
 
 
 resolvers += "Akka Snapshot Repository" at "http://repo.akka.io/snapshots/"
 resolvers += "Akka Snapshot Repository" at "http://repo.akka.io/snapshots/"
 
 
 libraryDependencies ++= Seq(
 libraryDependencies ++= Seq(
-  "com.typesafe.akka" %% "akka-http" % "10.1.8",
-  "com.typesafe.akka" %% "akka-stream" % "2.5.23",
-  "de.heikoseeberger" %% "akka-http-jsoniter-scala" % "1.27.0",
-  "mysql" % "mysql-connector-java" % "8.0.18",
-  "com.zaxxer" % "HikariCP" % "3.3.1",
-  "org.scalatra.scalate" %% "scalate-core" % "1.9.4",
+  "com.typesafe.akka" %% "akka-http" % "10.2.0",
+  "com.typesafe.akka" %% "akka-stream" % "2.6.8",
+  "de.heikoseeberger" %% "akka-http-jsoniter-scala" % "1.34.0",
+  "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.6.0",
+  "mysql" % "mysql-connector-java" % "8.0.21",
+  "com.zaxxer" % "HikariCP" % "3.4.5",
+  "org.scalatra.scalate" %% "scalate-core" % "1.9.6",
   "org.scalatest" %% "scalatest" % "3.0.8" % "test"
   "org.scalatest" %% "scalatest" % "3.0.8" % "test"
 )
 )
 
 

+ 1 - 1
frameworks/Scala/akka-http/akka-http/project/build.properties

@@ -1 +1 @@
-sbt.version=1.2.8
+sbt.version=1.3.13

+ 1 - 1
frameworks/Scala/akka-http/akka-http/project/plugins.sbt

@@ -4,4 +4,4 @@ classpathTypes += "maven-plugin"
 
 
 addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
 addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
 addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.16")
 addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.16")
-addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3")
+addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3")

+ 0 - 4
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/App.scala

@@ -1,14 +1,11 @@
 package com.typesafe.akka.http.benchmark
 package com.typesafe.akka.http.benchmark
 
 
 import akka.actor.ActorSystem
 import akka.actor.ActorSystem
-import akka.stream.ActorMaterializer
-import akka.stream.Materializer
 import com.typesafe.akka.http.benchmark.datastore.MySqlDataStore
 import com.typesafe.akka.http.benchmark.datastore.MySqlDataStore
 import com.typesafe.akka.http.benchmark.handlers._
 import com.typesafe.akka.http.benchmark.handlers._
 import com.typesafe.akka.http.benchmark.util.RandomGenerator
 import com.typesafe.akka.http.benchmark.util.RandomGenerator
 import com.typesafe.config.Config
 import com.typesafe.config.Config
 import com.typesafe.config.ConfigFactory
 import com.typesafe.config.ConfigFactory
-import org.fusesource.scalate.Binding
 import org.fusesource.scalate.TemplateEngine
 import org.fusesource.scalate.TemplateEngine
 
 
 import scala.concurrent.ExecutionContext
 import scala.concurrent.ExecutionContext
@@ -19,7 +16,6 @@ class App extends Infrastructure with RandomGenerator with MySqlDataStore with P
   val templateEngine = new TemplateEngine()
   val templateEngine = new TemplateEngine()
   implicit val system: ActorSystem = ActorSystem("akka-http-benchmark")
   implicit val system: ActorSystem = ActorSystem("akka-http-benchmark")
   val executionContext: ExecutionContext = system.dispatcher
   val executionContext: ExecutionContext = system.dispatcher
-  val materializer: Materializer = ActorMaterializer()
   val appConfig: Config = ConfigFactory.load
   val appConfig: Config = ConfigFactory.load
 }
 }
 
 

+ 4 - 5
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/Bootstrap.scala

@@ -1,7 +1,6 @@
 package com.typesafe.akka.http.benchmark
 package com.typesafe.akka.http.benchmark
 
 
 import akka.http.scaladsl.Http
 import akka.http.scaladsl.Http
-import akka.http.scaladsl.server.Route
 
 
 trait Bootstrap {
 trait Bootstrap {
   def run(): Unit
   def run(): Unit
@@ -9,9 +8,9 @@ trait Bootstrap {
 
 
 trait BenchmarkBootstrap extends Bootstrap { _: Infrastructure with RequestMapping =>
 trait BenchmarkBootstrap extends Bootstrap { _: Infrastructure with RequestMapping =>
   override def run(): Unit =
   override def run(): Unit =
-    Http().bindAndHandleAsync(
-      Route.asyncHandler(asRoute),
+    Http().newServerAt(
       appConfig.getString("akka.http.benchmark.host"),
       appConfig.getString("akka.http.benchmark.host"),
-      appConfig.getInt("akka.http.benchmark.port"),
-      parallelism = 16)
+      appConfig.getInt("akka.http.benchmark.port"))
+      .adaptSettings(settings => settings.mapHttp2Settings(_.withMaxConcurrentStreams(16)))
+      .bind(asRoute)
 }
 }

+ 0 - 3
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/Infrastructure.scala

@@ -1,7 +1,6 @@
 package com.typesafe.akka.http.benchmark
 package com.typesafe.akka.http.benchmark
 
 
 import akka.actor.ActorSystem
 import akka.actor.ActorSystem
-import akka.stream.Materializer
 import com.typesafe.config.Config
 import com.typesafe.config.Config
 
 
 import scala.concurrent.ExecutionContext
 import scala.concurrent.ExecutionContext
@@ -11,7 +10,5 @@ trait Infrastructure {
 
 
   implicit def executionContext: ExecutionContext
   implicit def executionContext: ExecutionContext
 
 
-  implicit def materializer: Materializer
-
   def appConfig: Config
   def appConfig: Config
 }
 }

+ 0 - 1
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/datastore/MySqlDataStore.scala

@@ -11,7 +11,6 @@ import com.typesafe.akka.http.benchmark.entity.{ Fortune, World }
 import com.typesafe.config.Config
 import com.typesafe.config.Config
 import com.zaxxer.hikari._
 import com.zaxxer.hikari._
 
 
-import scala.collection.immutable
 import scala.concurrent.ExecutionContext
 import scala.concurrent.ExecutionContext
 import scala.concurrent.Future
 import scala.concurrent.Future
 
 

+ 2 - 2
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/entity/World.scala

@@ -6,6 +6,6 @@ import com.github.plokhotnyuk.jsoniter_scala.macros._
 case class World(id: Int, randomNumber: Int)
 case class World(id: Int, randomNumber: Int)
 
 
 object World {
 object World {
-  implicit val codec: JsonValueCodec[World] = JsonCodecMaker.make[World](CodecMakerConfig())
-  implicit val seqCodec: JsonValueCodec[Seq[World]] = JsonCodecMaker.make[Seq[World]](CodecMakerConfig())
+  implicit val codec: JsonValueCodec[World] = JsonCodecMaker.make[World](CodecMakerConfig)
+  implicit val seqCodec: JsonValueCodec[Seq[World]] = JsonCodecMaker.make[Seq[World]](CodecMakerConfig)
 }
 }

+ 1 - 1
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/handlers/JsonHandler.scala

@@ -8,7 +8,7 @@ import com.github.plokhotnyuk.jsoniter_scala.macros._
 case class JsonResponse(message: String)
 case class JsonResponse(message: String)
 
 
 object JsonResponse {
 object JsonResponse {
-  implicit val codec: JsonValueCodec[JsonResponse] = JsonCodecMaker.make[JsonResponse](CodecMakerConfig())
+  implicit val codec: JsonValueCodec[JsonResponse] = JsonCodecMaker.make[JsonResponse](CodecMakerConfig)
 }
 }
 
 
 trait JsonHandler {
 trait JsonHandler {

+ 1 - 1
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/handlers/QueriesHandler.scala

@@ -16,7 +16,7 @@ trait QueriesHandler {
   def queriesEndpoint: Route =
   def queriesEndpoint: Route =
     get {
     get {
       path("queries") {
       path("queries") {
-        parameter('queries.?) { numQueries =>
+        parameter("queries".?) { numQueries =>
           // The queries parameter must be bounded to between 1 and 500. If the parameter is missing,
           // The queries parameter must be bounded to between 1 and 500. If the parameter is missing,
           // is not an integer, or is an integer less than 1, the value should be interpreted as 1;
           // is not an integer, or is an integer less than 1, the value should be interpreted as 1;
           // if greater than 500, the value should be interpreted as 500.
           // if greater than 500, the value should be interpreted as 500.

+ 1 - 1
frameworks/Scala/akka-http/akka-http/src/main/scala/com/typesafe/akka/http/benchmark/handlers/UpdatesHandler.scala

@@ -16,7 +16,7 @@ trait UpdatesHandler { _: Infrastructure with DataStore with RandomGenerator =>
   def updatesEndpoint: Route =
   def updatesEndpoint: Route =
     get {
     get {
       path("updates") {
       path("updates") {
-        parameter('queries.?) { numQueries =>
+        parameter("queries".?) { numQueries =>
           val realNumQueries = Try(numQueries.getOrElse("1").toInt).getOrElse(1).min(500).max(1)
           val realNumQueries = Try(numQueries.getOrElse("1").toInt).getOrElse(1).min(500).max(1)
 
 
           def mutateOne(id: Int): Future[World] =
           def mutateOne(id: Int): Future[World] =