From bcb94e252a96c78b1db29aebe47b18bfd337e764 Mon Sep 17 00:00:00 2001 From: Sam Guymer Date: Sun, 20 May 2018 21:02:37 +1000 Subject: Code review updates Remove tests sub project, all tests are now in core. Remove TestStreamingBackend, StreamingTest now has the required abstract methods. --- .../sttp/akkahttp/AkkaHttpStreamingTest.scala | 30 ++++++++++++++++ .../sttp/akkahttp/AkkaHttpStreamingTests.scala | 40 ---------------------- 2 files changed, 30 insertions(+), 40 deletions(-) create mode 100644 akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTest.scala delete mode 100644 akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTests.scala (limited to 'akka-http-backend') diff --git a/akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTest.scala b/akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTest.scala new file mode 100644 index 0000000..494ecd2 --- /dev/null +++ b/akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTest.scala @@ -0,0 +1,30 @@ +package com.softwaremill.sttp.akkahttp + +import akka.NotUsed +import akka.actor.ActorSystem +import akka.stream.ActorMaterializer +import akka.stream.scaladsl.Source +import akka.util.ByteString +import com.softwaremill.sttp.SttpBackend +import com.softwaremill.sttp.testing.ConvertToFuture +import com.softwaremill.sttp.testing.streaming.StreamingTest + +import scala.concurrent.Future + +class AkkaHttpStreamingTest extends StreamingTest[Future, Source[ByteString, Any]] { + + private implicit val actorSystem: ActorSystem = ActorSystem("sttp-test") + private implicit val materializer: ActorMaterializer = ActorMaterializer() + + override implicit val backend: SttpBackend[Future, Source[ByteString, Any]] = + AkkaHttpBackend.usingActorSystem(actorSystem) + + override implicit val convertToFuture: ConvertToFuture[Future] = + ConvertToFuture.future + + override def bodyProducer(body: String): Source[ByteString, NotUsed] = + Source.single(ByteString(body)) + + override def bodyConsumer(stream: Source[ByteString, Any]): Future[String] = + stream.map(_.utf8String).runReduce(_ + _) +} diff --git a/akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTests.scala b/akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTests.scala deleted file mode 100644 index e8ab9d7..0000000 --- a/akka-http-backend/src/test/scala/com/softwaremill/sttp/akkahttp/AkkaHttpStreamingTests.scala +++ /dev/null @@ -1,40 +0,0 @@ -package com.softwaremill.sttp.akkahttp - -import akka.NotUsed -import akka.actor.ActorSystem -import akka.stream.{ActorMaterializer, Materializer} -import akka.stream.scaladsl.Source -import akka.util.ByteString -import com.softwaremill.sttp.SttpBackend -import com.softwaremill.sttp.testing.ConvertToFuture -import com.softwaremill.sttp.testing.streaming.{StreamingTest, TestStreamingBackend} - -import scala.concurrent.Future - -class AkkaHttpStreamingTest extends StreamingTest[Future, Source[ByteString, Any]] { - - private implicit val actorSystem: ActorSystem = ActorSystem("sttp-test") - private implicit val materializer: ActorMaterializer = ActorMaterializer() - - override val testStreamingBackend: TestStreamingBackend[Future, Source[ByteString, Any]] = - new AkkaHttpTestStreamingBackend(actorSystem) -} - -class AkkaHttpTestStreamingBackend( - actorSystem: ActorSystem -)(implicit materializer: Materializer) - extends TestStreamingBackend[Future, Source[ByteString, Any]] { - - override implicit val backend: SttpBackend[Future, Source[ByteString, Any]] = - AkkaHttpBackend.usingActorSystem(actorSystem) - - override implicit val convertToFuture: ConvertToFuture[Future] = - ConvertToFuture.future - - override def bodyProducer(body: String): Source[ByteString, NotUsed] = - Source.single(ByteString(body)) - - override def bodyConsumer(stream: Source[ByteString, Any]): Future[String] = - stream.map(_.utf8String).runReduce(_ + _) - -} -- cgit v1.2.3