diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-09-13 14:49:41 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2019-09-13 14:49:41 +0200 |
commit | 071242cb90a62e867e81b0d923a9c7bc0c6a76c0 (patch) | |
tree | d16025abb3df6c46f9ccc95756d2bfc6faf5c0a3 /controller-server/src/test/java | |
parent | a75d98e927fcd4b574f697bdfaa4f01930afc12e (diff) |
Move RoutingGeneratorMock to controller-api
Diffstat (limited to 'controller-server/src/test/java')
3 files changed, 2 insertions, 64 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java index a20e768fb02..879007494db 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java @@ -25,7 +25,7 @@ import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion; import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzDbMock; import com.yahoo.vespa.hosted.controller.integration.ConfigServerMock; -import com.yahoo.vespa.hosted.controller.integration.RoutingGeneratorMock; +import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGeneratorMock; import com.yahoo.vespa.hosted.controller.maintenance.JobControl; import com.yahoo.vespa.hosted.controller.maintenance.JobRunner; import com.yahoo.vespa.hosted.controller.maintenance.JobRunnerTest; 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 deleted file mode 100644 index a4fbee6a579..00000000000 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java +++ /dev/null @@ -1,63 +0,0 @@ -// 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.config.provision.ClusterSpec; -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 java.net.URI; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -/** - * Returns a default set of endpoints on every query if it has no mappings, or those added by the user, otherwise. - * - * @author bratseth - * @author jonmv - */ -public class RoutingGeneratorMock implements RoutingGenerator { - - public static final List<RoutingEndpoint> TEST_ENDPOINTS = - 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")); - - private final Map<DeploymentId, List<RoutingEndpoint>> routingTable = new ConcurrentHashMap<>(); - private final List<RoutingEndpoint> defaultEndpoints; - - public RoutingGeneratorMock() { - this(List.of()); - } - - public RoutingGeneratorMock(List<RoutingEndpoint> endpoints) { - this.defaultEndpoints = List.copyOf(endpoints); - } - - @Override - public List<RoutingEndpoint> endpoints(DeploymentId deployment) { - if (routingTable.isEmpty()) return defaultEndpoints; - return routingTable.getOrDefault(deployment, List.of()); - } - - @Override - public Map<ClusterSpec.Id, URI> clusterEndpoints(DeploymentId deployment) { - return endpoints(deployment).stream() - .limit(1) - .collect(Collectors.toMap(__ -> ClusterSpec.Id.from("default"), - endpoint -> URI.create(endpoint.endpoint()))); - } - - public void putEndpoints(DeploymentId deployment, List<RoutingEndpoint> endpoints) { - routingTable.put(deployment, endpoints); - } - - public void removeEndpoints(DeploymentId deployment) { - routingTable.remove(deployment); - } - -} diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java index 255495b7f53..965e1db0e2e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java @@ -31,6 +31,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService; import com.yahoo.vespa.hosted.controller.api.integration.routing.MemoryGlobalRoutingService; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; +import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGeneratorMock; import com.yahoo.vespa.hosted.controller.api.integration.stubs.DummyOwnershipIssues; import com.yahoo.vespa.hosted.controller.api.integration.stubs.LoggingDeploymentIssues; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockBuildService; |