aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-11-05 11:35:22 +0100
committerJon Marius Venstad <venstad@gmail.com>2019-11-06 12:08:46 +0100
commit2c8bb1153a6d9834c573e99a786637a5da52eee5 (patch)
tree266edfc003eabf9a781376c59b8ad13301a68c27 /controller-server/src/test/java
parentddacf654b37bea5f8b616def1c66c5c2c4a28e0e (diff)
Remove ZoneRegistryMock from services.xml in tests
Diffstat (limited to 'controller-server/src/test/java')
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java34
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java9
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/metric/ConfigServerMetricsTest.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java1
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java11
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java9
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java11
7 files changed, 26 insertions, 52 deletions
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 976f2dead8f..83d9d4d1ad0 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
@@ -2,36 +2,21 @@
package com.yahoo.vespa.hosted.controller.integration;
import com.google.inject.Inject;
+import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.component.AbstractComponent;
+import com.yahoo.config.provision.SystemName;
import com.yahoo.test.ManualClock;
-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.aws.AwsEventFetcher;
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.dns.MemoryNameService;
-import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService;
-import com.yahoo.vespa.hosted.controller.api.integration.entity.EntityService;
import com.yahoo.vespa.hosted.controller.api.integration.entity.MemoryEntityService;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.Billing;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.ContactRetriever;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.DeploymentIssues;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueHandler;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.Mailer;
import com.yahoo.vespa.hosted.controller.api.integration.organization.MockBilling;
import com.yahoo.vespa.hosted.controller.api.integration.organization.MockContactRetriever;
import com.yahoo.vespa.hosted.controller.api.integration.organization.MockIssueHandler;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.OwnershipIssues;
-import com.yahoo.vespa.hosted.controller.api.integration.resource.CostReportConsumer;
import com.yahoo.vespa.hosted.controller.api.integration.resource.CostReportConsumerMock;
-import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient;
import com.yahoo.vespa.hosted.controller.api.integration.resource.MockTenantCost;
-import com.yahoo.vespa.hosted.controller.api.integration.resource.TenantCost;
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;
@@ -43,9 +28,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMeteringClient;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockRunDataStore;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockTesterCloud;
-import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
-
-import java.time.Clock;
/**
* A mock implementation of a {@link ServiceRegistry} for testing purposes.
@@ -78,14 +60,18 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
private final MockBuildService mockBuildService = new MockBuildService();
private final MockTenantCost mockTenantCost = new MockTenantCost();
+ public ServiceRegistryMock(SystemName system) {
+ this.zoneRegistryMock = new ZoneRegistryMock(system);
+ this.configServerMock = new ConfigServerMock(zoneRegistryMock);
+ }
+
@Inject
- public ServiceRegistryMock(ZoneRegistryMock zoneRegistry) {
- this.zoneRegistryMock = zoneRegistry;
- this.configServerMock = new ConfigServerMock(zoneRegistry);
+ public ServiceRegistryMock(ConfigserverConfig config) {
+ this(SystemName.from(config.system()));
}
public ServiceRegistryMock() {
- this(new ZoneRegistryMock());
+ this(SystemName.main);
}
@Override
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 f5158a1ffa2..07db06164c6 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
@@ -40,15 +40,6 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry
private UpgradePolicy upgradePolicy = null;
private Map<CloudName, UpgradePolicy> osUpgradePolicies = new HashMap<>();
- @Inject
- public ZoneRegistryMock(ConfigserverConfig config) {
- this(SystemName.from(config.system()));
- }
-
- public ZoneRegistryMock() {
- this(SystemName.main);
- }
-
/**
* This sets the default list of zones contained in this. If your test need a particular set of zones, use
* {@link #setZones(List)} instead of changing the default set.}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/metric/ConfigServerMetricsTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/metric/ConfigServerMetricsTest.java
index 23a6c6286c0..23e86320a78 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/metric/ConfigServerMetricsTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/metric/ConfigServerMetricsTest.java
@@ -1,6 +1,7 @@
package com.yahoo.vespa.hosted.controller.metric;
import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
@@ -31,7 +32,7 @@ public class ConfigServerMetricsTest {
@Before
public void before() {
- configServer = new ConfigServerMock(new ZoneRegistryMock());
+ configServer = new ConfigServerMock(new ZoneRegistryMock(SystemName.main));
service = new ConfigServerMetrics(configServer);
}
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 1a53920e8de..dc6abcb2616 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
@@ -70,7 +70,6 @@ public class ControllerContainerTest {
" <component id='com.yahoo.vespa.curator.mock.MockCurator'/>\n" +
" <component id='com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb'/>\n" +
" <component id='com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactoryMock'/>\n" +
- " <component id='com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock'/>\n" +
" <component id='com.yahoo.vespa.hosted.controller.integration.ServiceRegistryMock'/>\n" +
" <component id='com.yahoo.vespa.hosted.controller.Controller'/>\n" +
" <component id='com.yahoo.vespa.hosted.controller.integration.ConfigServerProxyMock'/>\n" +
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java
index e723b5a2f30..8aea26f21e3 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java
@@ -38,12 +38,11 @@ public class ConfigServerApiHandlerTest extends ControllerContainerTest {
@Before
public void before() {
- ZoneRegistryMock zoneRegistry = (ZoneRegistryMock) container.components()
- .getComponent(ZoneRegistryMock.class.getName());
- zoneRegistry.setDefaultRegionForEnvironment(Environment.dev, RegionName.from("us-north-2"))
- .setZones(zones);
- this.tester = new ContainerTester(container, responseFiles);
- this.proxy = (ConfigServerProxyMock) container.components().getComponent(ConfigServerProxyMock.class.getName());
+ tester = new ContainerTester(container, responseFiles);
+ tester.serviceRegistry().zoneRegistry()
+ .setDefaultRegionForEnvironment(Environment.dev, RegionName.from("us-north-2"))
+ .setZones(zones);
+ proxy = (ConfigServerProxyMock) container.components().getComponent(ConfigServerProxyMock.class.getName());
}
@Test
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 73c64b0ee5d..eaeba420bc9 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
@@ -34,11 +34,10 @@ public class ZoneApiTest extends ControllerContainerCloudTest {
@Before
public void before() {
- ZoneRegistryMock zoneRegistry = (ZoneRegistryMock) container.components()
- .getComponent(ZoneRegistryMock.class.getName());
- zoneRegistry.setDefaultRegionForEnvironment(Environment.dev, RegionName.from("us-north-2"))
- .setZones(zones);
- this.tester = new ContainerTester(container, responseFiles);
+ tester = new ContainerTester(container, responseFiles);
+ tester.serviceRegistry().zoneRegistry()
+ .setDefaultRegionForEnvironment(Environment.dev, RegionName.from("us-north-2"))
+ .setZones(zones);
}
@Test
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 50b1db50c19..f00363989e6 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
@@ -39,12 +39,11 @@ public class ZoneApiTest extends ControllerContainerTest {
@Before
public void before() {
- ZoneRegistryMock zoneRegistry = (ZoneRegistryMock) container.components()
- .getComponent(ZoneRegistryMock.class.getName());
- zoneRegistry.setDefaultRegionForEnvironment(Environment.dev, RegionName.from("us-north-2"))
- .setZones(zones);
- this.tester = new ContainerTester(container, responseFiles);
- this.proxy = (ConfigServerProxyMock) container.components().getComponent(ConfigServerProxyMock.class.getName());
+ tester = new ContainerTester(container, responseFiles);
+ tester.serviceRegistry().zoneRegistry()
+ .setDefaultRegionForEnvironment(Environment.dev, RegionName.from("us-north-2"))
+ .setZones(zones);
+ proxy = (ConfigServerProxyMock) container.components().getComponent(ConfigServerProxyMock.class.getName());
}
@Test