From b7dda5ff2d09675918223550f88efe4d4b4ebe5a Mon Sep 17 00:00:00 2001 From: jonmv Date: Sat, 16 Apr 2022 14:58:22 +0200 Subject: Serialise JobType with zone+test, and eliminate last == usages --- .../hosted/controller/api/integration/deployment/JobId.java | 2 +- .../controller/api/integration/deployment/JobType.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'controller-api') diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java index 846f3784657..0ef9807270e 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java @@ -29,7 +29,7 @@ public class JobId { if (o == null || getClass() != o.getClass()) return false; JobId jobId = (JobId) o; return application.equals(jobId.application) && - type == jobId.type; + type.equals(jobId.type); } @Override diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java index e9231f80091..c435ae37c40 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java @@ -255,10 +255,12 @@ public final class JobType implements Comparable { return zones.get(system); } + /** A system test in a test zone, or throws if no test zones are present.. */ public static JobType systemTest(ZoneRegistry zones) { return testIn(test, zones); } + /** A staging test in a staging zone, or throws if no staging zones are present. */ public static JobType stagingTest(ZoneRegistry zones){ return testIn(staging, zones); } @@ -268,18 +270,22 @@ public final class JobType implements Comparable { .findFirst().orElseThrow(() -> new IllegalArgumentException("no zones in " + environment + " among " + zones.zones().controllerUpgraded().zones())); } + /** A deployment to the given dev region. */ public static JobType dev(String region) { return deploymentTo(ZoneId.from("dev", region)); } + /** A deployment to the given perf region. */ public static JobType perf(String region) { return deploymentTo(ZoneId.from("perf", region)); } + /** A deployment to the given prod region. */ public static JobType prod(String region) { return deploymentTo(ZoneId.from("prod", region)); } + /** A production test in the given region. */ public static JobType test(String region) { return productionTestOf(ZoneId.from("prod", region)); } @@ -311,10 +317,9 @@ public final class JobType implements Comparable { throw new IllegalArgumentException("illegal serialized job type '" + raw + "'"); } - // TODO jonmv: use for serialisation - public String serialized() { - throw new UnsupportedOperationException(); - // return zone.environment().value() + "." + zone.region().value() + (isProductionTest ? ".test"); + public String serialized(SystemName system) { + ZoneId zone = zone(system); + return zone.environment().value() + "." + zone.region().value() + (isProductionTest ? ".test" : ""); } public static List allIn(ZoneRegistry zones) { -- cgit v1.2.3