aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2017-12-08 15:03:03 +0100
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2017-12-08 15:03:03 +0100
commitecc30dbc982a14afd44bb56bc1d08ba115fa7477 (patch)
treef738fc72412a77fe96a1f79571c619bc4e2bbd05 /controller-server
parent8ef0a9b90637daa49d5673fdd5541b8d81120aff (diff)
Replaced instantiation of Zone with ZoneId where applicable
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java9
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java17
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java21
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java20
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java9
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java9
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java9
19 files changed, 71 insertions, 67 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
index b9f0f5664a3..b00e76a331a 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
@@ -268,7 +268,7 @@ public class ApplicationController {
/** Deploys an application. If the application does not exist it is created. */
// TODO: Get rid of the options arg
- public ActivateResult deployApplication(ApplicationId applicationId, Zone zone,
+ public ActivateResult deployApplication(ApplicationId applicationId, ZoneId zone,
ApplicationPackage applicationPackage, DeployOptions options) {
try (Lock lock = lock(applicationId)) {
// TODO: Shouldn't this go through the above method? Seems you can cheat the checks here ... ?
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java
index afc1ece8074..72ed1a42435 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java
@@ -69,7 +69,7 @@ public class LockedApplication extends Application {
return new LockedApplication(new Builder(this).with(deploymentJobs().withTriggering(type, change, version, revision, reason, triggerTime)));
}
- public LockedApplication withNewDeployment(Zone zone, ApplicationRevision revision, Version version, Instant instant) {
+ public LockedApplication withNewDeployment(ZoneId zone, ApplicationRevision revision, Version version, Instant instant) {
// Use info from previous deployment if available, otherwise create a new one.
Deployment previousDeployment = deployments().getOrDefault(zone, new Deployment(zone, revision, version, instant));
Deployment newDeployment = new Deployment(zone, revision, version, instant,
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java
index 98ae5ed1762..b9d07249cb2 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.application;
import com.yahoo.component.Version;
import com.yahoo.config.provision.ClusterSpec.Id;
import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import java.time.Instant;
import java.util.HashMap;
@@ -18,7 +19,7 @@ import java.util.Objects;
*/
public class Deployment {
- private final Zone zone;
+ private final ZoneId zone;
private final ApplicationRevision revision;
private final Version version;
private final Instant deployTime;
@@ -26,11 +27,11 @@ public class Deployment {
private final Map<Id, ClusterInfo> clusterInfo;
private final DeploymentMetrics metrics;
- public Deployment(Zone zone, ApplicationRevision revision, Version version, Instant deployTime) {
+ public Deployment(ZoneId zone, ApplicationRevision revision, Version version, Instant deployTime) {
this(zone, revision, version, deployTime, new HashMap<>(), new HashMap<>(), new DeploymentMetrics());
}
- public Deployment(Zone zone, ApplicationRevision revision, Version version, Instant deployTime,
+ public Deployment(ZoneId zone, ApplicationRevision revision, Version version, Instant deployTime,
Map<Id, ClusterUtilization> clusterUtils, Map<Id, ClusterInfo> clusterInfo, DeploymentMetrics metrics) {
Objects.requireNonNull(zone, "zone cannot be null");
Objects.requireNonNull(revision, "revision cannot be null");
@@ -49,7 +50,7 @@ public class Deployment {
}
/** Returns the zone this was deployed to */
- public Zone zone() { return zone; }
+ public ZoneId zone() { return zone; }
/** Returns the revision of the application which was deployed */
public ApplicationRevision revision() { return revision; }
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java
index 49e688a8b0e..47b2cb94d12 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java
@@ -179,7 +179,7 @@ public class DeploymentJobs {
private final String jobName;
private final ImmutableMap<SystemName, ZoneId> zones;
- JobType(String jobName, ZoneId... zones) {
+ JobType(String jobName, Zone... zones) {
this.jobName = jobName;
this.zones = ImmutableMap.copyOf(Stream.of(zones).collect(Collectors.toMap(zone -> zone.system(),
zone -> zone)));
@@ -232,11 +232,11 @@ public class DeploymentJobs {
return from(system, new Zone(environment, region));
}
- private static ZoneId zone(SystemName system, String environment, String region) {
+ private static Zone zone(SystemName system, String environment, String region) {
return new Zone(system, Environment.from(environment), RegionName.from(region));
}
- private static ZoneId zone(String environment, String region) {
+ private static Zone zone(String environment, String region) {
return new Zone(Environment.from(environment), RegionName.from(region));
}
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java
index 01d4ed4506a..2b92bcad644 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java
@@ -108,7 +108,7 @@ public class DeploymentOrder {
public List<Deployment> sortBy(List<DeploymentSpec.DeclaredZone> zones, Collection<Deployment> deployments) {
List<ZoneId> productionZones = zones.stream()
.filter(z -> z.region().isPresent())
- .map(z -> new Zone(z.environment(), z.region().get()))
+ .map(z -> new ZoneId(z.environment(), z.region().get()))
.collect(toList());
return deployments.stream()
.sorted(comparingInt(deployment -> productionZones.indexOf(deployment.zone())))
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java
index 12441504ca2..8627744c73f 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java
@@ -8,7 +8,6 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
-import com.yahoo.config.provision.Zone;
import com.yahoo.config.provision.ZoneId;
import com.yahoo.slime.ArrayTraverser;
import com.yahoo.slime.Cursor;
@@ -143,7 +142,7 @@ public class ApplicationSerializer {
}
private void deploymentToSlime(Deployment deployment, Cursor object) {
- zoneToSlime(deployment.zone(), object.setObject(zoneField));
+ zoneIdToSlime(deployment.zone(), object.setObject(zoneField));
object.setString(versionField, deployment.version().toString());
object.setLong(deployTimeField, deployment.at().toEpochMilli());
toSlime(deployment.revision(), object.setObject(applicationPackageRevisionField));
@@ -195,7 +194,7 @@ public class ApplicationSerializer {
object.setDouble(clusterUtilsDiskBusyField, utils.getDiskBusy());
}
- private void zoneToSlime(ZoneId zone, Cursor object) {
+ private void zoneIdToSlime(ZoneId zone, Cursor object) {
object.setString(environmentField, zone.environment().value());
object.setString(regionField, zone.region().value());
}
@@ -284,13 +283,13 @@ public class ApplicationSerializer {
}
private Deployment deploymentFromSlime(Inspector deploymentObject) {
- return new Deployment(zoneFromSlime(deploymentObject.field(zoneField)),
+ return new Deployment(zoneIdFromSlime(deploymentObject.field(zoneField)),
applicationRevisionFromSlime(deploymentObject.field(applicationPackageRevisionField)).get(),
Version.fromString(deploymentObject.field(versionField).asString()),
Instant.ofEpochMilli(deploymentObject.field(deployTimeField).asLong()),
- clusterUtilsMapFromSlime(deploymentObject.field(clusterUtilsField)),
- clusterInfoMapFromSlime(deploymentObject.field(clusterInfoField)),
- deploymentMetricsFromSlime(deploymentObject.field(deploymentMetricsField)));
+ clusterUtilsMapFromSlime(deploymentObject.field(clusterUtilsField)),
+ clusterInfoMapFromSlime(deploymentObject.field(clusterInfoField)),
+ deploymentMetricsFromSlime(deploymentObject.field(deploymentMetricsField)));
}
private DeploymentMetrics deploymentMetricsFromSlime(Inspector object) {
@@ -339,8 +338,8 @@ public class ApplicationSerializer {
return new ClusterInfo(flavor, cost, flavorCpu, flavorMem, flavorDisk, ClusterSpec.Type.from(type), hostnames);
}
- private Zone zoneFromSlime(Inspector object) {
- return new Zone(Environment.from(object.field(environmentField).asString()),
+ private ZoneId zoneIdFromSlime(Inspector object) {
+ return new ZoneId(Environment.from(object.field(environmentField).asString()),
RegionName.from(object.field(regionField).asString()));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index 08d973dba52..4b2f0f88d5b 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -10,7 +10,6 @@ import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.TenantName;
-import com.yahoo.config.provision.Zone;
import com.yahoo.config.provision.ZoneId;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
@@ -424,7 +423,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
.orElseThrow(() -> new NotExistsException(id + " not found"));
DeploymentId deploymentId = new DeploymentId(application.id(),
- new Zone(Environment.from(environment), RegionName.from(region)));
+ new ZoneId(Environment.from(environment), RegionName.from(region)));
Deployment deployment = application.deployments().get(deploymentId.zone());
if (deployment == null)
@@ -515,7 +514,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
// DeploymentId identifies the zone and application we are dealing with
DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName),
- new Zone(Environment.from(environment), RegionName.from(region)));
+ new ZoneId(Environment.from(environment), RegionName.from(region)));
try {
List<String> rotations = controller.applications().setGlobalRotationStatus(deploymentId, endPointStatus);
return new MessageResponse(String.format("Rotations %s successfully set to %s service", rotations.toString(), inService ? "in" : "out of"));
@@ -527,7 +526,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
private HttpResponse getGlobalRotationOverride(String tenantName, String applicationName, String instanceName, String environment, String region) {
DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName),
- new Zone(Environment.from(environment), RegionName.from(region)));
+ new ZoneId(Environment.from(environment), RegionName.from(region)));
Slime slime = new Slime();
Cursor c1 = slime.setObject().setArray("globalrotationoverride");
@@ -572,13 +571,13 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
private HttpResponse waitForConvergence(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
return new JacksonJsonResponse(controller.waitForConfigConvergence(new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName),
- new Zone(Environment.from(environment), RegionName.from(region))),
+ new ZoneId(Environment.from(environment), RegionName.from(region))),
asLong(request.getProperty("timeout"), 1000)));
}
private HttpResponse services(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
ApplicationView applicationView = controller.getApplicationView(tenantName, applicationName, instanceName, environment, region);
- ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.from(environment), RegionName.from(region)),
+ ServiceApiResponse response = new ServiceApiResponse(new ZoneId(Environment.from(environment), RegionName.from(region)),
new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(),
controller.getConfigServerUris(Environment.from(environment), RegionName.from(region)),
request.getUri());
@@ -588,7 +587,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
private HttpResponse service(String tenantName, String applicationName, String instanceName, String environment, String region, String serviceName, String restPath, HttpRequest request) {
Map<?,?> result = controller.getServiceApiResponse(tenantName, applicationName, instanceName, environment, region, serviceName, restPath);
- ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.from(environment), RegionName.from(region)),
+ ServiceApiResponse response = new ServiceApiResponse(new ZoneId(Environment.from(environment), RegionName.from(region)),
new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(),
controller.getConfigServerUris(Environment.from(environment), RegionName.from(region)),
request.getUri());
@@ -738,7 +737,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
/** Schedule restart of deployment, or specific host in a deployment */
private HttpResponse restart(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName),
- new Zone(Environment.from(environment), RegionName.from(region)));
+ new ZoneId(Environment.from(environment), RegionName.from(region)));
// TODO: Propagate all filters
Optional<Hostname> hostname = Optional.ofNullable(request.getProperty("hostname")).map(Hostname::new);
controller.applications().restart(deploymentId, hostname);
@@ -759,7 +758,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
private HttpResponse log(String tenantName, String applicationName, String instanceName, String environment, String region) {
try {
DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName),
- new Zone(Environment.from(environment), RegionName.from(region)));
+ new ZoneId(Environment.from(environment), RegionName.from(region)));
return new JacksonJsonResponse(controller.grabLog(deploymentId));
}
catch (RuntimeException e) {
@@ -771,7 +770,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
private HttpResponse deploy(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
ApplicationId applicationId = ApplicationId.from(tenantName, applicationName, instanceName);
- Zone zone = new Zone(Environment.from(environment), RegionName.from(region));
+ ZoneId zone = new ZoneId(Environment.from(environment), RegionName.from(region));
Map<String, byte[]> dataParts = new MultipartParser().parse(request);
if ( ! dataParts.containsKey("deployOptions"))
@@ -822,7 +821,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
private HttpResponse deactivate(String tenantName, String applicationName, String instanceName, String environment, String region) {
Application application = controller.applications().require(ApplicationId.from(tenantName, applicationName, instanceName));
- ZoneId zone = new Zone(Environment.from(environment), RegionName.from(region));
+ ZoneId zone = new ZoneId(Environment.from(environment), RegionName.from(region));
Deployment deployment = application.deployments().get(zone);
if (deployment == null) {
// Attempt to deactivate application even if the deployment is not known by the controller
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
index eca381754d6..11c918fcd83 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
@@ -527,7 +527,7 @@ public class ControllerTest {
application = application.withDeploying(Optional.of(new Change.VersionChange(Version.fromString("6.3"))));
applications.store(application);
try {
- tester.deploy(app, new Zone(Environment.prod, RegionName.from("us-east-3")));
+ tester.deploy(app, new ZoneId(Environment.prod, RegionName.from("us-east-3")));
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertEquals("Rejecting deployment of application 'tenant1.app1' to zone prod.us-east-3 as version change to 6.3 is not tested", e.getMessage());
@@ -627,7 +627,7 @@ public class ControllerTest {
Application app = tester.createApplication("app1", "tenant1", 1, 2L);
// Direct deploy is allowed when project ID is missing
- Zone zone = new Zone(Environment.prod, RegionName.from("cd-us-central-1"));
+ ZoneId zone = new ZoneId(Environment.prod, RegionName.from("cd-us-central-1"));
// Same options as used in our integration tests
DeployOptions options = new DeployOptions(Optional.empty(), Optional.empty(), false,
false);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
index bdb8160a3f6..d592e57dfc6 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
@@ -7,7 +7,7 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.TenantName;
-import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.slime.Slime;
import com.yahoo.test.ManualClock;
import com.yahoo.vespa.curator.Lock;
@@ -130,7 +130,7 @@ public final class ControllerTester {
/** Creates the given tenant and application and deploys it */
public Application createAndDeploy(String tenantName, String domainName, String applicationName,
- String instanceName, Zone zone, long projectId, Long propertyId) {
+ String instanceName, ZoneId zone, long projectId, Long propertyId) {
TenantId tenant = createTenant(tenantName, domainName, propertyId);
Application application = createApplication(tenant, applicationName, instanceName, projectId);
deploy(application, zone);
@@ -144,7 +144,7 @@ public final class ControllerTester {
}
/** Creates the given tenant and application and deploys it */
- public Application createAndDeploy(String tenantName, String domainName, String applicationName, Zone zone, long projectId, Long propertyId) {
+ public Application createAndDeploy(String tenantName, String domainName, String applicationName, ZoneId zone, long projectId, Long propertyId) {
return createAndDeploy(tenantName, domainName, applicationName, "default", zone, projectId, propertyId);
}
@@ -163,11 +163,11 @@ public final class ControllerTester {
return application;
}
- public Zone toZone(Environment environment) {
+ public ZoneId toZone(Environment environment) {
switch (environment) {
- case dev: case test: return new Zone(environment, RegionName.from("us-east-1"));
- case staging: return new Zone(environment, RegionName.from("us-east-3"));
- default: return new Zone(environment, RegionName.from("us-west-1"));
+ case dev: case test: return new ZoneId(environment, RegionName.from("us-east-1"));
+ case staging: return new ZoneId(environment, RegionName.from("us-east-3"));
+ default: return new ZoneId(environment, RegionName.from("us-west-1"));
}
}
@@ -197,15 +197,15 @@ public final class ControllerTester {
return controller().applications().require(applicationId);
}
- public void deploy(Application application, Zone zone) {
+ public void deploy(Application application, ZoneId zone) {
deploy(application, zone, new ApplicationPackage(new byte[0]));
}
- public void deploy(Application application, Zone zone, ApplicationPackage applicationPackage) {
+ public void deploy(Application application, ZoneId zone, ApplicationPackage applicationPackage) {
deploy(application, zone, applicationPackage, false);
}
- public void deploy(Application application, Zone zone, ApplicationPackage applicationPackage, boolean deployCurrentVersion) {
+ public void deploy(Application application, ZoneId zone, ApplicationPackage applicationPackage, boolean deployCurrentVersion) {
ScrewdriverId app1ScrewdriverId = new ScrewdriverId(String.valueOf(application.deploymentJobs().projectId().get()));
GitRevision app1RevisionId = new GitRevision(new GitRepository("repo"), new GitBranch("master"), new GitCommit("commit1"));
controller().applications().deployApplication(application.id(),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java
index b4f06f3b423..e2475ef6c87 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java
@@ -89,7 +89,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry
@Override
public Optional<Duration> getDeploymentTimeToLive(Environment environment, RegionName region) {
- return Optional.ofNullable(deploymentTimeToLive.get(new Zone(environment, region)));
+ return Optional.ofNullable(deploymentTimeToLive.get(new ZoneId(environment, region)));
}
@Override
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java
index ef0b05f9bb2..37bb553d905 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.application.Deployment;
@@ -35,7 +36,7 @@ public class DeploymentExpirerTest {
@Test
public void testDeploymentExpiry() throws IOException, InterruptedException {
tester.controllerTester().zoneRegistry().setDeploymentTimeToLive(
- new Zone(Environment.dev, RegionName.from("us-east-1")),
+ new ZoneId(Environment.dev, RegionName.from("us-east-1")),
Duration.ofDays(14)
);
DeploymentExpirer expirer = new DeploymentExpirer(tester.controller(), Duration.ofDays(10),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java
index 8839f6a5a18..7304880b1c2 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java
@@ -5,6 +5,7 @@ import com.yahoo.component.Version;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.test.ManualClock;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.ControllerTester;
@@ -692,7 +693,7 @@ public class UpgraderTest {
// Dev deployment which should be ignored
Application dev0 = tester.createApplication("dev0", "tenant1", 7, 1L);
- tester.controllerTester().deploy(dev0, new Zone(Environment.dev, RegionName.from("dev-region")));
+ tester.controllerTester().deploy(dev0, new ZoneId(Environment.dev, RegionName.from("dev-region")));
// New version is released and canaries upgrade
version = Version.fromString("5.1");
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
index bf869230e8d..ca16e1e02ba 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
@@ -9,6 +9,7 @@ import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.slime.Slime;
import com.yahoo.vespa.config.SlimeUtils;
import com.yahoo.vespa.hosted.controller.Application;
@@ -48,8 +49,8 @@ public class ApplicationSerializerTest {
private static final ApplicationSerializer applicationSerializer = new ApplicationSerializer();
- private static final Zone zone1 = new Zone(Environment.from("prod"), RegionName.from("us-west-1"));
- private static final Zone zone2 = new Zone(Environment.from("prod"), RegionName.from("us-east-3"));
+ private static final ZoneId zone1 = new ZoneId(Environment.from("prod"), RegionName.from("us-west-1"));
+ private static final ZoneId zone2 = new ZoneId(Environment.from("prod"), RegionName.from("us-east-3"));
@Test
public void testSerialization() {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java
index bb5f129b20b..f3fa1e21eda 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java
@@ -5,6 +5,7 @@ import com.yahoo.application.container.JDisc;
import com.yahoo.application.container.handler.Request;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.TestIdentities;
@@ -76,7 +77,7 @@ public class ContainerControllerTester {
return controller().applications().createApplication(app, Optional.of(TestIdentities.userNToken));
}
- public Application deploy(Application application, ApplicationPackage applicationPackage, Zone zone, long projectId) {
+ public Application deploy(Application application, ApplicationPackage applicationPackage, ZoneId zone, long projectId) {
ScrewdriverId app1ScrewdriverId = new ScrewdriverId(String.valueOf(projectId));
GitRevision app1RevisionId = new GitRevision(new GitRepository("repo"), new GitBranch("master"), new GitCommit("commit1"));
controller().applications().deployApplication(application.id(),
@@ -132,4 +133,5 @@ public class ContainerControllerTester {
.applications.get(new com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId(application.id().application().value()))
.addRoleMember(action, AthenzService.fromScrewdriverId(screwdriverId));
}
+
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java
index 6cf90905679..f51277c26b7 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java
@@ -4,7 +4,7 @@ package com.yahoo.vespa.hosted.controller.restapi.application;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
-import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.io.IOUtils;
import com.yahoo.slime.Slime;
import com.yahoo.vespa.config.SlimeUtils;
@@ -32,7 +32,7 @@ public class ServiceApiResponseTest {
@Test
public void testServiceViewResponse() throws URISyntaxException, IOException {
- ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.prod, RegionName.from("us-west-1")),
+ ServiceApiResponse response = new ServiceApiResponse(new ZoneId(Environment.prod, RegionName.from("us-west-1")),
ApplicationId.from("tenant1", "application1", "default"),
Collections.singletonList(new URI("config-server1")),
new URI("http://server1:4080/request/path?foo=bar"));
@@ -63,7 +63,7 @@ public class ServiceApiResponseTest {
@Test
public void testServiceViewResponseWithURLs() throws URISyntaxException, IOException {
- ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.prod, RegionName.from("us-west-1")),
+ ServiceApiResponse response = new ServiceApiResponse(new ZoneId(Environment.prod, RegionName.from("us-west-1")),
ApplicationId.from("tenant2", "application2", "default"),
Collections.singletonList(new URI("http://cfg1.test/")),
new URI("http://cfg1.test/serviceview/v1/tenant/tenant2/application/application2/environment/prod/region/us-west-1/instance/default/service/searchnode-9dujk1pa0vufxrj6n4yvmi8uc/state/v1"));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
index 55a4b46f4a7..9f029d3f1c2 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
@@ -7,6 +7,7 @@ import com.yahoo.component.Version;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;
@@ -95,14 +96,14 @@ public class DeploymentApiTest extends ControllerContainerTest {
private void deployCompletely(Application application, ApplicationPackage applicationPackage, long projectId,
boolean success) {
tester.notifyJobCompletion(application.id(), projectId, true, component);
- tester.deploy(application, applicationPackage, new Zone(Environment.test,
- RegionName.from("us-east-1")), projectId);
+ tester.deploy(application, applicationPackage, new ZoneId(Environment.test,
+ RegionName.from("us-east-1")), projectId);
tester.notifyJobCompletion(application.id(), projectId, true, systemTest);
- tester.deploy(application, applicationPackage, new Zone(Environment.staging,
+ tester.deploy(application, applicationPackage, new ZoneId(Environment.staging,
RegionName.from("us-east-3")), projectId);
tester.notifyJobCompletion(application.id(), projectId, success, stagingTest);
if (success) {
- tester.deploy(application, applicationPackage, new Zone(Environment.prod,RegionName.from("corp-us-east-1")),
+ tester.deploy(application, applicationPackage, new ZoneId(Environment.prod,RegionName.from("corp-us-east-1")),
projectId);
tester.notifyJobCompletion(application.id(), projectId, true, productionCorpUsEast1);
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java
index e2c3725ea5f..4e3bc000562 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java
@@ -8,6 +8,7 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
+import com.yahoo.config.provision.ZoneId;
import com.yahoo.vespa.config.SlimeUtils;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;
@@ -39,8 +40,8 @@ import static org.junit.Assert.assertTrue;
public class ScrewdriverApiTest extends ControllerContainerTest {
private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/responses/";
- private static final Zone testZone = new Zone(Environment.test, RegionName.from("us-east-1"));
- private static final Zone stagingZone = new Zone(Environment.staging, RegionName.from("us-east-3"));
+ private static final ZoneId testZone = new ZoneId(Environment.test, RegionName.from("us-east-1"));
+ private static final ZoneId stagingZone = new ZoneId(Environment.staging, RegionName.from("us-east-3"));
@Test
public void testGetReleaseStatus() throws Exception {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java
index e03a550686f..b689645077a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java
@@ -4,7 +4,6 @@ package com.yahoo.vespa.hosted.controller.restapi.zone.v1;
import com.yahoo.application.container.handler.Request;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
-import com.yahoo.config.provision.Zone;
import com.yahoo.config.provision.ZoneId;
import com.yahoo.vespa.hosted.controller.ZoneRegistryMock;
import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester;
@@ -23,10 +22,10 @@ public class ZoneApiTest extends ControllerContainerTest {
private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/responses/";
private static final List<ZoneId> zones = Arrays.asList(
- new Zone(Environment.prod, RegionName.from("us-north-1")),
- new Zone(Environment.dev, RegionName.from("us-north-2")),
- new Zone(Environment.test, RegionName.from("us-north-3")),
- new Zone(Environment.staging, RegionName.from("us-north-4"))
+ new ZoneId(Environment.prod, RegionName.from("us-north-1")),
+ new ZoneId(Environment.dev, RegionName.from("us-north-2")),
+ new ZoneId(Environment.test, RegionName.from("us-north-3")),
+ new ZoneId(Environment.staging, RegionName.from("us-north-4"))
);
private ContainerControllerTester tester;
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java
index 3874d50f0ed..20852c48342 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java
@@ -4,7 +4,6 @@ import com.yahoo.application.container.handler.Request;
import com.yahoo.application.container.handler.Request.Method;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
-import com.yahoo.config.provision.Zone;
import com.yahoo.config.provision.ZoneId;
import com.yahoo.text.Utf8;
import com.yahoo.vespa.hosted.controller.ConfigServerProxyMock;
@@ -28,10 +27,10 @@ public class ZoneApiTest extends ControllerContainerTest {
private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/responses/";
private static final List<ZoneId> zones = Arrays.asList(
- new Zone(Environment.prod, RegionName.from("us-north-1")),
- new Zone(Environment.dev, RegionName.from("us-north-2")),
- new Zone(Environment.test, RegionName.from("us-north-3")),
- new Zone(Environment.staging, RegionName.from("us-north-4"))
+ new ZoneId(Environment.prod, RegionName.from("us-north-1")),
+ new ZoneId(Environment.dev, RegionName.from("us-north-2")),
+ new ZoneId(Environment.test, RegionName.from("us-north-3")),
+ new ZoneId(Environment.staging, RegionName.from("us-north-4"))
);
private ContainerControllerTester tester;