!htc #15726: Akka HTTP with the new DSL

This commit is contained in:
Endre Sándor Varga 2014-10-07 13:55:56 +02:00
parent c1d26c8ff7
commit ed27f86791
58 changed files with 554 additions and 503 deletions

View file

@ -8,7 +8,7 @@ import scala.concurrent.duration._
import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpec }
import org.scalatest.concurrent.ScalaFutures
import akka.actor.ActorSystem
import akka.stream.FlowMaterializer
import akka.stream.scaladsl2.FlowMaterializer
import akka.http.unmarshalling.Unmarshal
import akka.http.marshalling.Marshal
import akka.http.model._

View file

@ -9,7 +9,7 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import org.scalatest.{ BeforeAndAfterAll, FreeSpec, Matchers }
import akka.actor.ActorSystem
import akka.stream.FlowMaterializer
import akka.stream.scaladsl2.FlowMaterializer
import akka.http.util._
import akka.http.model._
import headers._

View file

@ -8,7 +8,7 @@ import com.typesafe.config.{ ConfigFactory, Config }
import scala.concurrent.duration._
import akka.actor.ActorSystem
import akka.io.IO
import akka.stream.FlowMaterializer
import akka.stream.scaladsl2.FlowMaterializer
import akka.util.Timeout
import akka.pattern.ask
import akka.http.Http

View file

@ -10,8 +10,7 @@ import scala.concurrent.{ Future, Await }
import org.scalatest.matchers.Matcher
import org.scalatest.{ BeforeAndAfterAll, FreeSpec, Matchers }
import akka.actor.ActorSystem
import akka.stream.scaladsl.Flow
import akka.stream.FlowMaterializer
import akka.stream.scaladsl2._
import akka.http.model._
import akka.http.util._
import headers._
@ -96,7 +95,7 @@ class UnmarshallingSpec extends FreeSpec with Matchers with BeforeAndAfterAll {
|test@there.com
|-----""".stripMarginWithNewline("\r\n")))
.to[MultipartContent], 1.second)
Await.result(Flow(mpc.parts).toFuture().failed, 1.second).getMessage shouldEqual
Await.result(mpc.parts.runWith(FutureDrain()).failed, 1.second).getMessage shouldEqual
"multipart part must not contain more than one Content-Type header"
}
@ -174,14 +173,14 @@ class UnmarshallingSpec extends FreeSpec with Matchers with BeforeAndAfterAll {
def haveParts[T <: MultipartParts](parts: BodyPart*): Matcher[Future[T]] =
equal(parts).matcher[Seq[BodyPart]] compose { x
Await.result(x
.fast.flatMap(x Flow(x.parts).grouped(100).toFuture())
.fast.flatMap(x x.parts.grouped(100).runWith(FutureDrain()))
.fast.recover { case _: NoSuchElementException Nil }, 1.second)
}
def haveFormData(fields: (String, BodyPart)*): Matcher[Future[MultipartFormData]] =
equal(fields).matcher[Seq[(String, BodyPart)]] compose { x
Await.result(x
.fast.flatMap(x Flow(x.parts).grouped(100).toFuture())
.fast.flatMap(x x.parts.grouped(100).runWith(FutureDrain()))
.fast.recover { case _: NoSuchElementException Nil }
.fast.map {
_ map { part