diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-01-02 15:28:35 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-01-02 15:28:35 +0100 |
commit | a1627ebcc0bdc30aa0f6cdce6ea0542ca1bff51f (patch) | |
tree | 33f8a121af0cecde64a6c03b62cdd71d0cf88af7 /controller-server | |
parent | f55a08234122589f7ef0ea959c0c2411d74532c3 (diff) |
Add notification settings to test app package builder
Diffstat (limited to 'controller-server')
2 files changed, 23 insertions, 0 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java index b7539166c33..5204a007924 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.deployment; +import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.application.api.ValidationId; import com.yahoo.config.provision.AthenzDomain; import com.yahoo.config.provision.AthenzService; @@ -16,7 +17,9 @@ import java.time.Duration; import java.time.Instant; import java.util.Arrays; import java.util.Date; +import java.util.List; import java.util.Optional; +import java.util.StringJoiner; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -37,6 +40,7 @@ public class ApplicationPackageBuilder { private String globalServiceId = null; private String athenzIdentityAttributes = null; private String searchDefinition = "search test { }"; + private DeploymentSpec.Notifications notifications = DeploymentSpec.Notifications.none(); public ApplicationPackageBuilder majorVersion(int majorVersion) { this.majorVersion = Optional.of(majorVersion); @@ -106,6 +110,16 @@ public class ApplicationPackageBuilder { return this; } + public ApplicationPackageBuilder notifyAuthor(boolean notify) { + this.notifications = DeploymentSpec.Notifications.of(this.notifications.staticEmails(), notify); + return this; + } + + public ApplicationPackageBuilder notifyEmails(List<String> emails) { + this.notifications = DeploymentSpec.Notifications.of(emails, this.notifications.includeAuthor()); + return this; + } + /** Sets the content of the search definition test.sd */ public ApplicationPackageBuilder searchDefinition(String testSearchDefinition) { this.searchDefinition = testSearchDefinition; @@ -125,6 +139,14 @@ public class ApplicationPackageBuilder { xml.append(upgradePolicy); xml.append("'/>\n"); } + if (notifications != DeploymentSpec.Notifications.none()) { + xml.append("<notifications>\n"); + if (notifications.includeAuthor()) + xml.append(" <author />\n"); + for (String email : notifications.staticEmails()) + xml.append(" <email>").append(email).append("</email>\n"); + xml.append("</notifications>"); + } xml.append(blockChange); xml.append(" <"); xml.append(environment.value()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java index 758e2b50e3f..8d245ff575e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java @@ -43,6 +43,7 @@ public class InternalDeploymentTester { .upgradePolicy("default") .region("us-central-1") .parallel("us-west-1", "us-east-3") + .notifyAuthor(true) .build(); public static final ApplicationId appId = ApplicationId.from("tenant", "application", "default"); public static final TesterId testerId = TesterId.of(appId); |