also fix FlowInterleaveSpec

Also-by: Johan Andrén <johan@markatta.com>
Also-by: Roland Kuhn <rk@rkuhn.info>
Also-by: Martynas Mickevičius <mmartynas@gmail.com>
This commit is contained in:
Endre Sándor Varga 2016-01-20 10:00:37 +02:00 committed by Martynas Mickevičius
parent ef77b56e66
commit 60497f6561
195 changed files with 1110 additions and 857 deletions

View file

@ -4,6 +4,8 @@
package akka.http.scaladsl.testkit
import akka.NotUsed
import scala.concurrent.duration._
import akka.util.ByteString
@ -24,7 +26,7 @@ import akka.http.scaladsl.model.ws.{ BinaryMessage, TextMessage, Message }
* Requesting elements is handled automatically.
*/
trait WSProbe {
def flow: Flow[Message, Message, Unit]
def flow: Flow[Message, Message, NotUsed]
/**
* Send the given messages out of the flow.
@ -96,6 +98,7 @@ trait WSProbe {
object WSProbe {
/**
* Creates a WSProbe to use in tests against websocket handlers.
*
* @param maxChunks The maximum number of chunks to collect for streamed messages.
* @param maxChunkCollectionMills The maximum time in milliseconds to collect chunks for streamed messages.
*/
@ -104,7 +107,7 @@ object WSProbe {
val subscriber = TestSubscriber.probe[Message]()
val publisher = TestPublisher.probe[Message]()
def flow: Flow[Message, Message, Unit] = Flow.fromSinkAndSourceMat(Sink.fromSubscriber(subscriber), Source.fromPublisher(publisher))(Keep.none)
def flow: Flow[Message, Message, NotUsed] = Flow.fromSinkAndSourceMat(Sink.fromSubscriber(subscriber), Source.fromPublisher(publisher))(Keep.none)
def sendMessage(message: Message): Unit = publisher.sendNext(message)
def sendMessage(text: String): Unit = sendMessage(TextMessage(text))