diff options
author | Ivan Topolnak <itopolnak@despegar.com> | 2013-12-23 18:16:36 -0300 |
---|---|---|
committer | Ivan Topolnak <itopolnak@despegar.com> | 2013-12-23 18:16:36 -0300 |
commit | f648ccc25197d6a0b604722c78c715a8ef6b59ae (patch) | |
tree | fba781ef590b22d296950ddb202f57bdbc5433d4 /kamon-trace/src/test/scala/kamon/trace/instrumentation | |
parent | f2a4fcd0a6190d674773228ab9589742955515b9 (diff) | |
download | Kamon-f648ccc25197d6a0b604722c78c715a8ef6b59ae.tar.gz Kamon-f648ccc25197d6a0b604722c78c715a8ef6b59ae.tar.bz2 Kamon-f648ccc25197d6a0b604722c78c715a8ef6b59ae.zip |
fix kamon repo definition
Diffstat (limited to 'kamon-trace/src/test/scala/kamon/trace/instrumentation')
-rw-r--r-- | kamon-trace/src/test/scala/kamon/trace/instrumentation/ActorSystemMessagePassingInstrumentationSpec.scala | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/kamon-trace/src/test/scala/kamon/trace/instrumentation/ActorSystemMessagePassingInstrumentationSpec.scala b/kamon-trace/src/test/scala/kamon/trace/instrumentation/ActorSystemMessagePassingInstrumentationSpec.scala index a845ad0c..7d539370 100644 --- a/kamon-trace/src/test/scala/kamon/trace/instrumentation/ActorSystemMessagePassingInstrumentationSpec.scala +++ b/kamon-trace/src/test/scala/kamon/trace/instrumentation/ActorSystemMessagePassingInstrumentationSpec.scala @@ -1,17 +1,16 @@ package kamon.trace.instrumentation -import akka.testkit.{ImplicitSender, TestKit} +import akka.testkit.{ ImplicitSender, TestKit } import akka.actor._ import org.scalatest.WordSpecLike import kamon.trace.Trace import scala.util.control.NonFatal -import akka.actor.SupervisorStrategy.{Escalate, Stop, Restart, Resume} +import akka.actor.SupervisorStrategy.{ Escalate, Stop, Restart, Resume } import scala.concurrent.duration._ class ActorSystemMessagePassingInstrumentationSpec extends TestKit(ActorSystem("actor-message-passing-tracing-spec")) with WordSpecLike with ImplicitSender { implicit val executionContext = system.dispatcher - "the system message passing instrumentation" should { "keep the TraceContext while processing the Create message in top level actors" in new TraceContextFixture { Trace.withContext(testTraceContext) { @@ -19,24 +18,23 @@ class ActorSystemMessagePassingInstrumentationSpec extends TestKit(ActorSystem(" testActor ! Trace.context() - def receive: Actor.Receive = { case any => } + def receive: Actor.Receive = { case any ⇒ } })) } expectMsg(testTraceContext) } - "keep the TraceContext while processing the Create message in non top level actors" in new TraceContextFixture { Trace.withContext(testTraceContext) { system.actorOf(Props(new Actor { def receive: Actor.Receive = { - case any => + case any ⇒ context.actorOf(Props(new Actor { testActor ! Trace.context() - def receive: Actor.Receive = { case any => } + def receive: Actor.Receive = { case any ⇒ } })) } })) ! "any" @@ -45,7 +43,6 @@ class ActorSystemMessagePassingInstrumentationSpec extends TestKit(ActorSystem(" expectMsg(testTraceContext) } - "keep the TraceContext in the supervision cycle" when { "the actor is resumed" in new TraceContextFixture { val supervisor = supervisorWithDirective(Resume) @@ -106,16 +103,16 @@ class ActorSystemMessagePassingInstrumentationSpec extends TestKit(ActorSystem(" } def supervisorWithDirective(directive: SupervisorStrategy.Directive, sendPreRestart: Boolean = false, sendPostRestart: Boolean = false, - sendPostStop: Boolean = false, sendPreStart: Boolean = false): ActorRef = { + sendPostStop: Boolean = false, sendPreStart: Boolean = false): ActorRef = { class GrandParent extends Actor { val child = context.actorOf(Props(new Parent)) override def supervisorStrategy: SupervisorStrategy = OneForOneStrategy() { - case NonFatal(throwable) => testActor ! Trace.context(); Stop + case NonFatal(throwable) ⇒ testActor ! Trace.context(); Stop } def receive = { - case any => child forward any + case any ⇒ child forward any } } @@ -123,42 +120,42 @@ class ActorSystemMessagePassingInstrumentationSpec extends TestKit(ActorSystem(" val child = context.actorOf(Props(new Child)) override def supervisorStrategy: SupervisorStrategy = OneForOneStrategy() { - case NonFatal(throwable) => testActor ! Trace.context(); directive + case NonFatal(throwable) ⇒ testActor ! Trace.context(); directive } def receive: Actor.Receive = { - case any => child forward any + case any ⇒ child forward any } override def postStop(): Unit = { - if(sendPostStop) testActor ! Trace.context() + if (sendPostStop) testActor ! Trace.context() super.postStop() } } class Child extends Actor { def receive = { - case "fail" => 1/0 - case "context" => sender ! Trace.context() + case "fail" ⇒ 1 / 0 + case "context" ⇒ sender ! Trace.context() } override def preRestart(reason: Throwable, message: Option[Any]): Unit = { - if(sendPreRestart) testActor ! Trace.context() + if (sendPreRestart) testActor ! Trace.context() super.preRestart(reason, message) } override def postRestart(reason: Throwable): Unit = { - if(sendPostRestart) testActor ! Trace.context() + if (sendPostRestart) testActor ! Trace.context() super.postRestart(reason) } override def postStop(): Unit = { - if(sendPostStop) testActor ! Trace.context() + if (sendPostStop) testActor ! Trace.context() super.postStop() } override def preStart(): Unit = { - if(sendPreStart) testActor ! Trace.context() + if (sendPreStart) testActor ! Trace.context() super.preStart() } } |