Browse Source

Scalene: version bump (#5452)

Dan Simon 5 years ago
parent
commit
4451f867fa

+ 1 - 1
frameworks/Scala/scalene/build.sbt

@@ -1,4 +1,4 @@
-val scaleneUri = uri("https://github.com/DanSimon/Scalene.git#0.1.1")
+val scaleneUri = uri("https://github.com/DanSimon/Scalene.git#0.1.2")
 
 lazy val scaleneRouting = ProjectRef(scaleneUri,"scalene-routing")
 lazy val scaleneSQL = ProjectRef(scaleneUri,"scalene-sql")

+ 6 - 5
frameworks/Scala/scalene/src/main/scala/Benchmark.scala

@@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
 import com.fasterxml.jackson.module.scala.DefaultScalaModule
 import scalene.actor.Pool
 import scalene.routing._
-import scalene.http.{BodyData, BodyFormatter, ContentType}
+import scalene.http.{Body, BodyFormatter, ContentType}
 import scalene.sql._
 import BasicConversions._
 
@@ -17,14 +17,13 @@ object Main extends App {
 
   implicit val messageFormatter = new BodyFormatter[JsonMessage] {
     val mapper: ObjectMapper = new ObjectMapper().registerModule(DefaultScalaModule)
-    def format(msg: JsonMessage) = {
+    def apply(msg: JsonMessage) = {
       val obj = msg match {
         case MultiDBRouteMessage(items) => items
         case other => other
       }
-      BodyData.Static(mapper.writeValueAsBytes(obj))
+      Body(mapper.writeValueAsBytes(obj), Some(ContentType.`application/json`))
     }
-    val contentType = Some(ContentType.`application/json`)
   }
 
   val settings = Settings.basic(
@@ -71,8 +70,10 @@ object Main extends App {
     }
   }
 
+  val plainBody = Body.plain("Hello, World!")
+
   val routes = Routes(
-    GET / "plaintext" to {_ => "Hello, World!".ok},
+    GET / "plaintext" to {_ => plainBody.ok},
     GET / "json"      to {_ => JsonRouteMessage("Hello, World!").ok},
     dbRoute,
     multiRoute