diff options
5 files changed, 12 insertions, 47 deletions
diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 2395acd3..5c74d5a5 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -18,7 +18,7 @@ object Dependencies { val akkaAgent = "com.typesafe.akka" %% "akka-agent" % "2.1.2" val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % "2.1.2" val akkaTestKit = "com.typesafe.akka" %% "akka-testkit" % "2.1.2" - val scalatest = "org.scalatest" % "scalatest_2.10" % "2.0.M5b" + val scalatest = "org.scalatest" % "scalatest_2.10" % "2.0.M6-SNAP22" val logback = "ch.qos.logback" % "logback-classic" % "1.0.10" val aspectJ = "org.aspectj" % "aspectjrt" % "1.7.2" val metrics = "com.codahale.metrics" % "metrics-core" % "3.0.0" diff --git a/src/main/resources/META-INF/aop.xml b/src/main/resources/META-INF/aop.xml index 8619b2c8..3911af1b 100644 --- a/src/main/resources/META-INF/aop.xml +++ b/src/main/resources/META-INF/aop.xml @@ -2,7 +2,7 @@ <aspectj> <weaver options="-verbose -showWeaveInfo"> - <!--<dump within="*"/>--> + <dump within="*" beforeandafter="true"/> </weaver> <aspects> diff --git a/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala b/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala index 15e967f2..1a0e509f 100644 --- a/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala +++ b/src/test/scala/akka/instrumentation/ActorInstrumentationSpec.scala @@ -1,14 +1,13 @@ package akka.instrumentation -import org.scalatest.WordSpec -import org.scalatest.matchers.{ShouldMatchers, MustMatchers} +import org.scalatest.{Matchers, WordSpec} 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 { +class ActorInstrumentationSpec extends WordSpec with Matchers { implicit val system = ActorSystem() import system._ @@ -27,7 +26,6 @@ class ActorInstrumentationSpec extends WordSpec with MustMatchers with ShouldMat echoActor ! s"Message ${x}" } - println("After all") //val messages = registry.getMeters.asScala.get(meterForEchoActor).get.getCount //messages should equal(totalMessages) @@ -38,7 +36,7 @@ class ActorInstrumentationSpec extends WordSpec with MustMatchers with ShouldMat class EchoActor extends Actor { def receive = { - case msg ⇒ println("SOME"); sender ! msg + case msg ⇒ sender ! msg } } diff --git a/src/test/scala/kamon/instrumentation/RunnableInstrumentationSpec.scala b/src/test/scala/kamon/instrumentation/RunnableInstrumentationSpec.scala index 359766b6..de65aaca 100644 --- a/src/test/scala/kamon/instrumentation/RunnableInstrumentationSpec.scala +++ b/src/test/scala/kamon/instrumentation/RunnableInstrumentationSpec.scala @@ -1,9 +1,8 @@ package kamon.instrumentation import scala.concurrent.{Await, Promise, Future} -import org.scalatest.{OptionValues, WordSpec} -import org.scalatest.matchers.MustMatchers -import org.scalatest.concurrent.PatienceConfiguration +import org.scalatest.{Matchers, OptionValues, WordSpec} +import org.scalatest.concurrent.{ScalaFutures, PatienceConfiguration} import kamon.{Kamon, TraceContext} import java.util.UUID import scala.util.Success @@ -12,7 +11,7 @@ import java.util.concurrent.TimeUnit import akka.actor.ActorSystem -class RunnableInstrumentationSpec extends WordSpec with MustMatchers with ScalaFuturesSupport with PatienceConfiguration with OptionValues { +class RunnableInstrumentationSpec extends WordSpec with Matchers with ScalaFutures with PatienceConfiguration with OptionValues { "a instrumented runnable" when { "created in a thread that does have a TraceContext" must { @@ -20,7 +19,7 @@ class RunnableInstrumentationSpec extends WordSpec with MustMatchers with ScalaF "should be available during the run method execution" in { new FutureWithContextFixture { whenReady(futureWithContext) { result => - result.value must be === testContext + result.value should equal(testContext) } }} @@ -32,7 +31,7 @@ class RunnableInstrumentationSpec extends WordSpec with MustMatchers with ScalaF }) whenReady(onCompleteContext.future) { result => - result must be === testContext + result should equal(testContext) } }} } @@ -42,7 +41,7 @@ class RunnableInstrumentationSpec extends WordSpec with MustMatchers with ScalaF "not capture any TraceContext for the body execution" in { new FutureWithoutContextFixture{ whenReady(futureWithoutContext) { result => - result must be === None + result should equal(None) } }} @@ -54,7 +53,7 @@ class RunnableInstrumentationSpec extends WordSpec with MustMatchers with ScalaF }) whenReady(onCompleteContext.future) { result => - result must be === None + result should equal(None) } }} } diff --git a/src/test/scala/kamon/instrumentation/ScalaFuturesSupport.scala b/src/test/scala/kamon/instrumentation/ScalaFuturesSupport.scala deleted file mode 100644 index cc87a7c8..00000000 --- a/src/test/scala/kamon/instrumentation/ScalaFuturesSupport.scala +++ /dev/null @@ -1,32 +0,0 @@ -package kamon.instrumentation - -import scala.concurrent.{Await, Future} -import scala.concurrent.duration.Duration -import scala.util.{Failure, Success} -import org.scalatest.concurrent.Futures -import java.util.concurrent.TimeUnit - -trait ScalaFuturesSupport extends Futures { - implicit def scalaFutureToFutureConcept[T](future: Future[T]): FutureConcept[T] = new FutureConcept[T] { - def eitherValue: Option[Either[Throwable, T]] = { - if(!future.isCompleted) - None - else - future.value match { - case None => None - case Some(t) => t match { - case Success(v) => Some(Right(v)) - case Failure(e) => Some(Left(e)) - } - } - } - - def isExpired: Boolean = false // Scala futures cant expire - - def isCanceled: Boolean = false // Scala futures cannot be cancelled - - override def futureValue(implicit config: PatienceConfig): T = { - Await.result(future, Duration(config.timeout.totalNanos, TimeUnit.NANOSECONDS)) - } - } -} |