diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-09-06 11:00:44 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2019-09-09 10:34:17 +0200 |
commit | 9a306ab0c2ddd6c39a66ca802f94339e6e31935b (patch) | |
tree | c25be6180762520c413074a0a689920c6f900d22 | |
parent | 043ff31751740ab01e944c710a4fc2888195e9c7 (diff) |
Move ApplicationStore to ServiceRegistry
7 files changed, 15 insertions, 23 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java index 16f8ed4ffcc..56af17b18a5 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java @@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.api.integration; import com.yahoo.vespa.hosted.controller.api.integration.aws.AwsEventFetcher; import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationStore; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository; import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud; import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService; @@ -62,4 +63,6 @@ public interface ServiceRegistry { TesterCloud testerCloud(); + ApplicationStore applicationStore(); + } 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 6432680f71f..59d5bac5ee3 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 @@ -128,7 +128,6 @@ public class ApplicationController { ApplicationController(Controller controller, CuratorDb curator, AccessControl accessControl, RotationsConfig rotationsConfig, - ApplicationStore applicationStore, BuildService buildService, Clock clock) { this.controller = controller; this.curator = curator; @@ -137,7 +136,7 @@ public class ApplicationController { this.routingGenerator = controller.serviceRegistry().routingGenerator(); this.clock = clock; this.artifactRepository = controller.serviceRegistry().artifactRepository(); - this.applicationStore = applicationStore; + this.applicationStore = controller.serviceRegistry().applicationStore(); routingPolicies = new RoutingPolicies(controller); rotationRepository = new RotationRepository(rotationsConfig, this, curator); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java index 056598b4b0f..fa6768761b5 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java @@ -14,7 +14,6 @@ import com.yahoo.vespa.flags.FlagSource; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; import com.yahoo.vespa.hosted.controller.api.integration.RunDataStore; import com.yahoo.vespa.hosted.controller.api.integration.ServiceRegistry; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationStore; import com.yahoo.vespa.hosted.controller.api.integration.maven.MavenRepository; import com.yahoo.vespa.hosted.controller.api.integration.metrics.MetricsService; import com.yahoo.vespa.hosted.controller.api.integration.user.Roles; @@ -86,13 +85,12 @@ public class Controller extends AbstractComponent { public Controller(CuratorDb curator, RotationsConfig rotationsConfig, ZoneRegistry zoneRegistry, MetricsService metricsService, AccessControl accessControl, - ApplicationStore applicationStore, BuildService buildService, RunDataStore runDataStore, FlagSource flagSource, MavenRepository mavenRepository, ServiceRegistry serviceRegistry) { this(curator, rotationsConfig, zoneRegistry, metricsService, - Clock.systemUTC(), accessControl, applicationStore, + Clock.systemUTC(), accessControl, buildService, runDataStore, com.yahoo.net.HostName::getLocalhost, flagSource, mavenRepository, serviceRegistry); } @@ -102,7 +100,6 @@ public class Controller extends AbstractComponent { MetricsService metricsService, Clock clock, AccessControl accessControl, - ApplicationStore applicationStore, BuildService buildService, RunDataStore runDataStore, Supplier<String> hostnameSupplier, FlagSource flagSource, MavenRepository mavenRepository, ServiceRegistry serviceRegistry) { @@ -120,7 +117,6 @@ public class Controller extends AbstractComponent { jobController = new JobController(this, runDataStore); applicationController = new ApplicationController(this, curator, accessControl, Objects.requireNonNull(rotationsConfig, "RotationsConfig cannot be null"), - Objects.requireNonNull(applicationStore, "ApplicationStore cannot be null"), Objects.requireNonNull(buildService, "BuildService cannot be null"), clock ); 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 00304645edb..24f9b31e72b 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 @@ -19,7 +19,6 @@ import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions; import com.yahoo.vespa.hosted.controller.api.identifiers.Property; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationStore; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.api.integration.dns.MemoryNameService; import com.yahoo.vespa.hosted.controller.api.integration.dns.Record; @@ -32,7 +31,6 @@ import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.athenz.impl.AthenzFacade; import com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock; import com.yahoo.vespa.hosted.controller.athenz.mock.AthenzDbMock; -import com.yahoo.vespa.hosted.controller.integration.ApplicationStoreMock; import com.yahoo.vespa.hosted.controller.integration.ConfigServerMock; import com.yahoo.vespa.hosted.controller.integration.MetricsServiceMock; import com.yahoo.vespa.hosted.controller.integration.ServiceRegistryMock; @@ -74,7 +72,6 @@ public final class ControllerTester { private final ServiceRegistryMock serviceRegistry; private final CuratorDb curator; private final RotationsConfig rotationsConfig; - private final ApplicationStoreMock applicationStore; private final MockBuildService buildService; private final MetricsServiceMock metricsService; @@ -87,7 +84,6 @@ public final class ControllerTester { new ZoneRegistryMock(), curatorDb, rotationsConfig, - new ApplicationStoreMock(), new MockBuildService(), metricsService, new ServiceRegistryMock()); @@ -112,7 +108,7 @@ public final class ControllerTester { private ControllerTester(AthenzDbMock athenzDb, ManualClock clock, ZoneRegistryMock zoneRegistry, CuratorDb curator, RotationsConfig rotationsConfig, - ApplicationStoreMock appStoreMock, MockBuildService buildService, + MockBuildService buildService, MetricsServiceMock metricsService, ServiceRegistryMock serviceRegistry) { this.athenzDb = athenzDb; @@ -121,11 +117,10 @@ public final class ControllerTester { this.serviceRegistry = serviceRegistry; this.curator = curator; this.rotationsConfig = rotationsConfig; - this.applicationStore = appStoreMock; this.buildService = buildService; this.metricsService = metricsService; this.controller = createController(curator, rotationsConfig, clock, zoneRegistry, - athenzDb, appStoreMock, buildService, + athenzDb, buildService, metricsService, serviceRegistry); // Make root logger use time from manual clock @@ -164,8 +159,6 @@ public final class ControllerTester { public ServiceRegistryMock serviceRegistry() { return serviceRegistry; } - public ApplicationStoreMock applicationStore() { return applicationStore; } - public MockBuildService buildService() { return buildService; } public MetricsServiceMock metricsService() { return metricsService; } @@ -177,7 +170,7 @@ public final class ControllerTester { /** Create a new controller instance. Useful to verify that controller state is rebuilt from persistence */ public final void createNewController() { controller = createController(curator, rotationsConfig, clock, zoneRegistry, athenzDb, - applicationStore, buildService, metricsService, + buildService, metricsService, serviceRegistry); } @@ -310,7 +303,6 @@ public final class ControllerTester { ManualClock clock, ZoneRegistryMock zoneRegistryMock, AthenzDbMock athensDb, - ApplicationStore applicationStore, BuildService buildService, MetricsServiceMock metricsService, ServiceRegistryMock serviceRegistry) { Controller controller = new Controller(curator, @@ -319,7 +311,6 @@ public final class ControllerTester { metricsService, clock, new AthenzFacade(new AthenzClientFactoryMock(athensDb)), - applicationStore, buildService, new MockRunDataStore(), () -> "test-controller", diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java index 10a2741e1f4..c1fb8fdc36c 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java @@ -18,7 +18,6 @@ import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.application.JobStatus; import com.yahoo.vespa.hosted.controller.application.SystemApplication; -import com.yahoo.vespa.hosted.controller.integration.ApplicationStoreMock; import com.yahoo.vespa.hosted.controller.integration.ConfigServerMock; import com.yahoo.vespa.hosted.controller.maintenance.JobControl; import com.yahoo.vespa.hosted.controller.maintenance.NameServiceDispatcher; @@ -98,8 +97,6 @@ public class DeploymentTester { public ConfigServerMock configServer() { return tester.serviceRegistry().configServerMock(); } - public ApplicationStoreMock applicationStore() { return tester.applicationStore(); } - public Application application(String name) { return application(ApplicationId.from("tenant1", name, "default")); } 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 af31ffe73bf..1a72989f431 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 @@ -8,6 +8,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.aws.MockAwsEventFetcher import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateMock; import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationStore; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository; import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud; import com.yahoo.vespa.hosted.controller.api.integration.dns.MemoryNameService; @@ -60,6 +61,7 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg private final MockAwsEventFetcher mockAwsEventFetcher = new MockAwsEventFetcher(); private final ArtifactRepositoryMock artifactRepositoryMock = new ArtifactRepositoryMock(); private final MockTesterCloud mockTesterCloud = new MockTesterCloud(); + private final ApplicationStoreMock applicationStoreMock = new ApplicationStoreMock(); @Override public ConfigServer configServer() { @@ -142,6 +144,11 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg } @Override + public ApplicationStore applicationStore() { + return applicationStoreMock; + } + + @Override public NameService nameService() { return memoryNameService; } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java index 87102d80ef6..73e90c99b57 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java @@ -73,7 +73,6 @@ public class ControllerContainerTest { " <component id='com.yahoo.vespa.hosted.controller.integration.MetricsServiceMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.maintenance.ControllerMaintenance'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.maintenance.JobControl'/>\n" + - " <component id='com.yahoo.vespa.hosted.controller.integration.ApplicationStoreMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMavenRepository'/>\n" + " <handler id='com.yahoo.vespa.hosted.controller.restapi.deployment.DeploymentApiHandler'>\n" + " <binding>http://*/deployment/v1/*</binding>\n" + |