aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/test
diff options
context:
space:
mode:
authorDiego <diegolparra@gmail.com>2016-03-06 00:50:43 -0300
committerDiego <diegolparra@gmail.com>2016-03-06 00:50:43 -0300
commitaa613bc7b1807d03172b13a9a969fd95a88ca091 (patch)
tree57b1f1fb88418b67cf6401b8ee8228233520ab15 /kamon-core/src/test
parentd280c2f66072be77c5accac7304119a71d4d8ff8 (diff)
downloadKamon-aa613bc7b1807d03172b13a9a969fd95a88ca091.tar.gz
Kamon-aa613bc7b1807d03172b13a9a969fd95a88ca091.tar.bz2
Kamon-aa613bc7b1807d03172b13a9a969fd95a88ca091.zip
= core: minor refactor in ExecutorServiceMetrics
Diffstat (limited to 'kamon-core/src/test')
-rw-r--r--kamon-core/src/test/scala/kamon/util/executors/ExecutorServiceMetricsSpec.scala46
1 files changed, 22 insertions, 24 deletions
diff --git a/kamon-core/src/test/scala/kamon/util/executors/ExecutorServiceMetricsSpec.scala b/kamon-core/src/test/scala/kamon/util/executors/ExecutorServiceMetricsSpec.scala
index b3bc7623..4e5394f8 100644
--- a/kamon-core/src/test/scala/kamon/util/executors/ExecutorServiceMetricsSpec.scala
+++ b/kamon-core/src/test/scala/kamon/util/executors/ExecutorServiceMetricsSpec.scala
@@ -19,7 +19,7 @@ package kamon.util.executors
import java.util.concurrent.Executors
import kamon.Kamon
-import kamon.metric.EntityRecorder
+import kamon.metric.{Entity, EntityRecorder}
import kamon.testkit.BaseKamonSpec
class ExecutorServiceMetricsSpec extends BaseKamonSpec("executor-service-metrics-spec") {
@@ -27,51 +27,49 @@ class ExecutorServiceMetricsSpec extends BaseKamonSpec("executor-service-metrics
"the ExecutorServiceMetrics" should {
"register a SingleThreadPool, collect their metrics and remove it" in {
val singleThreadPoolExecutor = Executors.newSingleThreadExecutor()
- ExecutorServiceMetrics.register("single-thread-pool", singleThreadPoolExecutor)
- findExecutorRecorder("single-thread-pool") should not be empty
+ val singleThreadPoolExecutorEntity = ExecutorServiceMetrics.register("single-thread-pool", singleThreadPoolExecutor)
+ findExecutorRecorder(singleThreadPoolExecutorEntity) should not be empty
- ExecutorServiceMetrics.remove("single-thread-pool")
- findExecutorRecorder("single-thread-pool") should be(empty)
+ ExecutorServiceMetrics.remove(singleThreadPoolExecutorEntity)
+ findExecutorRecorder(singleThreadPoolExecutorEntity) should be(empty)
}
"register a ThreadPoolExecutor, collect their metrics and remove it" in {
val threadPoolExecutor = Executors.newCachedThreadPool()
- ExecutorServiceMetrics.register("thread-pool-executor", threadPoolExecutor)
- findExecutorRecorder("thread-pool-executor") should not be empty
+ val threadPoolExecutorEntity = ExecutorServiceMetrics.register("thread-pool-executor", threadPoolExecutor)
+ findExecutorRecorder(threadPoolExecutorEntity) should not be empty
- ExecutorServiceMetrics.remove("thread-pool-executor")
- findExecutorRecorder("thread-pool-executor") should be(empty)
+ ExecutorServiceMetrics.remove(threadPoolExecutorEntity)
+ findExecutorRecorder(threadPoolExecutorEntity) should be(empty)
}
"register a ScheduledThreadPoolExecutor, collect their metrics and remove it" in {
val scheduledThreadPoolExecutor = Executors.newSingleThreadScheduledExecutor()
- ExecutorServiceMetrics.register("scheduled-thread-pool-executor", scheduledThreadPoolExecutor)
- findExecutorRecorder("scheduled-thread-pool-executor") should not be empty
+ val scheduledThreadPoolEntity = ExecutorServiceMetrics.register("scheduled-thread-pool-executor", scheduledThreadPoolExecutor)
+ findExecutorRecorder(scheduledThreadPoolEntity) should not be empty
- ExecutorServiceMetrics.remove("scheduled-thread-pool-executor")
- findExecutorRecorder("scheduled-thread-pool-executor") should be(empty)
+ ExecutorServiceMetrics.remove(scheduledThreadPoolEntity)
+ findExecutorRecorder(scheduledThreadPoolEntity) should be(empty)
}
"register a Java ForkJoinPool, collect their metrics and remove it" in {
val javaForkJoinPool = Executors.newWorkStealingPool()
- ExecutorServiceMetrics.register("java-fork-join-pool", javaForkJoinPool)
- findExecutorRecorder("java-fork-join-pool") should not be empty
+ val javaForkJoinPoolEntity = ExecutorServiceMetrics.register("java-fork-join-pool", javaForkJoinPool)
+ findExecutorRecorder(javaForkJoinPoolEntity) should not be empty
- ExecutorServiceMetrics.remove("java-fork-join-pool")
- findExecutorRecorder("java-fork-join-pool") should be(empty)
+ ExecutorServiceMetrics.remove(javaForkJoinPoolEntity)
+ findExecutorRecorder(javaForkJoinPoolEntity) should be(empty)
}
"register a Scala ForkJoinPool, collect their metrics and remove it" in {
val scalaForkJoinPool = new scala.concurrent.forkjoin.ForkJoinPool()
- ExecutorServiceMetrics.register("scala-fork-join-pool", scalaForkJoinPool)
- findExecutorRecorder("scala-fork-join-pool") should not be empty
+ val scalaForkJoinPoolEntity = ExecutorServiceMetrics.register("scala-fork-join-pool", scalaForkJoinPool)
+ findExecutorRecorder(scalaForkJoinPoolEntity) should not be empty
- ExecutorServiceMetrics.remove("scala-fork-join-pool")
- findExecutorRecorder("scala-fork-join-pool") should be(empty)
+ ExecutorServiceMetrics.remove(scalaForkJoinPoolEntity)
+ findExecutorRecorder(scalaForkJoinPoolEntity) should be(empty)
}
- def findExecutorRecorder(name: String): Option[EntityRecorder] =
- Kamon.metrics.find(name, ExecutorServiceMetrics.Category, Map.empty)
+ def findExecutorRecorder(entity: Entity): Option[EntityRecorder] = Kamon.metrics.find(entity)
}
-
}