Permalink
Browse files

Merge branch 'release/2.0.0-BETA16'

  • Loading branch information...
2 parents 7b64036 + 35e62ff commit 953a93b9b9e2da6259fb1f4afa0b38e0c6fa42b4 @codahale codahale committed Aug 23, 2011
Showing with 204 additions and 197 deletions.
  1. +6 −0 CHANGELOG.md
  2. +2 −1 CONTRIBUTORS.md
  3. +2 −2 README.md
  4. +1 −1 metrics-core/pom.xml
  5. +1 −1 metrics-core/src/main/java/com/yammer/metrics/core/VirtualMachineMetrics.java
  6. +6 −6 metrics-core/src/test/scala/com/yammer/metrics/core/tests/CounterMetricSpec.scala
  7. +1 −1 metrics-core/src/test/scala/com/yammer/metrics/core/tests/GaugeMetricSpec.scala
  8. +18 −18 metrics-core/src/test/scala/com/yammer/metrics/core/tests/HistogramMetricSpec.scala
  9. +3 −3 metrics-core/src/test/scala/com/yammer/metrics/core/tests/MeterMetricSpec.scala
  10. +33 −31 metrics-core/src/test/scala/com/yammer/metrics/core/tests/TimerMetricSpec.scala
  11. +48 −48 metrics-core/src/test/scala/com/yammer/metrics/stats/tests/EWMASpec.scala
  12. +9 −9 metrics-core/src/test/scala/com/yammer/metrics/stats/tests/ExponentiallyDecayingSampleSpec.scala
  13. +6 −6 metrics-core/src/test/scala/com/yammer/metrics/stats/tests/UniformSampleSpec.scala
  14. +1 −1 metrics-ehcache/pom.xml
  15. +1 −1 metrics-graphite/pom.xml
  16. +1 −1 metrics-guice/pom.xml
  17. +3 −3 metrics-guice/src/test/scala/com/yammer/metrics/guice/tests/GaugeSpec.scala
  18. +5 −5 metrics-guice/src/test/scala/com/yammer/metrics/guice/tests/MeteredSpec.scala
  19. +5 −5 metrics-guice/src/test/scala/com/yammer/metrics/guice/tests/TimedSpec.scala
  20. +1 −1 metrics-jetty/pom.xml
  21. +1 −1 metrics-log4j/pom.xml
  22. +1 −1 metrics-logback/pom.xml
  23. +36 −36 metrics-logback/src/test/scala/com/yammer/metrics/logback/LogbackInstrumentedAppenderSpec.scala
  24. +1 −1 metrics-scala_2.9.0-1/pom.xml
  25. +1 −1 metrics-scala_2.9.0-1/pom_2.8.1.xml
  26. +3 −4 metrics-scala_2.9.0-1/src/test/scala/com/yammer/metrics/tests/CounterSpec.scala
  27. +3 −4 metrics-scala_2.9.0-1/src/test/scala/com/yammer/metrics/tests/MeterSpec.scala
  28. +2 −2 metrics-scala_2.9.0-1/src/test/scala/com/yammer/metrics/tests/TimerSpec.scala
  29. +1 −1 metrics-servlet/pom.xml
  30. +2 −2 pom.xml
