From 8dfb89833baa33458953178cd426e929336b114f Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Thu, 17 Jan 2019 15:31:21 +0100 Subject: Replace mutable lists with List.of --- .../controller/deployment/InternalStepRunner.java | 3 +-- .../controller/maintenance/MetricsReporter.java | 15 +++++++-------- .../proxy/ConfigServerRestExecutorImpl.java | 4 +--- .../filter/ControllerAuthorizationFilter.java | 5 ++--- .../vespa/hosted/controller/ControllerTest.java | 6 +++--- .../hosted/controller/deployment/BadgesTest.java | 6 +++--- .../deployment/InternalStepRunnerTest.java | 4 ++-- .../controller/integration/ConfigServerMock.java | 5 ++--- .../integration/NodeRepositoryClientMock.java | 6 +++--- .../integration/RoutingGeneratorMock.java | 13 ++++++------- .../controller/integration/ZoneRegistryMock.java | 11 +++++------ .../ContactInformationMaintainerTest.java | 9 +++------ .../controller/maintenance/JobRunnerTest.java | 21 ++++++++++----------- .../controller/maintenance/MaintainerTest.java | 3 +-- .../controller/maintenance/OsUpgraderTest.java | 5 ++--- .../controller/maintenance/SystemUpgraderTest.java | 7 +++---- .../persistence/BufferedLogStoreTest.java | 21 +++++++++++---------- .../controller/persistence/LogSerializerTest.java | 3 +-- .../persistence/OsVersionStatusSerializerTest.java | 5 ++--- .../persistence/TenantSerializerTest.java | 6 +++--- .../persistence/VersionStatusSerializerTest.java | 8 ++++---- .../restapi/application/ApplicationApiTest.java | 5 ++--- .../filter/ControllerAuthorizationFilterTest.java | 7 +++---- .../controller/restapi/zone/v1/ZoneApiTest.java | 9 ++++----- .../controller/restapi/zone/v2/ZoneApiTest.java | 9 ++++----- 25 files changed, 88 insertions(+), 108 deletions(-) diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index 1956a56a6a5..61226d51166 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -45,7 +45,6 @@ import java.net.URI; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Optional; @@ -646,7 +645,7 @@ public class InternalStepRunner implements StepRunner { } private void log(String... messages) { - log(Arrays.asList(messages)); + log(List.of(messages)); } private void log(List messages) { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporter.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporter.java index 2ae38fabb94..07680fc8b72 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporter.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporter.java @@ -20,7 +20,6 @@ import com.yahoo.vespa.hosted.controller.rotation.RotationLock; import java.time.Clock; import java.time.Duration; import java.time.Instant; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -80,15 +79,15 @@ public class MetricsReporter extends Maintainer { query += " AND hosted_system:" + system; } PartialNodeResult nodeResult = chefClient.partialSearchNodes(query, - Arrays.asList( + List.of( AttributeMapping.simpleMapping("fqdn"), AttributeMapping.simpleMapping("ohai_time"), - AttributeMapping.deepMapping("tenant", Arrays.asList("hosted", "owner", "tenant")), - AttributeMapping.deepMapping("application", Arrays.asList("hosted", "owner", "application")), - AttributeMapping.deepMapping("instance", Arrays.asList("hosted", "owner", "instance")), - AttributeMapping.deepMapping("environment", Arrays.asList("hosted", "environment")), - AttributeMapping.deepMapping("region", Arrays.asList("hosted", "region")), - AttributeMapping.deepMapping("system", Arrays.asList("hosted", "system")) + AttributeMapping.deepMapping("tenant", List.of("hosted", "owner", "tenant")), + AttributeMapping.deepMapping("application", List.of("hosted", "owner", "application")), + AttributeMapping.deepMapping("instance", List.of("hosted", "owner", "instance")), + AttributeMapping.deepMapping("environment", List.of("hosted", "environment")), + AttributeMapping.deepMapping("region", List.of("hosted", "region")), + AttributeMapping.deepMapping("system", List.of("hosted", "system")) )); // The above search will return a correct list if the system is CD. However for main, it will diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java index ae1102e2cef..2f10dce0e0a 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java @@ -39,9 +39,7 @@ import java.net.URI; import java.security.cert.X509Certificate; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; @@ -60,7 +58,7 @@ public class ConfigServerRestExecutorImpl implements ConfigServerRestExecutor { private static final Logger log = Logger.getLogger(ConfigServerRestExecutorImpl.class.getName()); private static final Duration PROXY_REQUEST_TIMEOUT = Duration.ofSeconds(10); - private static final Set HEADERS_TO_COPY = new HashSet<>(Arrays.asList("X-HTTP-Method-Override", "Content-Type")); + private static final Set HEADERS_TO_COPY = Set.of("X-HTTP-Method-Override", "Content-Type"); private final ZoneRegistry zoneRegistry; private final ServiceIdentityProvider sslContextProvider; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilter.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilter.java index b8e868ed8a4..77e626509b3 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilter.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilter.java @@ -17,8 +17,8 @@ import com.yahoo.vespa.athenz.api.AthenzUser; import com.yahoo.vespa.athenz.client.zms.ZmsClientException; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.TenantController; -import com.yahoo.vespa.hosted.controller.athenz.ApplicationAction; import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactory; +import com.yahoo.vespa.hosted.controller.athenz.ApplicationAction; import com.yahoo.vespa.hosted.controller.athenz.impl.ZmsClientFacade; import com.yahoo.vespa.hosted.controller.tenant.AthenzTenant; import com.yahoo.vespa.hosted.controller.tenant.Tenant; @@ -30,7 +30,6 @@ import javax.ws.rs.ForbiddenException; import javax.ws.rs.InternalServerErrorException; import javax.ws.rs.NotAuthorizedException; import javax.ws.rs.WebApplicationException; -import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.Set; @@ -52,7 +51,7 @@ import static com.yahoo.vespa.hosted.controller.athenz.HostedAthenzIdentities.SC @Provides("ControllerAuthorizationFilter") public class ControllerAuthorizationFilter extends CorsRequestFilterBase { - private static final List WHITELISTED_METHODS = Arrays.asList(GET, OPTIONS, HEAD); + private static final List WHITELISTED_METHODS = List.of(GET, OPTIONS, HEAD); private static final Logger log = Logger.getLogger(ControllerAuthorizationFilter.class.getName()); 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 343deaec752..d4dff6ecff3 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 @@ -33,7 +33,7 @@ import com.yahoo.vespa.hosted.controller.rotation.RotationLock; import org.junit.Test; import java.time.Duration; -import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Function; @@ -227,7 +227,7 @@ public class ControllerTest { ZoneId zone = ZoneId.from(Environment.defaultEnvironment(), RegionName.defaultName()); ApplicationId app = ApplicationId.from("tenant", "app1", "default"); DeploymentId deployment = new DeploymentId(app, zone); - tester.routingGenerator().putEndpoints(deployment, Arrays.asList( + tester.routingGenerator().putEndpoints(deployment, List.of( new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream2"), new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream1"), new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false, "upstream3"), @@ -256,7 +256,7 @@ public class ControllerTest { assertEquals("unit-test", findStatusByUpstream.apply("upstream1").get().getReason()); // Deployment without a global endpoint - tester.routingGenerator().putEndpoints(deployment, Arrays.asList( + tester.routingGenerator().putEndpoints(deployment, List.of( new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream2"), new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream1"), new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false, "upstream3") diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BadgesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BadgesTest.java index f219dd66dd6..e5fe658cf3b 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BadgesTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BadgesTest.java @@ -12,9 +12,9 @@ import java.net.URI; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.time.Instant; -import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; +import java.util.List; import java.util.Optional; import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest; @@ -55,12 +55,12 @@ public class BadgesTest { "/" + systemTest.jobName() + ";" + Badges.blue + "/%20;" + Badges.blue + ";s%7B" + Badges.white + "%7D" + "/%20;" + Badges.purple + ";s%7B" + Badges.white + "%7D"), - badges.historic(id, Optional.of(success), Arrays.asList(success, running))); + badges.historic(id, Optional.of(success), List.of(success, running))); assertEquals(URI.create("https://badges.tld/api/tenant.application;" + Badges.dark + "/" + systemTest.jobName() + ";" + Badges.purple + "/" + stagingTest.jobName() + ";" + Badges.red), - badges.overview(id, Arrays.asList(running, failure))); + badges.overview(id, List.of(running, failure))); } } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java index c5484e1db07..d6365eff807 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java @@ -29,8 +29,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.time.Duration; -import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Optional; import static com.yahoo.vespa.hosted.controller.api.integration.LogEntry.Type.debug; @@ -283,7 +283,7 @@ public class InternalStepRunnerTest { } private void assertTestLogEntries(RunId id, Step step, LogEntry... entries) { - assertEquals(Arrays.asList(entries), tester.jobs().details(id).get().get(step)); + assertEquals(List.of(entries), tester.jobs().details(id).get().get(step)); } @Test diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java index 45e87859576..4c60e8be677 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java @@ -29,7 +29,6 @@ import com.yahoo.vespa.serviceview.bindings.ClusterView; import com.yahoo.vespa.serviceview.bindings.ServiceView; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -84,7 +83,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer } public void bootstrap(List zones, SystemApplication... applications) { - bootstrap(zones, Arrays.asList(applications), Optional.empty()); + bootstrap(zones, List.of(applications), Optional.empty()); } public void bootstrap(List zones, List applications, Optional type) { @@ -215,7 +214,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer info.time = 2; info.message = "The info"; - return Arrays.asList(warning, info); + return List.of(warning, info); } @Override diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryClientMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryClientMock.java index 14de73e3f75..daddc46589d 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryClientMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryClientMock.java @@ -10,8 +10,8 @@ import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeRepo import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeState; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; -import java.util.Arrays; import java.util.Collection; +import java.util.List; /** * @author bjorncs @@ -37,14 +37,14 @@ public class NodeRepositoryClientMock implements NodeRepositoryClientInterface { public NodeList listNodes(ZoneId zone, boolean recursive) { NodeRepositoryNode nodeA = createNodeA(); NodeRepositoryNode nodeB = createNodeB(); - return new NodeList(Arrays.asList(nodeA, nodeB)); + return new NodeList(List.of(nodeA, nodeB)); } @Override public NodeList listNodes(ZoneId zone, String tenant, String applicationId, String instance) { NodeRepositoryNode nodeA = createNodeA(); NodeRepositoryNode nodeB = createNodeB(); - return new NodeList(Arrays.asList(nodeA, nodeB)); + return new NodeList(List.of(nodeA, nodeB)); } private static NodeRepositoryNode createNodeA() { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java index 7c32e593eec..410d7950e97 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java @@ -1,11 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.integration; +import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingEndpoint; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; -import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; @@ -22,11 +21,11 @@ public class RoutingGeneratorMock implements RoutingGenerator { private final Map> routingTable = new ConcurrentHashMap<>(); private static final List defaultEndpoints = - Arrays.asList(new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream3"), - new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream1"), - new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false, "upstream2"), - new RoutingEndpoint("http://global-endpoint.vespa.yahooapis.com:4080", "host1", true, "upstream1"), - new RoutingEndpoint("http://alias-endpoint.vespa.yahooapis.com:4080", "host1", true, "upstream1")); + List.of(new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream3"), + new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream1"), + new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false, "upstream2"), + new RoutingEndpoint("http://global-endpoint.vespa.yahooapis.com:4080", "host1", true, "upstream1"), + new RoutingEndpoint("http://alias-endpoint.vespa.yahooapis.com:4080", "host1", true, "upstream1")); @Override public List endpoints(DeploymentId deployment) { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java index 1e9a17ede12..9b13749a71a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java @@ -8,20 +8,19 @@ 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.vespa.athenz.api.AthenzService; +import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; import com.yahoo.vespa.hosted.controller.api.integration.zone.CloudName; import com.yahoo.vespa.hosted.controller.api.integration.zone.UpgradePolicy; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; -import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; -import com.yahoo.vespa.athenz.api.AthenzService; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneFilter; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneFilterMock; +import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; +import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; import java.net.URI; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -64,7 +63,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry } public ZoneRegistryMock setZones(ZoneId... zone) { - return setZones(Arrays.asList(zone)); + return setZones(List.of(zone)); } public ZoneRegistryMock setSystemName(SystemName system) { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ContactInformationMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ContactInformationMaintainerTest.java index 6a7096dbfae..ae16362e2a7 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ContactInformationMaintainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ContactInformationMaintainerTest.java @@ -4,20 +4,17 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.config.provision.TenantName; import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; -import com.yahoo.vespa.hosted.controller.api.integration.organization.User; -import com.yahoo.vespa.hosted.controller.tenant.AthenzTenant; import com.yahoo.vespa.hosted.controller.api.integration.organization.Contact; +import com.yahoo.vespa.hosted.controller.tenant.AthenzTenant; import org.junit.Before; import org.junit.Test; import java.net.URI; import java.time.Duration; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.function.Supplier; -import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -63,8 +60,8 @@ public class ContactInformationMaintainerTest { URI contactUrl = URI.create("http://contact1.test"); URI issueTrackerUrl = URI.create("http://issue-tracker1.test"); URI propertyUrl = URI.create("http://property1.test"); - List> persons = Arrays.asList(Collections.singletonList("alice"), - Collections.singletonList("bob")); + List> persons = List.of(Collections.singletonList("alice"), + Collections.singletonList("bob")); String queue = "queue"; Optional component = Optional.empty(); return new Contact(contactUrl, propertyUrl, issueTrackerUrl, persons, queue, component); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java index 8ebb8c108c0..2539687ea4d 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java @@ -4,8 +4,8 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.vespa.athenz.api.OktaAccessToken; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.SourceRevision; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; @@ -19,7 +19,6 @@ import com.yahoo.vespa.hosted.controller.deployment.Versions; import org.junit.Test; import java.time.Duration; -import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; import java.util.List; @@ -75,7 +74,7 @@ public class JobRunnerTest { Optional.empty()); @Test - public void multiThreadedExecutionFinishes() throws InterruptedException { + public void multiThreadedExecutionFinishes() { DeploymentTester tester = new DeploymentTester(); JobController jobs = tester.controller().jobController(); StepRunner stepRunner = (step, id) -> id.type() == stagingTest && step.get() == startTests? Optional.of(error) : Optional.of(running); @@ -124,38 +123,38 @@ public class JobRunnerTest { Map steps = run.get().steps(); runner.maintain(); assertEquals(steps, run.get().steps()); - assertEquals(Arrays.asList(deployReal, deployTester), run.get().readySteps()); + assertEquals(List.of(deployReal, deployTester), run.get().readySteps()); outcomes.put(deployReal, running); runner.maintain(); - assertEquals(Arrays.asList(installReal, deployTester), run.get().readySteps()); + assertEquals(List.of(installReal, deployTester), run.get().readySteps()); outcomes.put(installReal, running); runner.maintain(); - assertEquals(Arrays.asList(deployTester), run.get().readySteps()); + assertEquals(List.of(deployTester), run.get().readySteps()); outcomes.put(deployTester, running); runner.maintain(); - assertEquals(Arrays.asList(installTester), run.get().readySteps()); + assertEquals(List.of(installTester), run.get().readySteps()); outcomes.put(installTester, running); runner.maintain(); - assertEquals(Arrays.asList(startTests), run.get().readySteps()); + assertEquals(List.of(startTests), run.get().readySteps()); outcomes.put(startTests, running); runner.maintain(); - assertEquals(Arrays.asList(endTests), run.get().readySteps()); + assertEquals(List.of(endTests), run.get().readySteps()); // Failure ending tests fails the run, but run-always steps continue. outcomes.put(endTests, testFailure); runner.maintain(); assertTrue(run.get().hasFailed()); - assertEquals(Arrays.asList(deactivateReal, deactivateTester), run.get().readySteps()); + assertEquals(List.of(deactivateReal, deactivateTester), run.get().readySteps()); // Abortion does nothing, as the run has already failed. jobs.abort(run.get().id()); runner.maintain(); - assertEquals(Arrays.asList(deactivateReal, deactivateTester), run.get().readySteps()); + assertEquals(List.of(deactivateReal, deactivateTester), run.get().readySteps()); outcomes.put(deactivateReal, running); outcomes.put(deactivateTester, running); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MaintainerTest.java index d6fd9d88fd9..3aa1f2b5af2 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MaintainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MaintainerTest.java @@ -9,7 +9,6 @@ import org.junit.Test; import java.time.Duration; import java.time.Instant; -import java.util.Arrays; import java.util.EnumSet; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -38,7 +37,7 @@ public class MaintainerTest { @Test public void staggering() { - List cluster = Arrays.asList(HostName.from("cfg1"), HostName.from("cfg2"), HostName.from("cfg3")); + List cluster = List.of(HostName.from("cfg1"), HostName.from("cfg2"), HostName.from("cfg3")); Instant now = Instant.ofEpochMilli(1001); Duration interval = Duration.ofMillis(300); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgraderTest.java index a21c3bb272d..c3915a4b772 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgraderTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgraderTest.java @@ -16,7 +16,6 @@ import org.junit.Before; import org.junit.Test; import java.time.Duration; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -60,12 +59,12 @@ public class OsUpgraderTest { ); // Bootstrap system - tester.configServer().bootstrap(Arrays.asList(zone1, zone2, zone3, zone4, zone5), + tester.configServer().bootstrap(List.of(zone1, zone2, zone3, zone4, zone5), singletonList(SystemApplication.zone), Optional.of(NodeType.host)); // Add system applications that exist in a real system, but are currently not upgraded - tester.configServer().addNodes(Arrays.asList(zone1, zone2, zone3, zone4, zone5), + tester.configServer().addNodes(List.of(zone1, zone2, zone3, zone4, zone5), Collections.singletonList(SystemApplication.configServer), Optional.empty()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java index 8f7b73bc0d1..d832a75eaaa 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java @@ -12,7 +12,6 @@ import org.junit.Before; import org.junit.Test; import java.time.Duration; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -50,7 +49,7 @@ public class SystemUpgraderTest { Version version1 = Version.fromString("6.5"); // Bootstrap a system without host applications - tester.configServer().bootstrap(Arrays.asList(zone1, zone2, zone3, zone4), SystemApplication.configServer, + tester.configServer().bootstrap(List.of(zone1, zone2, zone3, zone4), SystemApplication.configServer, SystemApplication.zone); // Fail a few nodes. Failed nodes should not affect versions failNodeIn(zone1, SystemApplication.configServer); @@ -184,7 +183,7 @@ public class SystemUpgraderTest { ); Version version1 = Version.fromString("6.5"); - tester.configServer().bootstrap(Arrays.asList(zone1, zone2, zone3, zone4), SystemApplication.all(), Optional.empty()); + tester.configServer().bootstrap(List.of(zone1, zone2, zone3, zone4), SystemApplication.all(), Optional.empty()); tester.upgradeSystem(version1); systemUpgrader.maintain(); assertCurrentVersion(SystemApplication.all(), version1, zone1, zone2, zone3, zone4); @@ -196,7 +195,7 @@ public class SystemUpgraderTest { // System upgrades in zone 1: systemUpgrader.maintain(); - List allExceptZone = Arrays.asList(SystemApplication.configServerHost, + List allExceptZone = List.of(SystemApplication.configServerHost, SystemApplication.proxyHost, SystemApplication.configServer); completeUpgrade(allExceptZone, version2, zone1); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java index cf8962cc631..a6022d259be 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java @@ -2,17 +2,18 @@ package com.yahoo.vespa.hosted.controller.persistence; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.vespa.hosted.controller.api.integration.LogEntry; import com.yahoo.vespa.hosted.controller.api.integration.RunDataStore; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockRunDataStore; -import com.yahoo.vespa.hosted.controller.api.integration.LogEntry; import com.yahoo.vespa.hosted.controller.deployment.RunLog; import com.yahoo.vespa.hosted.controller.deployment.Step; import org.junit.Test; import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Optional; import static org.junit.Assert.assertArrayEquals; @@ -42,23 +43,23 @@ public class BufferedLogStoreTest { assertEquals(RunLog.empty(), logs.readActive(id.application(), id.type(), -1)); logs.append(id.application(), id.type(), Step.deployReal, Collections.singletonList(entry)); - assertEquals(Arrays.asList(entry0), + assertEquals(List.of(entry0), logs.readActive(id.application(), id.type(), -1).get(Step.deployReal)); assertEquals(RunLog.empty(), logs.readActive(id.application(), id.type(), 0)); logs.append(id.application(), id.type(), Step.deployReal, Collections.singletonList(entry)); - assertEquals(Arrays.asList(entry0, entry1), + assertEquals(List.of(entry0, entry1), logs.readActive(id.application(), id.type(), -1).get(Step.deployReal)); - assertEquals(Arrays.asList(entry1), + assertEquals(List.of(entry1), logs.readActive(id.application(), id.type(), 0).get(Step.deployReal)); assertEquals(RunLog.empty(), logs.readActive(id.application(), id.type(), 1)); logs.append(id.application(), id.type(), Step.deployReal, Collections.singletonList(entry)); - assertEquals(Arrays.asList(entry0, entry1, entry2), + assertEquals(List.of(entry0, entry1, entry2), logs.readActive(id.application(), id.type(), -1).get(Step.deployReal)); - assertEquals(Arrays.asList(entry1, entry2), + assertEquals(List.of(entry1, entry2), logs.readActive(id.application(), id.type(), 0).get(Step.deployReal)); - assertEquals(Arrays.asList(entry2), + assertEquals(List.of(entry2), logs.readActive(id.application(), id.type(), 1).get(Step.deployReal)); assertEquals(RunLog.empty(), logs.readActive(id.application(), id.type(), 2)); @@ -72,11 +73,11 @@ public class BufferedLogStoreTest { assertArrayEquals(new long[]{}, buffer.getLogChunkIds(id.application(), id.type()).toArray()); assertEquals(RunLog.empty(), logs.readActive(id.application(), id.type(), -1)); - assertEquals(Arrays.asList(entry0, entry1, entry2), + assertEquals(List.of(entry0, entry1, entry2), logs.readFinished(id, -1).get().get(Step.deployReal)); - assertEquals(Arrays.asList(entry1, entry2), + assertEquals(List.of(entry1, entry2), logs.readFinished(id, 0).get().get(Step.deployReal)); - assertEquals(Arrays.asList(entry2), + assertEquals(List.of(entry2), logs.readFinished(id, 1).get().get(Step.deployReal)); assertEquals(Collections.emptyList(), logs.readFinished(id, 2).get().get(Step.deployReal)); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/LogSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/LogSerializerTest.java index c3e215cb792..a53a026eff6 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/LogSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/LogSerializerTest.java @@ -10,7 +10,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -58,7 +57,7 @@ public class LogSerializerTest { expected.get(deployTester).add(second); expected.get(deployTester).add(fourth); - assertEquals(expected, serializer.fromJson(Arrays.asList(logJson, logJson), -1)); + assertEquals(expected, serializer.fromJson(List.of(logJson, logJson), -1)); } } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/OsVersionStatusSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/OsVersionStatusSerializerTest.java index 9840bec0f9a..6e2298fd64e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/OsVersionStatusSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/OsVersionStatusSerializerTest.java @@ -10,7 +10,6 @@ import com.yahoo.vespa.hosted.controller.versions.OsVersion; import com.yahoo.vespa.hosted.controller.versions.OsVersionStatus; import org.junit.Test; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -28,11 +27,11 @@ public class OsVersionStatusSerializerTest { Version version2 = Version.fromString("7.2"); Map> versions = new TreeMap<>(); - versions.put(new OsVersion(version1, CloudName.defaultName()), Arrays.asList( + versions.put(new OsVersion(version1, CloudName.defaultName()), List.of( new OsVersionStatus.Node(HostName.from("node1"), version1, Environment.prod, RegionName.from("us-west")), new OsVersionStatus.Node(HostName.from("node2"), version1, Environment.prod, RegionName.from("us-east")) )); - versions.put(new OsVersion(version2, CloudName.defaultName()), Arrays.asList( + versions.put(new OsVersion(version2, CloudName.defaultName()), List.of( new OsVersionStatus.Node(HostName.from("node3"), version2, Environment.prod, RegionName.from("us-west")), new OsVersionStatus.Node(HostName.from("node4"), version2, Environment.prod, RegionName.from("us-east")) diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java index f3790e6d291..2e0d7715d7d 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java @@ -5,14 +5,14 @@ import com.yahoo.config.provision.TenantName; import com.yahoo.vespa.athenz.api.AthenzDomain; import com.yahoo.vespa.hosted.controller.api.identifiers.Property; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; -import com.yahoo.vespa.hosted.controller.tenant.AthenzTenant; import com.yahoo.vespa.hosted.controller.api.integration.organization.Contact; +import com.yahoo.vespa.hosted.controller.tenant.AthenzTenant; import com.yahoo.vespa.hosted.controller.tenant.UserTenant; import org.junit.Test; import java.net.URI; -import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Optional; import static org.junit.Assert.assertEquals; @@ -75,7 +75,7 @@ public class TenantSerializerTest { URI.create("http://contact1.test"), URI.create("http://property1.test"), URI.create("http://issue-tracker-1.test"), - Arrays.asList( + List.of( Collections.singletonList("person1"), Collections.singletonList("person2") ), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/VersionStatusSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/VersionStatusSerializerTest.java index 87e145f9f93..5e6f9811376 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/VersionStatusSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/VersionStatusSerializerTest.java @@ -30,10 +30,10 @@ public class VersionStatusSerializerTest { DeploymentStatistics statistics = new DeploymentStatistics( Version.fromString("5.0"), Collections.singletonList(ApplicationId.from("tenant1", "failing1", "default")), - Arrays.asList(ApplicationId.from("tenant2", "success1", "default"), - ApplicationId.from("tenant2", "success2", "default")), - Arrays.asList(ApplicationId.from("tenant1", "failing1", "default"), - ApplicationId.from("tenant2", "success2", "default")) + List.of(ApplicationId.from("tenant2", "success1", "default"), + ApplicationId.from("tenant2", "success2", "default")), + List.of(ApplicationId.from("tenant1", "failing1", "default"), + ApplicationId.from("tenant2", "success2", "default")) ); vespaVersions.add(new VespaVersion(statistics, "dead", Instant.now(), false, false, asHostnames("cfg1", "cfg2", "cfg3"), VespaVersion.Confidence.normal)); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java index 38dd6877703..cd804e2ebfb 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java @@ -71,7 +71,6 @@ import java.net.URI; import java.nio.charset.StandardCharsets; import java.time.Instant; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -1485,13 +1484,13 @@ public class ApplicationApiTest extends ControllerContainerTest { } private void updateContactInformation() { - Contact contact = new Contact(URI.create("www.contacts.tld/1234"), URI.create("www.properties.tld/1234"), URI.create("www.issues.tld/1234"), Arrays.asList(Arrays.asList("alice"), Arrays.asList("bob")), "queue", Optional.empty()); + Contact contact = new Contact(URI.create("www.contacts.tld/1234"), URI.create("www.properties.tld/1234"), URI.create("www.issues.tld/1234"), List.of(List.of("alice"), List.of("bob")), "queue", Optional.empty()); tester.controller().tenants().lockIfPresent(TenantName.from("tenant2"), lockedTenant -> tester.controller().tenants().store(lockedTenant.with(contact))); } private void registerContact(long propertyId) { PropertyId p = new PropertyId(String.valueOf(propertyId)); - contactRetriever().addContact(p, new Contact(URI.create("www.issues.tld/" + p.id()), URI.create("www.contacts.tld/" + p.id()), URI.create("www.properties.tld/" + p.id()), Arrays.asList(Collections.singletonList("alice"), + contactRetriever().addContact(p, new Contact(URI.create("www.issues.tld/" + p.id()), URI.create("www.contacts.tld/" + p.id()), URI.create("www.properties.tld/" + p.id()), List.of(Collections.singletonList("alice"), Collections.singletonList("bob")), "queue", Optional.empty())); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilterTest.java index 19aa247edb4..9b7c36c49e1 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilterTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/filter/ControllerAuthorizationFilterTest.java @@ -31,7 +31,6 @@ import static com.yahoo.jdisc.http.HttpRequest.Method.DELETE; import static com.yahoo.jdisc.http.HttpRequest.Method.POST; import static com.yahoo.jdisc.http.HttpRequest.Method.PUT; import static com.yahoo.jdisc.http.HttpResponse.Status.FORBIDDEN; -import static java.util.Arrays.asList; import static java.util.Collections.singleton; import static java.util.Collections.singletonList; import static org.junit.Assert.assertEquals; @@ -87,7 +86,7 @@ public class ControllerAuthorizationFilterTest { ControllerAuthorizationFilter filter = createFilter(controllerTester); - List allowed = asList(HOSTED_OPERATOR, TENANT_ADMIN); + List allowed = List.of(HOSTED_OPERATOR, TENANT_ADMIN); List forbidden = singletonList(USER); testApiAccess(DELETE, "/application/v4/tenant/mytenant", @@ -110,8 +109,8 @@ public class ControllerAuthorizationFilterTest { ControllerAuthorizationFilter filter = createFilter(controllerTester); - List allowed = asList(HOSTED_OPERATOR, TENANT_PIPELINE); - List forbidden = asList(TENANT_ADMIN, USER); + List allowed = List.of(HOSTED_OPERATOR, TENANT_PIPELINE); + List forbidden = List.of(TENANT_ADMIN, USER); testApiAccess(POST, "/application/v4/tenant/mytenant/application/myapp/environment/prod/region/myregion/instance/default/deploy", allowed, forbidden, filter); 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 4fbdbdcc813..a7832ccbc1f 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 @@ -3,15 +3,14 @@ package com.yahoo.vespa.hosted.controller.restapi.zone.v1; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; +import com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock; import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest; import org.junit.Before; import org.junit.Test; import java.io.File; -import java.util.Arrays; import java.util.List; /** @@ -20,7 +19,7 @@ import java.util.List; 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 zones = Arrays.asList( + private static final List zones = List.of( 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")), @@ -39,7 +38,7 @@ public class ZoneApiTest extends ControllerContainerTest { } @Test - public void test_requests() throws Exception { + public void test_requests() { // GET /zone/v1 tester.containerTester().assertResponse(authenticatedRequest("http://localhost:8080/zone/v1"), new File("root.json")); @@ -54,7 +53,7 @@ public class ZoneApiTest extends ControllerContainerTest { } @Test - public void test_invalid_requests() throws Exception { + public void test_invalid_requests() { // GET /zone/v1/environment/prod/default: No default region tester.containerTester().assertResponse(authenticatedRequest("http://localhost:8080/zone/v1/environment/prod/default"), new File("no-default-region.json"), 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 2123d32953d..f62f6e21910 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 @@ -8,16 +8,15 @@ import com.yahoo.config.provision.RegionName; import com.yahoo.text.Utf8; import com.yahoo.vespa.athenz.api.AthenzIdentity; import com.yahoo.vespa.athenz.api.AthenzUser; +import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.integration.ConfigServerProxyMock; import com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest; import org.junit.Before; import org.junit.Test; import java.io.File; -import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; @@ -30,7 +29,7 @@ public class ZoneApiTest extends ControllerContainerTest { private static final AthenzIdentity HOSTED_VESPA_OPERATOR = AthenzUser.fromUserId("johnoperator"); private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/responses/"; - private static final List zones = Arrays.asList( + private static final List zones = List.of( 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")), @@ -52,7 +51,7 @@ public class ZoneApiTest extends ControllerContainerTest { } @Test - public void test_requests() throws Exception { + public void test_requests() { // GET /zone/v2 tester.containerTester().assertResponse(authenticatedRequest("http://localhost:8080/zone/v2"), new File("root.json")); @@ -111,7 +110,7 @@ public class ZoneApiTest extends ControllerContainerTest { } @Test - public void test_invalid_requests() throws Exception { + public void test_invalid_requests() { // POST /zone/v2/prod/us-north-34/nodes/v2 tester.containerTester().assertResponse(hostedOperatorRequest("http://localhost:8080/zone/v2/prod/us-north-42/nodes/v2", new byte[0], Method.POST), -- cgit v1.2.3