diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-11-09 10:06:31 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-11-09 10:06:49 +0100 |
commit | c7157de0668b562ed75ce1fd9dc6ce12ea512472 (patch) | |
tree | 0a016416196ca9bffa6bf2daa2d4ac1f662ba6d2 /controller-api/src/main | |
parent | 6253162369e45210be6bdef22cd5a004420304d9 (diff) |
Introduce and use TesterId
Diffstat (limited to 'controller-api/src/main')
3 files changed, 41 insertions, 6 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java index 4bc80e104bb..4aae1daee2d 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java @@ -15,16 +15,16 @@ public interface ApplicationStore { /** Stores the given tenant application package of the given version. */ void putApplicationPackage(ApplicationId application, ApplicationVersion applicationVersion, byte[] applicationPackage); - /** Stores the given tester application package of the given version. Does NOT contain the services.xml. */ - void putTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion, byte[] testerPackage); + /** Removes applications older than the given version, for the given application, and returns whether something was removed. */ + boolean pruneApplicationPackages(ApplicationId application, ApplicationVersion olderThanVersion); /** Returns the tester application package of the given version. Does NOT contain the services.xml. */ - byte[] getTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion); + byte[] getTesterPackage(TesterId tester, ApplicationVersion applicationVersion); - /** Removes applications older than the given version, for the given application, and returns whether something was removed. */ - boolean pruneApplicationPackages(ApplicationId application, ApplicationVersion olderThanVersion); + /** Stores the given tester application package of the given version. Does NOT contain the services.xml. */ + void putTesterPackage(TesterId tester, ApplicationVersion applicationVersion, byte[] testerPackage); /** Removes tester packages older than the given version, for the given tester, and returns whether something was removed. */ - boolean pruneTesterPackages(ApplicationId tester, ApplicationVersion olderThanVersion); + boolean pruneTesterPackages(TesterId tester, ApplicationVersion olderThanVersion); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java index 85113d79d04..086bb8f2fb4 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java @@ -13,17 +13,20 @@ import java.util.Objects; public class RunId { private final ApplicationId application; + private final TesterId tester; private final JobType type; private final long number; public RunId(ApplicationId application, JobType type, long number) { this.application = Objects.requireNonNull(application, "ApplicationId cannot be null!"); + this.tester = TesterId.of(application); this.type = Objects.requireNonNull(type, "JobType cannot be null!"); if (number <= 0) throw new IllegalArgumentException("Build number must be a positive integer!"); this.number = number; } public ApplicationId application() { return application; } + public TesterId tester() { return tester; } public JobType type() { return type; } public long number() { return number; } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterId.java new file mode 100644 index 00000000000..b586b9f3019 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterId.java @@ -0,0 +1,32 @@ +package com.yahoo.vespa.hosted.controller.api.integration.deployment; + +import com.yahoo.config.provision.ApplicationId; + +/** + * Holds an application ID for a tester application. + * + * @author jonmv + */ +public class TesterId { + + public static final String suffix = "-t"; + + private final ApplicationId id; + + private TesterId(ApplicationId id) { + this.id = id; + } + + /** Creates a new TesterId for a tester of the given application. */ + public static TesterId of(ApplicationId id) { + return new TesterId(ApplicationId.from(id.tenant().value(), + id.application().value(), + id.instance().value() + suffix)); + } + + /** Returns the id of this tester application. */ + public ApplicationId id() { + return id; + } + +} |