diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-14 09:37:53 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-14 09:37:53 +0200 |
commit | 782962c90a4e52eda6666de98881871bb8ef7879 (patch) | |
tree | d2cce2aeea938224b557df2d4781144b81ebb3c7 /vespaclient-java | |
parent | bb54881376421e09daa8287173e06458b0c1f45a (diff) |
Simplify and unify the use of Timers.
Diffstat (limited to 'vespaclient-java')
-rw-r--r-- | vespaclient-java/src/test/java/com/yahoo/vespafeeder/BenchmarkProgressPrinterTest.java | 17 | ||||
-rw-r--r-- | vespaclient-java/src/test/java/com/yahoo/vespafeeder/ProgressPrinterTest.java | 17 |
2 files changed, 10 insertions, 24 deletions
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/BenchmarkProgressPrinterTest.java b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/BenchmarkProgressPrinterTest.java index 7268e892c7d..6eba29fe9cb 100644 --- a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/BenchmarkProgressPrinterTest.java +++ b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/BenchmarkProgressPrinterTest.java @@ -2,7 +2,7 @@ package com.yahoo.vespafeeder; import com.yahoo.clientmetrics.RouteMetricSet; -import com.yahoo.concurrent.Timer; +import com.yahoo.concurrent.ManualTimer; import com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage; import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage; import com.yahoo.messagebus.EmptyReply; @@ -15,17 +15,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class BenchmarkProgressPrinterTest { - class DummyTimer implements Timer { - long ms; - - public long milliTime() { return ms; } - } - @Test void testSimple() { ByteArrayOutputStream output = new ByteArrayOutputStream(); - DummyTimer timer = new DummyTimer(); - timer.ms = 0; + ManualTimer timer = new ManualTimer(); BenchmarkProgressPrinter printer = new BenchmarkProgressPrinter(timer, new PrintStream(output)); RouteMetricSet metrics = new RouteMetricSet("foobar", printer); @@ -35,7 +28,7 @@ public class BenchmarkProgressPrinterTest { metrics.addReply(reply); } - timer.ms = 1200; + timer.set(1200); { EmptyReply reply = new EmptyReply(); @@ -49,7 +42,7 @@ public class BenchmarkProgressPrinterTest { metrics.addReply(reply); } - timer.ms = 2400; + timer.set(2400); { EmptyReply reply = new EmptyReply(); @@ -58,7 +51,7 @@ public class BenchmarkProgressPrinterTest { metrics.addReply(reply); } - timer.ms = 62000; + timer.set(62000); { EmptyReply reply = new EmptyReply(); diff --git a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/ProgressPrinterTest.java b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/ProgressPrinterTest.java index 495367ff4c3..2307e27b161 100644 --- a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/ProgressPrinterTest.java +++ b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/ProgressPrinterTest.java @@ -2,7 +2,7 @@ package com.yahoo.vespafeeder; import com.yahoo.clientmetrics.RouteMetricSet; -import com.yahoo.concurrent.Timer; +import com.yahoo.concurrent.ManualTimer; import com.yahoo.documentapi.messagebus.protocol.DocumentIgnoredReply; import com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage; import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage; @@ -16,17 +16,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class ProgressPrinterTest { - class DummyTimer implements Timer { - long ms; - - public long milliTime() { return ms; } - } - @Test void testSimple() { ByteArrayOutputStream output = new ByteArrayOutputStream(); - DummyTimer timer = new DummyTimer(); - timer.ms = 0; + ManualTimer timer = new ManualTimer(); ProgressPrinter printer = new ProgressPrinter(timer, new PrintStream(output)); RouteMetricSet metrics = new RouteMetricSet("foobar", printer); @@ -36,7 +29,7 @@ public class ProgressPrinterTest { metrics.addReply(reply); } - timer.ms = 1200; + timer.set(1200); { EmptyReply reply = new EmptyReply(); @@ -50,7 +43,7 @@ public class ProgressPrinterTest { metrics.addReply(reply); } - timer.ms = 2400; + timer.set(2400); { DocumentIgnoredReply reply = new DocumentIgnoredReply(); @@ -65,7 +58,7 @@ public class ProgressPrinterTest { metrics.addReply(reply); } - timer.ms = 62000; + timer.set(62000); { EmptyReply reply = new EmptyReply(); |