aboutsummaryrefslogtreecommitdiffstats
path: root/testutil/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-09-07 13:39:35 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-09-07 13:39:35 +0200
commitf88ef98207d9fe5656f884daea4391df7467df67 (patch)
treed0f23c0ac943b9191d0cd0d3480bea18bd2e9f74 /testutil/src
parent2437d95bb73048bd03bed341ce0c2be5b169254b (diff)
Add test of local redepoyment after validation override expiry
Diffstat (limited to 'testutil/src')
-rw-r--r--testutil/src/main/java/com/yahoo/test/ManualClock.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/testutil/src/main/java/com/yahoo/test/ManualClock.java b/testutil/src/main/java/com/yahoo/test/ManualClock.java
index b8325b3e3fc..1ffc7aa77da 100644
--- a/testutil/src/main/java/com/yahoo/test/ManualClock.java
+++ b/testutil/src/main/java/com/yahoo/test/ManualClock.java
@@ -3,7 +3,10 @@ package com.yahoo.test;
import java.time.Clock;
import java.time.Instant;
+import java.time.LocalDateTime;
import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAmount;
/** A clock which initially has the time of its creation but can only be advanced by calling advance */
@@ -13,6 +16,10 @@ public class ManualClock extends Clock {
public ManualClock() {}
+ public ManualClock(String utcIsoTime) {
+ this(at(utcIsoTime));
+ }
+
public ManualClock(Instant currentTime) {
this.currentTime = currentTime;
}
@@ -33,4 +40,8 @@ public class ManualClock extends Clock {
@Override
public long millis() { return currentTime.toEpochMilli(); }
+ public static Instant at(String utcIsoTime) {
+ return LocalDateTime.parse(utcIsoTime, DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneOffset.UTC).toInstant();
+ }
+
}