summaryrefslogtreecommitdiffstats
path: root/config-model-api
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-10-04 15:03:23 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-10-04 15:03:23 +0200
commit5188586ce3314efd0fffd52a62403e1b371890dd (patch)
treee5b43fe64cb851b240c78e5cca9809c8450c82af /config-model-api
parent2f95c6b456c6fe12b0f488394439193103c6e1f2 (diff)
Avoid deprecated methods
Diffstat (limited to 'config-model-api')
-rw-r--r--config-model-api/abi-spec.json44
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstanceSpec.java (renamed from config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstancesSpec.java)34
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java89
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java50
-rw-r--r--config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java16
-rw-r--r--config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecWithoutInstanceTest.java8
6 files changed, 151 insertions, 90 deletions
diff --git a/config-model-api/abi-spec.json b/config-model-api/abi-spec.json
index 32c9e433157..5004aebc593 100644
--- a/config-model-api/abi-spec.json
+++ b/config-model-api/abi-spec.json
@@ -187,6 +187,35 @@
],
"fields": []
},
+ "com.yahoo.config.application.api.DeploymentInstanceSpec": {
+ "superClass": "com.yahoo.config.application.api.DeploymentSpec$Step",
+ "interfaces": [],
+ "attributes": [
+ "public"
+ ],
+ "methods": [
+ "public void <init>(com.yahoo.config.provision.InstanceName, java.util.List, com.yahoo.config.application.api.DeploymentSpec$UpgradePolicy, java.util.List, java.util.Optional, java.util.Optional, java.util.Optional, com.yahoo.config.application.api.Notifications, java.util.List)",
+ "public com.yahoo.config.provision.InstanceName name()",
+ "public java.time.Duration delay()",
+ "public java.util.List steps()",
+ "public com.yahoo.config.application.api.DeploymentSpec$UpgradePolicy upgradePolicy()",
+ "public java.util.List changeBlocker()",
+ "public java.util.Optional globalServiceId()",
+ "public boolean canUpgradeAt(java.time.Instant)",
+ "public boolean canChangeRevisionAt(java.time.Instant)",
+ "public java.util.List zones()",
+ "public boolean deploysTo(com.yahoo.config.provision.Environment, java.util.Optional)",
+ "public java.util.Optional athenzDomain()",
+ "public java.util.Optional athenzService(com.yahoo.config.provision.Environment, com.yahoo.config.provision.RegionName)",
+ "public com.yahoo.config.application.api.Notifications notifications()",
+ "public java.util.List endpoints()",
+ "public boolean includes(com.yahoo.config.provision.Environment, java.util.Optional)",
+ "public boolean equals(java.lang.Object)",
+ "public int hashCode()",
+ "public java.lang.String toString()"
+ ],
+ "fields": []
+ },
"com.yahoo.config.application.api.DeploymentSpec$ChangeBlocker": {
"superClass": "java.lang.Object",
"interfaces": [],
@@ -234,6 +263,7 @@
"methods": [
"public void <init>(java.time.Duration)",
"public java.time.Duration duration()",
+ "public java.time.Duration delay()",
"public boolean deploysTo(com.yahoo.config.provision.Environment, java.util.Optional)"
],
"fields": []
@@ -247,6 +277,7 @@
"methods": [
"public void <init>(java.util.List)",
"public java.util.List zones()",
+ "public java.util.List steps()",
"public boolean deploysTo(com.yahoo.config.provision.Environment, java.util.Optional)",
"public boolean equals(java.lang.Object)",
"public int hashCode()"
@@ -264,7 +295,8 @@
"public void <init>()",
"public final boolean deploysTo(com.yahoo.config.provision.Environment)",
"public abstract boolean deploysTo(com.yahoo.config.provision.Environment, java.util.Optional)",
- "public java.util.List zones()"
+ "public java.util.List zones()",
+ "public java.time.Duration delay()"
],
"fields": []
},
@@ -293,6 +325,7 @@
"public"
],
"methods": [
+ "public void <init>(java.util.List, java.util.Optional, java.lang.String)",
"public void <init>(java.util.Optional, com.yahoo.config.application.api.DeploymentSpec$UpgradePolicy, java.util.Optional, java.util.List, java.util.List, java.lang.String, java.util.Optional, java.util.Optional, com.yahoo.config.application.api.Notifications, java.util.List)",
"public java.util.Optional globalServiceId()",
"public com.yahoo.config.application.api.DeploymentSpec$UpgradePolicy upgradePolicy()",
@@ -302,16 +335,21 @@
"public java.util.List changeBlocker()",
"public java.util.List steps()",
"public java.util.List zones()",
+ "public java.util.Optional athenzDomain()",
+ "public java.util.Optional athenzService(com.yahoo.config.provision.Environment, com.yahoo.config.provision.RegionName)",
"public com.yahoo.config.application.api.Notifications notifications()",
"public java.util.List endpoints()",
"public java.lang.String xmlForm()",
"public boolean includes(com.yahoo.config.provision.Environment, java.util.Optional)",
+ "public com.yahoo.config.application.api.DeploymentInstanceSpec instance(java.lang.String)",
+ "public com.yahoo.config.application.api.DeploymentInstanceSpec instance(com.yahoo.config.provision.InstanceName)",
+ "public com.yahoo.config.application.api.DeploymentInstanceSpec requireInstance(java.lang.String)",
+ "public com.yahoo.config.application.api.DeploymentInstanceSpec requireInstance(com.yahoo.config.provision.InstanceName)",
+ "public java.util.List instances()",
"public static com.yahoo.config.application.api.DeploymentSpec fromXml(java.io.Reader)",
"public static com.yahoo.config.application.api.DeploymentSpec fromXml(java.lang.String)",
"public static com.yahoo.config.application.api.DeploymentSpec fromXml(java.lang.String, boolean)",
"public static java.lang.String toMessageString(java.lang.Throwable)",
- "public java.util.Optional athenzDomain()",
- "public java.util.Optional athenzService(com.yahoo.config.provision.Environment, com.yahoo.config.provision.RegionName)",
"public boolean equals(java.lang.Object)",
"public int hashCode()",
"public static void main(java.lang.String[])"
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstancesSpec.java b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstanceSpec.java
index 344f3438804..1fc3a8af2eb 100644
--- a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstancesSpec.java
+++ b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstanceSpec.java
@@ -18,14 +18,14 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
- * The deployment spec for some specified application instances
+ * The deployment spec for an application instance
*
* @author bratseth
*/
-public class DeploymentInstancesSpec extends DeploymentSpec.Step {
+public class DeploymentInstanceSpec extends DeploymentSpec.Step {
- /** The instances deployed in this step */
- private final List<InstanceName> ids;
+ /** The name of the instance this step deploys */
+ private final InstanceName name;
private final List<DeploymentSpec.Step> steps;
private final DeploymentSpec.UpgradePolicy upgradePolicy;
@@ -36,16 +36,16 @@ public class DeploymentInstancesSpec extends DeploymentSpec.Step {
private final Notifications notifications;
private final List<Endpoint> endpoints;
- public DeploymentInstancesSpec(List<InstanceName> ids,
- List<DeploymentSpec.Step> steps,
- DeploymentSpec.UpgradePolicy upgradePolicy,
- List<DeploymentSpec.ChangeBlocker> changeBlockers,
- Optional<String> globalServiceId,
- Optional<AthenzDomain> athenzDomain,
- Optional<AthenzService> athenzService,
- Notifications notifications,
- List<Endpoint> endpoints) {
- this.ids = List.copyOf(ids);
+ public DeploymentInstanceSpec(InstanceName name,
+ List<DeploymentSpec.Step> steps,
+ DeploymentSpec.UpgradePolicy upgradePolicy,
+ List<DeploymentSpec.ChangeBlocker> changeBlockers,
+ Optional<String> globalServiceId,
+ Optional<AthenzDomain> athenzDomain,
+ Optional<AthenzService> athenzService,
+ Notifications notifications,
+ List<Endpoint> endpoints) {
+ this.name = name;
this.steps = List.copyOf(completeSteps(new ArrayList<>(steps)));
this.upgradePolicy = upgradePolicy;
this.changeBlockers = changeBlockers;
@@ -59,7 +59,7 @@ public class DeploymentInstancesSpec extends DeploymentSpec.Step {
validateAthenz();
}
- public List<InstanceName> names() { return ids; }
+ public InstanceName name() { return name; }
/** Adds missing required steps and reorders steps to a permissible order */
private static List<DeploymentSpec.Step> completeSteps(List<DeploymentSpec.Step> steps) {
@@ -255,7 +255,7 @@ public class DeploymentInstancesSpec extends DeploymentSpec.Step {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- DeploymentInstancesSpec other = (DeploymentInstancesSpec) o;
+ DeploymentInstanceSpec other = (DeploymentInstanceSpec) o;
return globalServiceId.equals(other.globalServiceId) &&
upgradePolicy == other.upgradePolicy &&
changeBlockers.equals(other.changeBlockers) &&
@@ -273,7 +273,7 @@ public class DeploymentInstancesSpec extends DeploymentSpec.Step {
@Override
public String toString() {
- return "instance" + ( ids.size() < 1 ? " " : "s " ) + ids;
+ return "instance '" + name + "'";
}
}
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java
index e54371e714d..db383a1bea5 100644
--- a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java
+++ b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java
@@ -13,13 +13,10 @@ import java.io.FileReader;
import java.io.Reader;
import java.time.Duration;
import java.time.Instant;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -67,15 +64,15 @@ public class DeploymentSpec {
Optional<AthenzDomain> athenzDomain, Optional<AthenzService> athenzService,
Notifications notifications,
List<Endpoint> endpoints) {
- this(List.of(new DeploymentInstancesSpec(List.of(InstanceName.from("default")),
- steps,
- upgradePolicy,
- changeBlockers,
- globalServiceId,
- athenzDomain,
- athenzService,
- notifications,
- endpoints)),
+ this(List.of(new DeploymentInstanceSpec(InstanceName.from("default"),
+ steps,
+ upgradePolicy,
+ changeBlockers,
+ globalServiceId,
+ athenzDomain,
+ athenzService,
+ notifications,
+ endpoints)),
majorVersion,
xmlForm);
}
@@ -89,18 +86,11 @@ public class DeploymentSpec {
}
// TODO: Remove after October 2019
- private DeploymentInstancesSpec defaultInstance() {
- if (hasDefaultInstanceStepOnly()) return (DeploymentInstancesSpec)steps.get(0);
+ private DeploymentInstanceSpec defaultInstance() {
+ if (instances().size() == 1) return (DeploymentInstanceSpec)steps.get(0);
throw new IllegalArgumentException("This deployment spec does not support the legacy API " +
- "as it does not consist only of a default instance. Content: " +
- steps.stream().map(Step::toString).collect(Collectors.joining(",")));
- }
-
- // TODO: Remove after October 2019
- private boolean hasDefaultInstanceStepOnly() {
- return steps.size() == 1
- && (steps.get(0) instanceof DeploymentInstancesSpec)
- && ((DeploymentInstancesSpec)steps.get(0)).names().equals(List.of(InstanceName.from("default")));
+ "as it has multiple instances: " +
+ instances().stream().map(Step::toString).collect(Collectors.joining(",")));
}
// TODO: Remove after October 2019
@@ -112,61 +102,86 @@ public class DeploymentSpec {
/** Returns the major version this application is pinned to, or empty (default) to allow all major versions */
public Optional<Integer> majorVersion() { return majorVersion; }
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public boolean canUpgradeAt(Instant instant) { return defaultInstance().canUpgradeAt(instant); }
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public boolean canChangeRevisionAt(Instant instant) { return defaultInstance().canChangeRevisionAt(instant); }
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public List<ChangeBlocker> changeBlocker() { return defaultInstance().changeBlocker(); }
/** Returns the deployment steps of this in the order they will be performed */
public List<Step> steps() {
- if (hasDefaultInstanceStepOnly()) return defaultInstance().steps(); // TODO: Remove line after October 2019
+ if (steps.size() == 1) return defaultInstance().steps(); // TODO: Remove line after November 2019
return steps;
}
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public List<DeclaredZone> zones() {
return defaultInstance().steps().stream()
.flatMap(step -> step.zones().stream())
.collect(Collectors.toList());
}
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public Optional<AthenzDomain> athenzDomain() { return defaultInstance().athenzDomain(); }
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public Optional<AthenzService> athenzService(Environment environment, RegionName region) {
return defaultInstance().athenzService(environment, region);
}
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public Notifications notifications() { return defaultInstance().notifications(); }
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public List<Endpoint> endpoints() { return defaultInstance().endpoints(); }
/** Returns the XML form of this spec, or null if it was not created by fromXml, nor is empty */
public String xmlForm() { return xmlForm; }
- // TODO: Remove after October 2019
+ // TODO: Remove after November 2019
public boolean includes(Environment environment, Optional<RegionName> region) {
return defaultInstance().deploysTo(environment, region);
}
/** Returns the instance step containing the given instance name, or null if not present */
- public DeploymentInstancesSpec instance(String name) {
+ public DeploymentInstanceSpec instance(String name) {
+ return instance(InstanceName.from(name));
+ }
+
+ /** Returns the instance step containing the given instance name, or null if not present */
+ public DeploymentInstanceSpec instance(InstanceName name) {
for (Step step : steps) {
- if ( ! (step instanceof DeploymentInstancesSpec)) continue;
- DeploymentInstancesSpec instanceStep = (DeploymentInstancesSpec)step;
- if (instanceStep.names().contains(InstanceName.from(name)))
+ if ( ! (step instanceof DeploymentInstanceSpec)) continue;
+ DeploymentInstanceSpec instanceStep = (DeploymentInstanceSpec)step;
+ if (instanceStep.name().equals(name))
return instanceStep;
}
return null;
}
+ /** Returns the instance step containing the given instance name, or throws an IllegalArgumentException if not present */
+ public DeploymentInstanceSpec requireInstance(String name) {
+ return requireInstance(InstanceName.from(name));
+ }
+
+ public DeploymentInstanceSpec requireInstance(InstanceName name) {
+ DeploymentInstanceSpec instance = instance(name);
+ if (instance == null)
+ throw new IllegalArgumentException("No instance '" + name + "' in deployment.xml'. Instances: " +
+ instances().stream().map(spec -> spec.name().toString()).collect(Collectors.joining(",")));
+ return instance;
+ }
+
+ /** Returns the steps of this which are instances */
+ public List<DeploymentInstanceSpec> instances() {
+ return steps.stream()
+ .filter(step -> step instanceof DeploymentInstanceSpec).map(DeploymentInstanceSpec.class::cast)
+ .collect(Collectors.toList());
+ }
+
/**
* Creates a deployment spec from XML.
*
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java
index acecb320b83..4d6495482ea 100644
--- a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java
+++ b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java
@@ -1,7 +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.config.application.api.xml;
-import com.yahoo.config.application.api.DeploymentInstancesSpec;
+import com.yahoo.config.application.api.DeploymentInstanceSpec;
import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.application.api.DeploymentSpec.DeclaredZone;
import com.yahoo.config.application.api.DeploymentSpec.Delay;
@@ -53,6 +53,7 @@ public class DeploymentSpecXmlReader {
private static final String endpointTag = "endpoint";
private static final String athenzServiceAttribute = "athenz-service";
+ private static final String athenzDomainAttribute = "athenz-domain";
private static final String testerFlavorAttribute = "tester-flavor";
private final boolean validate;
@@ -86,7 +87,7 @@ public class DeploymentSpecXmlReader {
List<Step> steps = new ArrayList<>();
if ( ! hasChildTag(instanceTag, root)) { // deployment spec skipping explicit instance -> "default" instance
- steps.add(readInstanceContent("default", root));
+ steps.addAll(readInstanceContent("default", root, root));
}
else {
if (hasChildTag(prodTag, root))
@@ -96,7 +97,7 @@ public class DeploymentSpecXmlReader {
for (Element topLevelTag : XML.getChildren(root)) {
if (topLevelTag.getTagName().equals(instanceTag))
- steps.add(readInstanceContent(topLevelTag.getAttribute("id"), topLevelTag));
+ steps.addAll(readInstanceContent(topLevelTag.getAttribute("id"), topLevelTag, root));
else
steps.addAll(readNonInstanceSteps(topLevelTag, new MutableOptional<>(), topLevelTag)); // (No global service id here)
}
@@ -110,33 +111,38 @@ public class DeploymentSpecXmlReader {
/**
* Reads the content of an (implicit or explicit) instance tag producing an instances step
*
- * @param instanceIdString a comma-separated list of the ids of the instance id(s) this is for
- * @param instanceElement the element having the content of this instance
+ * @param instanceNameString a comma-separated list of the names of the instances this is for
+ * @param instanceTag the element having the content of this instance
+ * @param parentTag the parent of instanceTag (or the same, if this instances is implicitly defined which means instanceTag is the root)
+ * @return the instances specified, one for each instance name element
*/
- private DeploymentInstancesSpec readInstanceContent(String instanceIdString, Element instanceElement) {
+ private List<DeploymentInstanceSpec> readInstanceContent(String instanceNameString, Element instanceTag, Element parentTag) {
if (validate)
- validateTagOrder(instanceElement);
+ validateTagOrder(instanceTag);
- List<InstanceName> instanceNames = Arrays.stream(instanceIdString.split("'"))
- .map(InstanceName::from)
- .collect(Collectors.toList());
MutableOptional<String> globalServiceId = new MutableOptional<>(); // Deprecated: Set of prod, but belongs to instance
- Optional<AthenzDomain> athenzDomain = stringAttribute("athenz-domain", instanceElement).map(AthenzDomain::from);
- Optional<AthenzService> athenzService = stringAttribute("athenz-service", instanceElement).map(AthenzService::from);
+ Optional<AthenzDomain> athenzDomain = stringAttribute(athenzDomainAttribute, instanceTag)
+ .or(() -> stringAttribute(athenzDomainAttribute, parentTag))
+ .map(AthenzDomain::from);
+ Optional<AthenzService> athenzService = stringAttribute(athenzServiceAttribute, instanceTag)
+ .or(() -> stringAttribute(athenzServiceAttribute, parentTag))
+ .map(AthenzService::from);
List<Step> steps = new ArrayList<>();
- for (Element instanceChild : XML.getChildren(instanceElement))
+ for (Element instanceChild : XML.getChildren(instanceTag))
steps.addAll(readNonInstanceSteps(instanceChild, globalServiceId, instanceChild));
- return new DeploymentInstancesSpec(instanceNames,
- steps,
- readUpgradePolicy(instanceElement),
- readChangeBlockers(instanceElement),
- globalServiceId.asOptional(),
- athenzDomain,
- athenzService,
- readNotifications(instanceElement),
- readEndpoints(instanceElement));
+ return Arrays.stream(instanceNameString.split("'"))
+ .map(name -> new DeploymentInstanceSpec(InstanceName.from(name),
+ steps,
+ readUpgradePolicy(instanceTag),
+ readChangeBlockers(instanceTag),
+ globalServiceId.asOptional(),
+ athenzDomain,
+ athenzService,
+ readNotifications(instanceTag),
+ readEndpoints(instanceTag)))
+ .collect(Collectors.toList());
}
// Consume the give tag as 0-N steps. 0 if it is not a step, >1 if it contains multiple nested steps that should be flattened
diff --git a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java
index a7625b42e8d..4923ea396a0 100644
--- a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java
+++ b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java
@@ -152,7 +152,7 @@ public class DeploymentSpecTest {
assertFalse(((DeploymentSpec.DeclaredZone)spec.instance("default").steps().get(2)).active());
assertTrue(spec.instance("default").steps().get(3) instanceof DeploymentSpec.Delay);
- assertEquals(3 * 60 * 60 + 30 * 60, ((DeploymentSpec.Delay)spec.instance("default").steps().get(3)).duration().getSeconds());
+ assertEquals(3 * 60 * 60 + 30 * 60, spec.instance("default").steps().get(3).delay().getSeconds());
assertTrue(spec.instance("default").steps().get(4).deploysTo(Environment.prod, Optional.of(RegionName.from("us-west1"))));
assertTrue(((DeploymentSpec.DeclaredZone)spec.instance("default").steps().get(4)).active());
@@ -274,7 +274,7 @@ public class DeploymentSpecTest {
@Test
public void testEmpty() {
- assertFalse(DeploymentSpec.empty.globalServiceId().isPresent());
+ assertFalse(DeploymentSpec.empty.instance("default").globalServiceId().isPresent());
assertEquals(DeploymentSpec.UpgradePolicy.defaultPolicy, DeploymentSpec.empty.upgradePolicy());
assertTrue(DeploymentSpec.empty.steps().isEmpty());
assertEquals("<deployment version='1.0'/>", DeploymentSpec.empty.xmlForm());
@@ -391,18 +391,20 @@ public class DeploymentSpecTest {
assertTrue(spec.instance("default").canUpgradeAt(Instant.parse("2017-09-23T10:15:30.00Z")));
}
- @Test(expected = IllegalArgumentException.class)
- public void athenz_config_is_disallowed_on_deployment_if_instances() {
+ @Test
+ public void athenz_config_is_read_from_deployment() {
StringReader r = new StringReader(
- "<deployment athenz-domain='domain' athenz-service='service''>" +
- " <instance id='default'>" +
+ "<deployment athenz-domain='domain' athenz-service='service'>" +
+ " <instance id='instance1'>" +
" <prod>" +
" <region active='true'>us-west-1</region>" +
" </prod>" +
" </instance>" +
"</deployment>"
);
- DeploymentSpec.fromXml(r);
+ DeploymentSpec spec = DeploymentSpec.fromXml(r);
+ assertEquals(spec.instance("instance1").athenzDomain().get().value(), "domain");
+ assertEquals(spec.instance("instance1").athenzService(Environment.prod, RegionName.from("us-west-1")).get().value(), "service");
}
@Test
diff --git a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecWithoutInstanceTest.java b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecWithoutInstanceTest.java
index 732e1196995..33ef3f4bea8 100644
--- a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecWithoutInstanceTest.java
+++ b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecWithoutInstanceTest.java
@@ -141,7 +141,7 @@ public class DeploymentSpecWithoutInstanceTest {
assertFalse(((DeploymentSpec.DeclaredZone)spec.instance("default").steps().get(2)).active());
assertTrue(spec.instance("default").steps().get(3) instanceof DeploymentSpec.Delay);
- assertEquals(3 * 60 * 60 + 30 * 60, ((DeploymentSpec.Delay)spec.instance("default").steps().get(3)).duration().getSeconds());
+ assertEquals(3 * 60 * 60 + 30 * 60, spec.instance("default").steps().get(3).delay().getSeconds());
assertTrue(spec.instance("default").steps().get(4).deploysTo(Environment.prod, Optional.of(RegionName.from("us-west1"))));
assertTrue(((DeploymentSpec.DeclaredZone)spec.instance("default").steps().get(4)).active());
@@ -251,7 +251,7 @@ public class DeploymentSpecWithoutInstanceTest {
@Test
public void testEmpty() {
- assertFalse(DeploymentSpec.empty.globalServiceId().isPresent());
+ assertFalse(DeploymentSpec.empty.instance("default").globalServiceId().isPresent());
assertEquals(DeploymentSpec.UpgradePolicy.defaultPolicy, DeploymentSpec.empty.upgradePolicy());
assertTrue(DeploymentSpec.empty.steps().isEmpty());
assertEquals("<deployment version='1.0'/>", DeploymentSpec.empty.xmlForm());
@@ -414,7 +414,7 @@ public class DeploymentSpecWithoutInstanceTest {
@Test
public void noNotifications() {
assertEquals(Notifications.none(),
- DeploymentSpec.fromXml("<deployment />").notifications());
+ DeploymentSpec.fromXml("<deployment />").instance("default").notifications());
}
@Test
@@ -455,7 +455,7 @@ public class DeploymentSpecWithoutInstanceTest {
@Test
public void noEndpoints() {
- assertEquals(Collections.emptyList(), DeploymentSpec.fromXml("<deployment />").endpoints());
+ assertEquals(Collections.emptyList(), DeploymentSpec.fromXml("<deployment />").instance("default").endpoints());
}
@Test