diff options
author | Ivan Topolnak <ivantopo@gmail.com> | 2013-06-14 18:33:23 -0300 |
---|---|---|
committer | Ivan Topolnak <ivantopo@gmail.com> | 2013-06-14 18:33:23 -0300 |
commit | 658bdd03a3b549cf7225197388e1e18b01723f1f (patch) | |
tree | c88228d013324519d29aad6edebaa1fd65145c28 /src/test/scala/akka | |
parent | 80725fd14a728c6afcc9d8b3ac7c4bd10e8bd05e (diff) | |
download | Kamon-658bdd03a3b549cf7225197388e1e18b01723f1f.tar.gz Kamon-658bdd03a3b549cf7225197388e1e18b01723f1f.tar.bz2 Kamon-658bdd03a3b549cf7225197388e1e18b01723f1f.zip |
minor cleanup, still working in metrics
Diffstat (limited to 'src/test/scala/akka')
-rw-r--r-- | src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala b/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala index c3606d23..15e967f2 100644 --- a/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala +++ b/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala @@ -5,10 +5,11 @@ import org.scalatest.matchers.{ShouldMatchers, MustMatchers} import akka.actor.{Actor, Props, ActorSystem} import kamon.metric.Metrics._ import scala.collection.JavaConverters._ +import akka.testkit.TestActorRef class ActorInstrumentationSpec extends WordSpec with MustMatchers with ShouldMatchers { - val system = ActorSystem() + implicit val system = ActorSystem() import system._ val echoRef = actorOf(Props(new EchoActor), "Echo-Actor") @@ -18,16 +19,18 @@ class ActorInstrumentationSpec extends WordSpec with MustMatchers with ShouldMat "an instrumented Actor" should { "send a message and record a metric on the Metrics Registry with the number of sent messages" in { + val echoActor = TestActorRef[EchoActor] + + + (1 to totalMessages).foreach {x:Int => - echoRef ! s"Message ${x}" + echoActor ! s"Message ${x}" } - //to ensure that all messages was received - Thread.sleep(1000) - - val messages = registry.getMeters.asScala.get(meterForEchoActor).get.getCount + println("After all") + //val messages = registry.getMeters.asScala.get(meterForEchoActor).get.getCount - messages should equal(totalMessages) + //messages should equal(totalMessages) } } @@ -35,7 +38,7 @@ class ActorInstrumentationSpec extends WordSpec with MustMatchers with ShouldMat class EchoActor extends Actor { def receive = { - case msg ⇒ sender ! msg + case msg ⇒ println("SOME"); sender ! msg } } |