aboutsummaryrefslogtreecommitdiff
path: root/kamon-play
diff options
context:
space:
mode:
authorDiego <diegolparra@gmail.com>2014-03-15 11:21:44 -0300
committerDiego <diegolparra@gmail.com>2014-03-15 11:25:02 -0300
commitcc079f18a2c00678397fae0714eb524dfe8961f2 (patch)
tree24dd0dcc0c63b6aa4aa01b19c7dee524f25de0d4 /kamon-play
parent75a0a4303c313266d34efd5711fe62ed70ce79b3 (diff)
downloadKamon-cc079f18a2c00678397fae0714eb524dfe8961f2.tar.gz
Kamon-cc079f18a2c00678397fae0714eb524dfe8961f2.tar.bz2
Kamon-cc079f18a2c00678397fae0714eb524dfe8961f2.zip
implementation of IMessageHandler interface in order to control Aspectj weaving messages through kamon
Diffstat (limited to 'kamon-play')
-rw-r--r--kamon-play/src/main/resources/META-INF/aop.xml2
-rw-r--r--kamon-play/src/main/scala/kamon/play/Play.scala2
-rw-r--r--kamon-play/src/test/resources/META-INF/aop.xml2
-rw-r--r--kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala20
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)
}
})