diff options
Diffstat (limited to 'kamon-play/src')
4 files changed, 18 insertions, 8 deletions
diff --git a/kamon-play/src/main/resources/META-INF/aop.xml b/kamon-play/src/main/resources/META-INF/aop.xml index 3c3cceed..ca499a33 100644 --- a/kamon-play/src/main/resources/META-INF/aop.xml +++ b/kamon-play/src/main/resources/META-INF/aop.xml @@ -6,7 +6,7 @@ <aspect name="kamon.play.instrumentation.WSInstrumentation"/> </aspects> - <weaver options="-verbose -showWeaveInfo"> + <weaver> <include within="play.api..*"/> </weaver> </aspectj> diff --git a/kamon-play/src/main/scala/kamon/play/Play.scala b/kamon-play/src/main/scala/kamon/play/Play.scala index 2e1f789f..d52de450 100644 --- a/kamon-play/src/main/scala/kamon/play/Play.scala +++ b/kamon-play/src/main/scala/kamon/play/Play.scala @@ -1,6 +1,6 @@ /* * ========================================================================================= - * Copyright © 2013 2014 the kamon project <http://kamon.io/> + * Copyright © 2013-2014 the kamon project <http://kamon.io/> * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at diff --git a/kamon-play/src/test/resources/META-INF/aop.xml b/kamon-play/src/test/resources/META-INF/aop.xml index 63cbe8a9..2888a31a 100644 --- a/kamon-play/src/test/resources/META-INF/aop.xml +++ b/kamon-play/src/test/resources/META-INF/aop.xml @@ -5,7 +5,7 @@ <aspect name="kamon.play.instrumentation.FakeRequestIntrumentation"/> </aspects> - <weaver options="-verbose -showWeaveInfo"> + <weaver> <include within="play.api..*"/> </weaver> </aspectj> diff --git a/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala b/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala index 3b8a5492..b321d123 100644 --- a/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala +++ b/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala @@ -25,8 +25,10 @@ import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner import play.api.test.FakeApplication import play.api.libs.ws.WS - import scala.util._ +import scala.concurrent.Await +import scala.concurrent.duration._ + @RunWith(classOf[JUnitRunner]) class WSInstrumentationSpec extends PlaySpecification { @@ -34,11 +36,19 @@ class WSInstrumentationSpec extends PlaySpecification { val appWithRoutes = FakeApplication(withRoutes = { case ("GET", "/async") ⇒ - Action.async { - WS.url("http://www.google.com").get().map { - response ⇒ - Ok(response.toString()) + Action { + val request = WS.url("http://maps.googleapis.com/maps/api/geocode/json?address=China&sensor=true").get() + + val future = request map { + response ⇒ (response.json \\ "location") } + + val result = Await.result(future, 10 seconds).asInstanceOf[List[play.api.libs.json.JsObject]] + + val latitude = (result(0) \\ "lat")(0).toString + val longitude = (result(0) \\ "lng")(0).toString + + Ok(latitude + " " + longitude) } }) |