View
6 CHANGELOG.md
@@ -1,3 +1,9 @@
+v2.0.0-BETA16: Aug 23 2011
+==========================
+
+* Fixed a bug in GC monitoring.
+
+
v2.0.0-BETA15: Aug 15 2011
==========================
View
3 CONTRIBUTORS.md
@@ -2,8 +2,9 @@ Many Many Thanks To
===================
* Bruce Mitchener (@waywardmonkeys)
-* Gerolf Seitz (@seitz)
+* Ciamac Moallemi (@ciamac)
* Cliff Moon (@cliffmoon)
+* Gerolf Seitz (@seitz)
* James Casey (@jamesc)
* JD Maturen (@sku)
* John Ewart (@johnewart)
View
4 README.md
@@ -35,13 +35,13 @@ How To Use
<dependency>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-core</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</dependency>
<!-- if you want the Scala façade library -->
<dependency>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-scala_${scala.version}</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</dependency>
</dependencies>
```
View
2 metrics-core/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
2 metrics-core/src/main/java/com/yammer/metrics/core/VirtualMachineMetrics.java
@@ -151,7 +151,7 @@ public static long daemonThreadCount() {
public static Map<String, GarbageCollector> garbageCollectors() {
final Map<String, GarbageCollector> gcs = new HashMap<String, GarbageCollector>();
for (GarbageCollectorMXBean bean : getGarbageCollectorMXBeans()) {
- gcs.put(bean.getName(), new GarbageCollector(bean.getCollectionCount(), bean.getCollectionCount()));
+ gcs.put(bean.getName(), new GarbageCollector(bean.getCollectionCount(), bean.getCollectionTime()));
}
return gcs;
}
View
12 metrics-core/src/test/scala/com/yammer/metrics/core/tests/CounterMetricSpec.scala
@@ -9,38 +9,38 @@ class CounterMetricSpec extends Spec {
val counter = new CounterMetric
@test def `starts at zero` = {
- counter.count must beEqualTo(0)
+ counter.count.must(be(0))
}
@test def `increments by one` = {
counter.inc()
- counter.count must beEqualTo(1)
+ counter.count.must(be(1))
}
@test def `increments by an arbitrary delta` = {
counter.inc(3)
- counter.count must beEqualTo(3)
+ counter.count.must(be(3))
}
@test def `decrements by one` = {
counter.dec()
- counter.count must beEqualTo(-1)
+ counter.count.must(be(-1))
}
@test def `decrements by an arbitrary delta` = {
counter.dec(3)
- counter.count must beEqualTo(-3)
+ counter.count.must(be(-3))
}
@test def `is zero after being cleared` = {
counter.inc(3)
counter.clear()
- counter.count must beEqualTo(0)
+ counter.count.must(be(0))
}
}
}
View
2 metrics-core/src/test/scala/com/yammer/metrics/core/tests/GaugeMetricSpec.scala
@@ -12,7 +12,7 @@ class GaugeMetricSpec extends Spec {
}
@test def `return a value` = {
- metric.value() must beEqualTo("woo")
+ metric.value().must(be("woo"))
}
}
View
36 metrics-core/src/test/scala/com/yammer/metrics/core/tests/HistogramMetricSpec.scala
@@ -11,35 +11,35 @@ class HistogramMetricSpec extends Spec {
val histogram = new HistogramMetric(new UniformSample(100))
@test def `has a count of 0` = {
- histogram.count must beEqualTo(0)
+ histogram.count.must(be(0))
}
@test def `has a max of 0` = {
- histogram.max must beEqualTo(0)
+ histogram.max.must(be(0))
}
@test def `has a min of 0` = {
- histogram.min must beEqualTo(0)
+ histogram.min.must(be(0))
}
@test def `has a mean of 0` = {
- histogram.mean must beCloseTo(0.0, 0.0)
+ histogram.mean.must(be(approximately(0.0, 0.0)))
}
@test def `has a standard deviation of 0` = {
- histogram.stdDev must beCloseTo(0.0, 0.0)
+ histogram.stdDev.must(be(approximately(0.0, 0.0)))
}
@test def `calculates percentiles` = {
val percentiles = histogram.percentiles(0.5, 0.75, 0.99)
- percentiles(0) must beCloseTo(0.0, 0.01)
- percentiles(1) must beCloseTo(0.0, 0.01)
- percentiles(2) must beCloseTo(0.0, 0.01)
+ percentiles(0).must(be(approximately(0.0, 0.01)))
+ percentiles(1).must(be(approximately(0.0, 0.01)))
+ percentiles(2).must(be(approximately(0.0, 0.01)))
}
@test def `has no values` = {
- histogram.values.toList must beEmpty
+ histogram.values.toList.must(be(empty))
}
}
@@ -48,35 +48,35 @@ class HistogramMetricSpec extends Spec {
(1 to 10000).foreach(histogram.update)
@test def `has a count of 10000` = {
- histogram.count must beEqualTo(10000)
+ histogram.count.must(be(10000))
}
@test def `has a max value of 10000` = {
- histogram.max must beEqualTo(10000)
+ histogram.max.must(be(10000))
}
@test def `has a min value of 1` = {
- histogram.min must beEqualTo(1)
+ histogram.min.must(be(1))
}
@test def `has a mean value of 5000.5` = {
- histogram.mean must beCloseTo(5000.5, 0.01)
+ histogram.mean.must(be(approximately(5000.5, 0.01)))
}
@test def `has a standard deviation of X` = {
- histogram.stdDev must beCloseTo(2886.89, 0.1)
+ histogram.stdDev.must(be(approximately(2886.89, 0.1)))
}
@test def `calculates percentiles` = {
val percentiles = histogram.percentiles(0.5, 0.75, 0.99)
- percentiles(0) must beCloseTo(5000.5, 0.01)
- percentiles(1) must beCloseTo(7500.75, 0.01)
- percentiles(2) must beCloseTo(9900.99, 0.01)
+ percentiles(0).must(be(approximately(5000.5, 0.01)))
+ percentiles(1).must(be(approximately(7500.75, 0.01)))
+ percentiles(2).must(be(approximately(9900.99, 0.01)))
}
@test def `has 10000 values` = {
- histogram.values.toList must beEqualTo((1 to 10000).toList)
+ histogram.values.toList.must(be((1 to 10000).map { java.lang.Long.valueOf(_) }.toList))
}
}
View
6 metrics-core/src/test/scala/com/yammer/metrics/core/tests/MeterMetricSpec.scala
@@ -10,11 +10,11 @@ class MeterMetricSpec extends Spec {
val meter = MeterMetric.newMeter("thangs", TimeUnit.SECONDS)
@test def `has a count of zero` = {
- meter.count must beEqualTo(0)
+ meter.count.must(be(0))
}
@test def `has a mean rate of 0 events/sec` = {
- meter.meanRate must beEqualTo(0.0)
+ meter.meanRate.must(be(0.0))
}
}
@@ -23,7 +23,7 @@ class MeterMetricSpec extends Spec {
meter.mark(3)
@test def `has a count of three` = {
- meter.count must beEqualTo(3)
+ meter.count.must(be(3))
}
}
}
View
64 metrics-core/src/test/scala/com/yammer/metrics/core/tests/TimerMetricSpec.scala
@@ -11,60 +11,60 @@ class TimerMetricSpec extends Spec {
val timer = new TimerMetric(TimeUnit.MILLISECONDS, TimeUnit.SECONDS)
@test def `has a duration unit` = {
- timer.durationUnit must be(TimeUnit.MILLISECONDS)
+ timer.durationUnit.must(be(TimeUnit.MILLISECONDS))
}
@test def `has a rate unit` = {
- timer.rateUnit must be(TimeUnit.SECONDS)
+ timer.rateUnit.must(be(TimeUnit.SECONDS))
}
@test def `has a max of zero` = {
- timer.max must beCloseTo(0.0, 0.001)
+ timer.max.must(be(approximately(0.0, 0.001)))
}
@test def `has a min of zero` = {
- timer.min must beCloseTo(0.0, 0.001)
+ timer.min.must(be(approximately(0.0, 0.001)))
}
@test def `has a mean of zero` = {
- timer.mean must beCloseTo(0.0, 0.001)
+ timer.mean.must(be(approximately(0.0, 0.001)))
}
@test def `has a count of zero` = {
- timer.count must beEqualTo(0)
+ timer.count.must(be(0))
}
@test def `has a standard deviation of zero` = {
- timer.stdDev must beCloseTo(0.0, 0.001)
+ timer.stdDev.must(be(approximately(0.0, 0.001)))
}
@test def `has a median/p95/p98/p99/p999 of zero` = {
val Array(median, p95, p98, p99, p999) = timer.percentiles(0.5, 0.95, 0.98, 0.99, 0.999)
- median must beCloseTo(0.0, 0.001)
- p95 must beCloseTo(0.0, 0.001)
- p98 must beCloseTo(0.0, 0.001)
- p99 must beCloseTo(0.0, 0.001)
- p999 must beCloseTo(0.0, 0.001)
+ median.must(be(approximately(0.0, 0.001)))
+ p95.must(be(approximately(0.0, 0.001)))
+ p98.must(be(approximately(0.0, 0.001)))
+ p99.must(be(approximately(0.0, 0.001)))
+ p999.must(be(approximately(0.0, 0.001)))
}
@test def `has a mean rate of zero` = {
- timer.meanRate must beCloseTo(0.0, 0.001)
+ timer.meanRate.must(be(approximately(0.0, 0.001)))
}
@test def `has a one-minute rate of zero` = {
- timer.oneMinuteRate must beCloseTo(0.0, 0.001)
+ timer.oneMinuteRate.must(be(approximately(0.0, 0.001)))
}
@test def `has a five-minute rate of zero` = {
- timer.fiveMinuteRate must beCloseTo(0.0, 0.001)
+ timer.fiveMinuteRate.must(be(approximately(0.0, 0.001)))
}
@test def `has a fifteen-minute rate of zero` = {
- timer.fifteenMinuteRate must beCloseTo(0.0, 0.001)
+ timer.fifteenMinuteRate.must(be(approximately(0.0, 0.001)))
}
@test def `has no values` = {
- timer.values.toList must beEmpty
+ timer.values.toList.must(be(empty))
}
}
@@ -77,36 +77,36 @@ class TimerMetricSpec extends Spec {
timer.update(40, TimeUnit.MILLISECONDS)
@test def `records the count` = {
- timer.count must beEqualTo(5)
+ timer.count.must(be(5))
}
@test def `calculates the minimum duration` = {
- timer.min must beCloseTo(10.0, 0.001)
+ timer.min.must(be(approximately(10.0, 0.001)))
}
@test def `calculates the maximum duration` = {
- timer.max must beCloseTo(40.0, 0.001)
+ timer.max.must(be(approximately(40.0, 0.001)))
}
@test def `calculates the mean duration` = {
- timer.mean must beCloseTo(24.0, 0.001)
+ timer.mean.must(be(approximately(24.0, 0.001)))
}
@test def `calculates the standard deviation` = {
- timer.stdDev must beCloseTo(11.401, 0.001)
+ timer.stdDev.must(be(approximately(11.401, 0.001)))
}
@test def `calculates the median/p95/p98/p99/p999` = {
val Array(median, p95, p98, p99, p999) = timer.percentiles(0.5, 0.95, 0.98, 0.99, 0.999)
- median must beCloseTo(20.0, 0.001)
- p95 must beCloseTo(40.0, 0.001)
- p98 must beCloseTo(40.0, 0.001)
- p99 must beCloseTo(40.0, 0.001)
- p999 must beCloseTo(40.0, 0.001)
+ median.must(be(approximately(20.0, 0.001)))
+ p95.must(be(approximately(40.0, 0.001)))
+ p98.must(be(approximately(40.0, 0.001)))
+ p99.must(be(approximately(40.0, 0.001)))
+ p999.must(be(approximately(40.0, 0.001)))
}
@test def `has a series of values` = {
- timer.values.toSet must beEqualTo(Set(10, 20, 20, 30, 40))
+ timer.values.toSet.must(be(Set[java.lang.Double](10, 20, 20, 30, 40)))
}
}
@@ -116,23 +116,25 @@ class TimerMetricSpec extends Spec {
timer.update(0, TimeUnit.NANOSECONDS)
@test def `calculates the standard deviation without overflowing` = {
- timer.stdDev must beCloseTo(75485.05, 0.01)
+ timer.stdDev.must(be(approximately(75485.05, 0.01)))
}
}
class `Timing Callable instances` {
val timer = new TimerMetric(TimeUnit.MILLISECONDS, TimeUnit.SECONDS)
@test def `records the duration of the Callable#call()` = {
- time must eventually(beCloseTo(50.0, 2))
+ eventually {
+ time
+ }.must(be(approximately(50.0, 2)))
}
@test def `returns the result of the callable` = {
timer.time(new Callable[String] {
def call = {
"woo"
}
- }) must beEqualTo("woo")
+ }).must(be("woo"))
}
private def time = {
View
96 metrics-core/src/test/scala/com/yammer/metrics/stats/tests/EWMASpec.scala
@@ -18,82 +18,82 @@ class EWMASpec extends Spec {
ewma.tick()
@test def `has a rate of 0.6 events/sec after the first tick` = {
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.6, 0.000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.6, 0.000001)))
}
@test def `has a rate of 0.22072766 events/sec after 1 minute` = {
markMinutes(1)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.22072766, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.22072766, 0.00000001)))
}
@test def `has a rate of 0.08120117 events/sec after 2 minutes` = {
markMinutes(2)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.08120117, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.08120117, 0.00000001)))
}
@test def `has a rate of 0.02987224 events/sec after 3 minutes` = {
markMinutes(3)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.02987224, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.02987224, 0.00000001)))
}
@test def `has a rate of 0.01098938 events/sec after 4 minutes` = {
markMinutes(4)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.01098938, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.01098938, 0.00000001)))
}
@test def `has a rate of 0.00404277 events/sec after 5 minutes` = {
markMinutes(5)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00404277, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00404277, 0.00000001)))
}
@test def `has a rate of 0.00148725 events/sec after 6 minutes` = {
markMinutes(6)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00148725, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00148725, 0.00000001)))
}
@test def `has a rate of 0.00054713 events/sec after 7 minutes` = {
markMinutes(7)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00054713, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00054713, 0.00000001)))
}
@test def `has a rate of 0.00020128 events/sec after 8 minutes` = {
markMinutes(8)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00020128, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00020128, 0.00000001)))
}
@test def `has a rate of 0.00007405 events/sec after 9 minutes` = {
markMinutes(9)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00007405, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00007405, 0.00000001)))
}
@test def `has a rate of 0.00002724 events/sec after 10 minutes` = {
markMinutes(10)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00002724, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00002724, 0.00000001)))
}
@test def `has a rate of 0.00001002 events/sec after 11 minutes` = {
markMinutes(11)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00001002, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00001002, 0.00000001)))
}
@test def `has a rate of 0.00000369 events/sec after 12 minutes` = {
markMinutes(12)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00000369, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00000369, 0.00000001)))
}
@test def `has a rate of 0.00000136 events/sec after 13 minutes` = {
markMinutes(13)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00000136, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00000136, 0.00000001)))
}
@test def `has a rate of 0.00000050 events/sec after 14 minutes` = {
markMinutes(14)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00000050, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00000050, 0.00000001)))
}
@test def `has a rate of 0.00000018 events/sec after 15 minutes` = {
markMinutes(15)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.00000018, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.00000018, 0.00000001)))
}
}
@@ -103,82 +103,82 @@ class EWMASpec extends Spec {
ewma.tick()
@test def `has a rate of 0.6 events/sec after the first tick` = {
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.6, 0.000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.6, 0.000001)))
}
@test def `has a rate of 0.49123845 events/sec after 1 minute` = {
markMinutes(1)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.49123845, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.49123845, 0.00000001)))
}
@test def `has a rate of 0.40219203 events/sec after 2 minutes` = {
markMinutes(2)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.40219203, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.40219203, 0.00000001)))
}
@test def `has a rate of 0.32928698 events/sec after 3 minutes` = {
markMinutes(3)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.32928698, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.32928698, 0.00000001)))
}
@test def `has a rate of 0.26959738 events/sec after 4 minutes` = {
markMinutes(4)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.26959738, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.26959738, 0.00000001)))
}
@test def `has a rate of 0.22072766 events/sec after 5 minutes` = {
markMinutes(5)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.22072766, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.22072766, 0.00000001)))
}
@test def `has a rate of 0.18071653 events/sec after 6 minutes` = {
markMinutes(6)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.18071653, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.18071653, 0.00000001)))
}
@test def `has a rate of 0.14795818 events/sec after 7 minutes` = {
markMinutes(7)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.14795818, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.14795818, 0.00000001)))
}
@test def `has a rate of 0.12113791 events/sec after 8 minutes` = {
markMinutes(8)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.12113791, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.12113791, 0.00000001)))
}
@test def `has a rate of 0.09917933 events/sec after 9 minutes` = {
markMinutes(9)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.09917933, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.09917933, 0.00000001)))
}
@test def `has a rate of 0.08120117 events/sec after 10 minutes` = {
markMinutes(10)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.08120117, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.08120117, 0.00000001)))
}
@test def `has a rate of 0.06648190 events/sec after 11 minutes` = {
markMinutes(11)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.06648190, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.06648190, 0.00000001)))
}
@test def `has a rate of 0.05443077 events/sec after 12 minutes` = {
markMinutes(12)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.05443077, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.05443077, 0.00000001)))
}
@test def `has a rate of 0.04456415 events/sec after 13 minutes` = {
markMinutes(13)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.04456415, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.04456415, 0.00000001)))
}
@test def `has a rate of 0.03648604 events/sec after 14 minutes` = {
markMinutes(14)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.03648604, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.03648604, 0.00000001)))
}
@test def `has a rate of 0.02987224 events/sec after 15 minutes` = {
markMinutes(15)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.02987224, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.02987224, 0.00000001)))
}
}
@@ -188,82 +188,82 @@ class EWMASpec extends Spec {
ewma.tick()
@test def `has a rate of 0.6 events/sec after the first tick` = {
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.6, 0.000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.6, 0.000001)))
}
@test def `has a rate of 0.56130419 events/sec after 1 minute` = {
markMinutes(1)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.56130419, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.56130419, 0.00000001)))
}
@test def `has a rate of 0.52510399 events/sec after 2 minutes` = {
markMinutes(2)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.52510399, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.52510399, 0.00000001)))
}
@test def `has a rate of 0.49123845 events/sec after 3 minutes` = {
markMinutes(3)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.49123845, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.49123845, 0.00000001)))
}
@test def `has a rate of 0.45955700 events/sec after 4 minutes` = {
markMinutes(4)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.45955700, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.45955700, 0.00000001)))
}
@test def `has a rate of 0.42991879 events/sec after 5 minutes` = {
markMinutes(5)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.42991879, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.42991879, 0.00000001)))
}
@test def `has a rate of 0.40219203 events/sec after 6 minutes` = {
markMinutes(6)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.40219203, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.40219203, 0.00000001)))
}
@test def `has a rate of 0.37625345 events/sec after 7 minutes` = {
markMinutes(7)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.37625345, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.37625345, 0.00000001)))
}
@test def `has a rate of 0.35198773 events/sec after 8 minutes` = {
markMinutes(8)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.35198773, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.35198773, 0.00000001)))
}
@test def `has a rate of 0.32928698 events/sec after 9 minutes` = {
markMinutes(9)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.32928698, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.32928698, 0.00000001)))
}
@test def `has a rate of 0.30805027 events/sec after 10 minutes` = {
markMinutes(10)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.30805027, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.30805027, 0.00000001)))
}
@test def `has a rate of 0.28818318 events/sec after 11 minutes` = {
markMinutes(11)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.28818318, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.28818318, 0.00000001)))
}
@test def `has a rate of 0.26959738 events/sec after 12 minutes` = {
markMinutes(12)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.26959738, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.26959738, 0.00000001)))
}
@test def `has a rate of 0.25221023 events/sec after 13 minutes` = {
markMinutes(13)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.25221023, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.25221023, 0.00000001)))
}
@test def `has a rate of 0.23594443 events/sec after 14 minutes` = {
markMinutes(14)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.23594443, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.23594443, 0.00000001)))
}
@test def `has a rate of 0.22072766 events/sec after 15 minutes` = {
markMinutes(15)
- ewma.rate(TimeUnit.SECONDS) must beCloseTo(0.22072766, 0.00000001)
+ ewma.rate(TimeUnit.SECONDS).must(be(approximately(0.22072766, 0.00000001)))
}
}
}
View
18 ...-core/src/test/scala/com/yammer/metrics/stats/tests/ExponentiallyDecayingSampleSpec.scala
@@ -11,12 +11,12 @@ class ExponentiallyDecayingSampleSpec extends Spec {
population.foreach { i => sample.update(i.asInstanceOf[Long]) }
def `should have 100 elements` = {
- sample.size must beEqualTo(100)
- sample.values.toList must haveSize(100)
+ sample.size.must(be(100))
+ sample.values.toList.must(haveSize(100))
}
def `should only have elements from the population` = {
- (sample.values().toSet -- population.toSet) must beEmpty
+ (sample.values().toSet -- population.toSet).must(be(empty))
}
}
@@ -26,12 +26,12 @@ class ExponentiallyDecayingSampleSpec extends Spec {
population.foreach { i => sample.update(i.asInstanceOf[Long]) }
def `should have 10 elements` = {
- sample.size must beEqualTo(10)
- sample.values.toList must haveSize(10)
+ sample.size.must(be(10))
+ sample.values.toList.must(haveSize(100))
}
def `should only have elements from the population` = {
- (sample.values().toSet -- population.toSet) must beEmpty
+ (sample.values().toSet -- population.toSet).must(be(empty))
}
}
@@ -41,12 +41,12 @@ class ExponentiallyDecayingSampleSpec extends Spec {
population.foreach { i => sample.update(i.asInstanceOf[Long]) }
def `should have 100 elements` = {
- sample.size must beEqualTo(100)
- sample.values.toList must haveSize(100)
+ sample.size.must(be(100))
+ sample.values.toList.must(haveSize(100))
}
def `should only have elements from the population` = {
- (sample.values().toSet -- population.toSet) must beEmpty
+ (sample.values().toSet -- population.toSet).must(be(empty))
}
}
}
View
12 metrics-core/src/test/scala/com/yammer/metrics/stats/tests/UniformSampleSpec.scala
@@ -12,12 +12,12 @@ class UniformSampleSpec extends Spec {
population.foreach { i => sample.update(i.asInstanceOf[Long]) }
@test def `has 100 elements` = {
- sample.size must beEqualTo(100)
- sample.values.toList must haveSize(100)
+ sample.size.must(be(100))
+ sample.values.toList.must(haveSize(100))
}
@test def `only has elements from the population` = {
- (sample.values().toSet -- population.toSet) must beEmpty
+ (sample.values().toSet -- population.toSet).must(be(empty))
}
}
@@ -27,12 +27,12 @@ class UniformSampleSpec extends Spec {
population.foreach { i => sample.update(i.asInstanceOf[Long]) }
@test def `has 10 elements` = {
- sample.size must beEqualTo(10)
- sample.values.toList must haveSize(10)
+ sample.size.must(be(10))
+ sample.values.toList.must(haveSize(10))
}
@test def `only has elements from the population` = {
- (sample.values().toSet -- population.toSet) must beEmpty
+ (sample.values().toSet -- population.toSet).must(be(empty))
}
}
}
View
2 metrics-ehcache/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
2 metrics-graphite/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
2 metrics-guice/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
6 metrics-guice/src/test/scala/com/yammer/metrics/guice/tests/GaugeSpec.scala
@@ -22,9 +22,9 @@ class GaugeSpec extends Spec {
val gauge = registry.allMetrics.get(new MetricName(classOf[InstrumentedWithGauge], "things"))
- gauge must not(beNull)
- gauge.isInstanceOf[GaugeMetric[_]] must beTrue
- gauge.asInstanceOf[GaugeMetric[String]].value must beEqualTo("poop")
+ gauge.must(be(notNull))
+ gauge.must(beA[GaugeMetric[String]])
+ gauge.asInstanceOf[GaugeMetric[String]].value.must(be("poop"))
}
}
}
View
10 metrics-guice/src/test/scala/com/yammer/metrics/guice/tests/MeteredSpec.scala
@@ -25,11 +25,11 @@ class MeteredSpec extends Spec {
val meter = registry.allMetrics.get(new MetricName(classOf[InstrumentedWithMetered], "things"))
- meter must not(beNull)
- meter.isInstanceOf[MeterMetric] must beTrue
- meter.asInstanceOf[MeterMetric].count must beEqualTo(1)
- meter.asInstanceOf[MeterMetric].eventType must beEqualTo("poops")
- meter.asInstanceOf[MeterMetric].rateUnit must beEqualTo(TimeUnit.MINUTES)
+ meter.must(be(notNull))
+ meter.must(beA[MeterMetric])
+ meter.asInstanceOf[MeterMetric].count.must(be(1))
+ meter.asInstanceOf[MeterMetric].eventType.must(be("poops"))
+ meter.asInstanceOf[MeterMetric].rateUnit.must(be(TimeUnit.MINUTES))
}
}
}
View
10 metrics-guice/src/test/scala/com/yammer/metrics/guice/tests/TimedSpec.scala
@@ -25,11 +25,11 @@ class TimedSpec extends Spec {
val timer = registry.allMetrics.get(new MetricName(classOf[InstrumentedWithTimed], "things"))
- timer must not(beNull)
- timer.isInstanceOf[TimerMetric] must beTrue
- timer.asInstanceOf[TimerMetric].count must beEqualTo(1)
- timer.asInstanceOf[TimerMetric].rateUnit must beEqualTo(TimeUnit.MINUTES)
- timer.asInstanceOf[TimerMetric].durationUnit must beEqualTo(TimeUnit.MICROSECONDS)
+ timer.must(be(notNull))
+ timer.must(beA[TimerMetric])
+ timer.asInstanceOf[TimerMetric].count.must(be(1))
+ timer.asInstanceOf[TimerMetric].rateUnit.must(be(TimeUnit.MINUTES))
+ timer.asInstanceOf[TimerMetric].durationUnit.must(be(TimeUnit.MICROSECONDS))
}
}
}
View
2 metrics-jetty/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
2 metrics-log4j/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
2 metrics-logback/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
72 ...s-logback/src/test/scala/com/yammer/metrics/logback/LogbackInstrumentedAppenderSpec.scala
@@ -16,58 +16,58 @@ class LogbackInstrumentedAppenderSpec extends Spec {
logger.setLevel(Level.TRACE)
@test def `maintains accurate counts` = {
- InstrumentedAppender.ALL_METER.count must beEqualTo(0)
- InstrumentedAppender.TRACE_METER.count must beEqualTo(0)
- InstrumentedAppender.DEBUG_METER.count must beEqualTo(0)
- InstrumentedAppender.INFO_METER.count must beEqualTo(0)
- InstrumentedAppender.WARN_METER.count must beEqualTo(0)
- InstrumentedAppender.ERROR_METER.count must beEqualTo(0)
+ InstrumentedAppender.ALL_METER.count.must(be(0))
+ InstrumentedAppender.TRACE_METER.count.must(be(0))
+ InstrumentedAppender.DEBUG_METER.count.must(be(0))
+ InstrumentedAppender.INFO_METER.count.must(be(0))
+ InstrumentedAppender.WARN_METER.count.must(be(0))
+ InstrumentedAppender.ERROR_METER.count.must(be(0))
logger.trace("Test")
- InstrumentedAppender.ALL_METER.count must beEqualTo(1)
- InstrumentedAppender.TRACE_METER.count must beEqualTo(1)
- InstrumentedAppender.DEBUG_METER.count must beEqualTo(0)
- InstrumentedAppender.INFO_METER.count must beEqualTo(0)
- InstrumentedAppender.WARN_METER.count must beEqualTo(0)
- InstrumentedAppender.ERROR_METER.count must beEqualTo(0)
+ InstrumentedAppender.ALL_METER.count.must(be(1))
+ InstrumentedAppender.TRACE_METER.count.must(be(1))
+ InstrumentedAppender.DEBUG_METER.count.must(be(0))
+ InstrumentedAppender.INFO_METER.count.must(be(0))
+ InstrumentedAppender.WARN_METER.count.must(be(0))
+ InstrumentedAppender.ERROR_METER.count.must(be(0))
logger.trace("Test")
logger.debug("Test")
- InstrumentedAppender.ALL_METER.count must beEqualTo(3)
- InstrumentedAppender.TRACE_METER.count must beEqualTo(2)
- InstrumentedAppender.DEBUG_METER.count must beEqualTo(1)
- InstrumentedAppender.INFO_METER.count must beEqualTo(0)
- InstrumentedAppender.WARN_METER.count must beEqualTo(0)
- InstrumentedAppender.ERROR_METER.count must beEqualTo(0)
+ InstrumentedAppender.ALL_METER.count.must(be(3))
+ InstrumentedAppender.TRACE_METER.count.must(be(2))
+ InstrumentedAppender.DEBUG_METER.count.must(be(1))
+ InstrumentedAppender.INFO_METER.count.must(be(0))
+ InstrumentedAppender.WARN_METER.count.must(be(0))
+ InstrumentedAppender.ERROR_METER.count.must(be(0))
logger.info("Test")
- InstrumentedAppender.ALL_METER.count must beEqualTo(4)
- InstrumentedAppender.TRACE_METER.count must beEqualTo(2)
- InstrumentedAppender.DEBUG_METER.count must beEqualTo(1)
- InstrumentedAppender.INFO_METER.count must beEqualTo(1)
- InstrumentedAppender.WARN_METER.count must beEqualTo(0)
- InstrumentedAppender.ERROR_METER.count must beEqualTo(0)
+ InstrumentedAppender.ALL_METER.count.must(be(4))
+ InstrumentedAppender.TRACE_METER.count.must(be(2))
+ InstrumentedAppender.DEBUG_METER.count.must(be(1))
+ InstrumentedAppender.INFO_METER.count.must(be(1))
+ InstrumentedAppender.WARN_METER.count.must(be(0))
+ InstrumentedAppender.ERROR_METER.count.must(be(0))
logger.warn("Test")
- InstrumentedAppender.ALL_METER.count must beEqualTo(5)
- InstrumentedAppender.TRACE_METER.count must beEqualTo(2)
- InstrumentedAppender.DEBUG_METER.count must beEqualTo(1)
- InstrumentedAppender.INFO_METER.count must beEqualTo(1)
- InstrumentedAppender.WARN_METER.count must beEqualTo(1)
- InstrumentedAppender.ERROR_METER.count must beEqualTo(0)
+ InstrumentedAppender.ALL_METER.count.must(be(5))
+ InstrumentedAppender.TRACE_METER.count.must(be(2))
+ InstrumentedAppender.DEBUG_METER.count.must(be(1))
+ InstrumentedAppender.INFO_METER.count.must(be(1))
+ InstrumentedAppender.WARN_METER.count.must(be(1))
+ InstrumentedAppender.ERROR_METER.count.must(be(0))
logger.error("Test")
- InstrumentedAppender.ALL_METER.count must beEqualTo(6)
- InstrumentedAppender.TRACE_METER.count must beEqualTo(2)
- InstrumentedAppender.DEBUG_METER.count must beEqualTo(1)
- InstrumentedAppender.INFO_METER.count must beEqualTo(1)
- InstrumentedAppender.WARN_METER.count must beEqualTo(1)
- InstrumentedAppender.ERROR_METER.count must beEqualTo(1)
+ InstrumentedAppender.ALL_METER.count.must(be(6))
+ InstrumentedAppender.TRACE_METER.count.must(be(2))
+ InstrumentedAppender.DEBUG_METER.count.must(be(1))
+ InstrumentedAppender.INFO_METER.count.must(be(1))
+ InstrumentedAppender.WARN_METER.count.must(be(1))
+ InstrumentedAppender.ERROR_METER.count.must(be(1))
}
}
}
View
2 metrics-scala_2.9.0-1/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
2 metrics-scala_2.9.0-1/pom_2.8.1.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
7 metrics-scala_2.9.0-1/src/test/scala/com/yammer/metrics/tests/CounterSpec.scala
@@ -4,23 +4,22 @@ import com.codahale.simplespec.Spec
import com.codahale.simplespec.annotation.test
import com.yammer.metrics.Counter
import com.yammer.metrics.core.CounterMetric
-import org.specs2.mock.Mockito
-class CounterSpec extends Spec with Mockito {
+class CounterSpec extends Spec {
class `A counter` {
val metric = mock[CounterMetric]
val counter = new Counter(metric)
@test def `increments the underlying metric by an arbitrary amount` = {
counter += 12
- there was one(metric).inc(12)
+ verify.one(metric).inc(12)
}
@test def `decrements the underlying metric by an arbitrary amount` = {
counter -= 12
- there was one(metric).dec(12)
+ verify.one(metric).dec(12)
}
}
}
View
7 metrics-scala_2.9.0-1/src/test/scala/com/yammer/metrics/tests/MeterSpec.scala
@@ -4,23 +4,22 @@ import com.codahale.simplespec.Spec
import com.codahale.simplespec.annotation.test
import com.yammer.metrics.core.MeterMetric
import com.yammer.metrics.Meter
-import org.specs2.mock.Mockito
-class MeterSpec extends Spec with Mockito {
+class MeterSpec extends Spec {
class `A meter` {
val metric = mock[MeterMetric]
val meter = new Meter(metric)
@test def `marks the underlying metric` = {
meter.mark()
- there was one(metric).mark()
+ verify.one(metric).mark()
}
@test def `marks the underlying metric by an arbitrary amount` = {
meter.mark(12)
- there was one(metric).mark(12)
+ verify.one(metric).mark(12)
}
}
}
View
4 metrics-scala_2.9.0-1/src/test/scala/com/yammer/metrics/tests/TimerSpec.scala
@@ -13,9 +13,9 @@ class TimerSpec extends Spec {
val timer = new Timer(metric)
@test def `updates the underlying metric` = {
- timer.time { Thread.sleep(100); 10 } must beEqualTo(10)
+ timer.time { Thread.sleep(100); 10 }.must(be(10))
- metric.min must beCloseTo(100.0, 10)
+ metric.min().must(be(approximately(100.0, 10)))
}
}
}
View
2 metrics-servlet/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
</parent>
<groupId>com.yammer.metrics</groupId>
View
4 pom.xml
@@ -6,7 +6,7 @@
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-parent</artifactId>
- <version>2.0.0-BETA15</version>
+ <version>2.0.0-BETA16</version>
<packaging>pom</packaging>
<modules>
@@ -81,7 +81,7 @@
<dependency>
<groupId>com.codahale</groupId>
<artifactId>simplespec_${scala.version}</artifactId>
- <version>0.4.0</version>
+ <version>0.5.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>

0 comments on commit 953a93b

Please sign in to comment.