diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2017-12-08 15:46:56 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2017-12-08 15:46:56 +0100 |
commit | 267e1407bf2b659ccfd867c6a6210bd32b87667d (patch) | |
tree | afc5a0a20137607781e6d0bc823d00f9971d5524 /controller-server | |
parent | b8de1c1581ee0c67780a91fd89c4879c86526440 (diff) |
Replace constructor with factories
Diffstat (limited to 'controller-server')
15 files changed, 47 insertions, 55 deletions
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 27e94588626..ec8b2d6d019 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 @@ -7,7 +7,6 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; -import com.yahoo.config.provision.Zone; import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; @@ -230,7 +229,7 @@ public class DeploymentJobs { case test: return Optional.of(systemTest); case staging: return Optional.of(stagingTest); } - return from(system, new ZoneId(environment, region)); + return from(system, ZoneId.from(environment, 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 2b92bcad644..2bf64571bdf 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 @@ -2,7 +2,6 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.config.application.api.DeploymentSpec; -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; @@ -108,7 +107,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 ZoneId(z.environment(), z.region().get())) + .map(z -> ZoneId.from(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 8627744c73f..762f12c3e8a 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 @@ -339,8 +339,7 @@ public class ApplicationSerializer { } private ZoneId zoneIdFromSlime(Inspector object) { - return new ZoneId(Environment.from(object.field(environmentField).asString()), - RegionName.from(object.field(regionField).asString())); + return ZoneId.from(object.field(environmentField).asString(), object.field(regionField).asString()); } private Optional<ApplicationRevision> applicationRevisionFromSlime(Inspector object) { 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 4b2f0f88d5b..4e3b96b40df 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 @@ -423,7 +423,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { .orElseThrow(() -> new NotExistsException(id + " not found")); DeploymentId deploymentId = new DeploymentId(application.id(), - new ZoneId(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); Deployment deployment = application.deployments().get(deploymentId.zone()); if (deployment == null) @@ -514,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 ZoneId(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, 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")); @@ -526,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 ZoneId(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); Slime slime = new Slime(); Cursor c1 = slime.setObject().setArray("globalrotationoverride"); @@ -571,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 ZoneId(Environment.from(environment), RegionName.from(region))), + ZoneId.from(environment, 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 ZoneId(Environment.from(environment), RegionName.from(region)), + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(environment, region), new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(), controller.getConfigServerUris(Environment.from(environment), RegionName.from(region)), request.getUri()); @@ -587,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 ZoneId(Environment.from(environment), RegionName.from(region)), + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(environment, region), new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(), controller.getConfigServerUris(Environment.from(environment), RegionName.from(region)), request.getUri()); @@ -737,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 ZoneId(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); // TODO: Propagate all filters Optional<Hostname> hostname = Optional.ofNullable(request.getProperty("hostname")).map(Hostname::new); controller.applications().restart(deploymentId, hostname); @@ -758,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 ZoneId(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); return new JacksonJsonResponse(controller.grabLog(deploymentId)); } catch (RuntimeException e) { @@ -770,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); - ZoneId zone = new ZoneId(Environment.from(environment), RegionName.from(region)); + ZoneId zone = ZoneId.from(environment, region); Map<String, byte[]> dataParts = new MultipartParser().parse(request); if ( ! dataParts.containsKey("deployOptions")) @@ -821,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 ZoneId(Environment.from(environment), RegionName.from(region)); + ZoneId zone = ZoneId.from(environment, 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 11c918fcd83..efd3ddd80e6 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 ZoneId(Environment.prod, RegionName.from("us-east-3"))); + tester.deploy(app, ZoneId.from("prod", "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 - ZoneId zone = new ZoneId(Environment.prod, RegionName.from("cd-us-central-1")); + ZoneId zone = ZoneId.from("prod", "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 d592e57dfc6..52e1b3ae400 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 @@ -165,9 +165,12 @@ public final class ControllerTester { public ZoneId toZone(Environment environment) { switch (environment) { - 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")); + case dev: case test: + return ZoneId.from(environment, RegionName.from("us-east-1")); + case staging: + return ZoneId.from(environment, RegionName.from("us-east-3")); + default: + return ZoneId.from(environment, RegionName.from("us-west-1")); } } 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 55d71cc43bb..53af74bf542 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 @@ -7,7 +7,6 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; -import com.yahoo.config.provision.Zone; import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; @@ -32,9 +31,9 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry @Inject public ZoneRegistryMock() { - this.zones.add(new ZoneId(Environment.from("prod"), RegionName.from("corp-us-east-1"))); - this.zones.add(new ZoneId(Environment.from("prod"), RegionName.from("us-east-3"))); - this.zones.add(new ZoneId(Environment.from("prod"), RegionName.from("us-west-1"))); + this.zones.add(ZoneId.from("prod", "corp-us-east-1")); + this.zones.add(ZoneId.from("prod", "us-east-3")); + this.zones.add(ZoneId.from("prod", "us-west-1")); } public ZoneRegistryMock setDeploymentTimeToLive(ZoneId zone, Duration duration) { @@ -89,7 +88,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry @Override public Optional<Duration> getDeploymentTimeToLive(Environment environment, RegionName region) { - return Optional.ofNullable(deploymentTimeToLive.get(new ZoneId(environment, region))); + return Optional.ofNullable(deploymentTimeToLive.get(ZoneId.from(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 37bb553d905..47d62f93def 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 @@ -3,7 +3,6 @@ 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; @@ -36,7 +35,7 @@ public class DeploymentExpirerTest { @Test public void testDeploymentExpiry() throws IOException, InterruptedException { tester.controllerTester().zoneRegistry().setDeploymentTimeToLive( - new ZoneId(Environment.dev, RegionName.from("us-east-1")), + ZoneId.from(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 7304880b1c2..ac282422c89 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 @@ -4,7 +4,6 @@ package com.yahoo.vespa.hosted.controller.maintenance; 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; @@ -693,7 +692,7 @@ public class UpgraderTest { // Dev deployment which should be ignored Application dev0 = tester.createApplication("dev0", "tenant1", 7, 1L); - tester.controllerTester().deploy(dev0, new ZoneId(Environment.dev, RegionName.from("dev-region"))); + tester.controllerTester().deploy(dev0, ZoneId.from(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 ca16e1e02ba..b281b513f4a 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 @@ -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.Slime; import com.yahoo.vespa.config.SlimeUtils; @@ -49,8 +48,8 @@ public class ApplicationSerializerTest { private static final ApplicationSerializer applicationSerializer = new ApplicationSerializer(); - 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")); + private static final ZoneId zone1 = ZoneId.from("prod", "us-west-1"); + private static final ZoneId zone2 = ZoneId.from("prod", "us-east-3"); @Test public void testSerialization() { 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 f51277c26b7..4c25bf6fe61 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 @@ -32,10 +32,10 @@ public class ServiceApiResponseTest { @Test public void testServiceViewResponse() throws URISyntaxException, IOException { - 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")); + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(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")); ApplicationView applicationView = new ApplicationView(); ClusterView clusterView = new ClusterView(); clusterView.type = "container"; @@ -63,7 +63,7 @@ public class ServiceApiResponseTest { @Test public void testServiceViewResponseWithURLs() throws URISyntaxException, IOException { - ServiceApiResponse response = new ServiceApiResponse(new ZoneId(Environment.prod, RegionName.from("us-west-1")), + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(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 9f029d3f1c2..d16a0222e4a 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 @@ -6,7 +6,6 @@ import com.yahoo.application.container.handler.Request; 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; @@ -96,14 +95,12 @@ 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 ZoneId(Environment.test, - RegionName.from("us-east-1")), projectId); + tester.deploy(application, applicationPackage, ZoneId.from(Environment.test, RegionName.from("us-east-1")), projectId); tester.notifyJobCompletion(application.id(), projectId, true, systemTest); - tester.deploy(application, applicationPackage, new ZoneId(Environment.staging, - RegionName.from("us-east-3")), projectId); + tester.deploy(application, applicationPackage, ZoneId.from(Environment.staging, RegionName.from("us-east-3")), projectId); tester.notifyJobCompletion(application.id(), projectId, success, stagingTest); if (success) { - tester.deploy(application, applicationPackage, new ZoneId(Environment.prod,RegionName.from("corp-us-east-1")), + tester.deploy(application, applicationPackage, ZoneId.from(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 4e3bc000562..1269bb23105 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 @@ -7,7 +7,6 @@ import com.yahoo.component.Version; 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; @@ -40,8 +39,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 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")); + private static final ZoneId testZone = ZoneId.from(Environment.test, RegionName.from("us-east-1")); + private static final ZoneId stagingZone = ZoneId.from(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 b689645077a..2d92d10b661 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 @@ -22,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 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")) + ZoneId.from(Environment.prod, RegionName.from("us-north-1")), + ZoneId.from(Environment.dev, RegionName.from("us-north-2")), + ZoneId.from(Environment.test, RegionName.from("us-north-3")), + ZoneId.from(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 20852c48342..9c20c470cf8 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 @@ -27,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 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")) + ZoneId.from(Environment.prod, RegionName.from("us-north-1")), + ZoneId.from(Environment.dev, RegionName.from("us-north-2")), + ZoneId.from(Environment.test, RegionName.from("us-north-3")), + ZoneId.from(Environment.staging, RegionName.from("us-north-4")) ); private ContainerControllerTester tester; |