From da9ebc63dab51614c8351e3867de816c2310ec8b Mon Sep 17 00:00:00 2001 From: beineng Date: Thu, 3 Jan 2019 14:57:20 +0800 Subject: [PATCH] update tests --- .../com/thenetcircle/event_bus/story/Story.scala | 1 - .../thenetcircle/event_bus/tasks/http/HttpSink.scala | 2 +- .../com/thenetcircle/event_bus/story/StoryTest.scala | 12 ++++++------ 3 files changed, 7 insertions(+), 8 deletions(-) rename {core => integration-test}/src/test/scala/com/thenetcircle/event_bus/story/StoryTest.scala (87%) diff --git a/core/src/main/scala/com/thenetcircle/event_bus/story/Story.scala b/core/src/main/scala/com/thenetcircle/event_bus/story/Story.scala index c0ea3a6..ee85ca9 100644 --- a/core/src/main/scala/com/thenetcircle/event_bus/story/Story.scala +++ b/core/src/main/scala/com/thenetcircle/event_bus/story/Story.scala @@ -208,5 +208,4 @@ object Story extends Logging { } ) .named(taskName) - } diff --git a/core/src/main/scala/com/thenetcircle/event_bus/tasks/http/HttpSink.scala b/core/src/main/scala/com/thenetcircle/event_bus/tasks/http/HttpSink.scala index 0f470fc..c92d7c0 100644 --- a/core/src/main/scala/com/thenetcircle/event_bus/tasks/http/HttpSink.scala +++ b/core/src/main/scala/com/thenetcircle/event_bus/tasks/http/HttpSink.scala @@ -30,7 +30,7 @@ import akka.stream._ import akka.stream.scaladsl.Flow import akka.util.Timeout import com.thenetcircle.event_bus.context.{TaskBuildingContext, TaskRunningContext} -import com.thenetcircle.event_bus.interfaces.EventStatus.{FAIL, NORM, TOFB} +import com.thenetcircle.event_bus.interfaces.EventStatus.{NORM, TOFB} import com.thenetcircle.event_bus.interfaces.{Event, EventStatus, SinkTask, SinkTaskBuilder} import com.thenetcircle.event_bus.misc.{Logging, Util} import com.thenetcircle.event_bus.tasks.http.HttpSink.RetrySender diff --git a/core/src/test/scala/com/thenetcircle/event_bus/story/StoryTest.scala b/integration-test/src/test/scala/com/thenetcircle/event_bus/story/StoryTest.scala similarity index 87% rename from core/src/test/scala/com/thenetcircle/event_bus/story/StoryTest.scala rename to integration-test/src/test/scala/com/thenetcircle/event_bus/story/StoryTest.scala index 9f479eb..122fa6c 100644 --- a/core/src/test/scala/com/thenetcircle/event_bus/story/StoryTest.scala +++ b/integration-test/src/test/scala/com/thenetcircle/event_bus/story/StoryTest.scala @@ -20,21 +20,21 @@ package com.thenetcircle.event_bus.story import akka.NotUsed import akka.stream.Attributes import akka.stream.scaladsl.{Flow, Source} -import com.thenetcircle.event_bus.TestBase +import com.thenetcircle.event_bus.IntegrationTestBase import com.thenetcircle.event_bus.interfaces.EventStatus._ import com.thenetcircle.event_bus.story.Story.Payload -import scala.concurrent.{Await, Future} +import scala.concurrent.Future import scala.util.Random -class StoryTest extends TestBase { +class StoryTest extends IntegrationTestBase { behavior of "Story" it should "make sure the message order after wrapping tasks" in { - val slowTask: Flow[Payload, Payload, NotUsed] = Flow[Payload] - .mapAsync(2) { pl => + val slowTask1: Flow[Payload, Payload, NotUsed] = Flow[Payload] + .mapAsync(1) { pl => Future { Thread.sleep(Random.nextInt(1000)) pl @@ -44,7 +44,7 @@ class StoryTest extends TestBase { val slowTask2: Flow[Payload, Payload, NotUsed] = Flow[Payload].async .addAttributes(Attributes.inputBuffer(1, 1)) - val wrappedTask: Flow[Payload, Payload, NotUsed] = Story.wrapTask(slowTask2, "testTask") + val wrappedTask: Flow[Payload, Payload, NotUsed] = Story.wrapTask(slowTask1, "testTask") val testSource: Source[Payload, NotUsed] = Source( List(