summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2018-11-20 08:15:03 +0100
committerHarald Musum <musum@oath.com>2018-11-20 08:15:03 +0100
commit2a7c2910381198d6228c3bf0d2f0af9a296b4639 (patch)
tree0fa096ef39066d1eca095432475a490f0a8d642c
parent9261b2c75520788fd90092bdd1a67c426fc0dbb5 (diff)
Cleanup
-rw-r--r--athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/instanceconfirmation/InstanceValidatorTest.java3
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/model/api/SuperModel.java28
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelControllerTest.java6
-rw-r--r--service-monitor/src/test/java/com/yahoo/vespa/service/monitor/internal/ExampleModel.java2
4 files changed, 10 insertions, 29 deletions
diff --git a/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/instanceconfirmation/InstanceValidatorTest.java b/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/instanceconfirmation/InstanceValidatorTest.java
index a21c65c40d5..bb70a5981b8 100644
--- a/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/instanceconfirmation/InstanceValidatorTest.java
+++ b/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/instanceconfirmation/InstanceValidatorTest.java
@@ -197,8 +197,7 @@ public class InstanceValidatorTest {
ApplicationInfo::getApplicationId,
Function.identity()
)
- ),
- false);
+ ));
SuperModelProvider superModelProvider = mock(SuperModelProvider.class);
when(superModelProvider.getSuperModel()).thenReturn(superModel);
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModel.java b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModel.java
index 100d4aedd9a..52adc4ad51b 100644
--- a/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModel.java
+++ b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModel.java
@@ -22,36 +22,18 @@ public class SuperModel {
this.models = Collections.emptyMap();
}
- // TODO: Remove when oldest model used is 6.309 or newer
- public SuperModel(Map<TenantName, Map<ApplicationId, ApplicationInfo>> models) {
- this.models = new LinkedHashMap<>();
- models.values().forEach(entry -> entry.forEach(this.models::put));
+ public SuperModel(Map<ApplicationId, ApplicationInfo> models) {
+ this.models = models;
}
// TODO: The ignored parameter is just to circumvent the fact that you cannot have
// two constructors with same type erasure, the above will be removed and this one can
// be fixed
+ // TODO: Remove when oldest model used is 6.315 or newer
public SuperModel(Map<ApplicationId, ApplicationInfo> models, boolean ignored) {
this.models = models;
}
- /**
- * Do NOT mutate the returned map.
- * TODO: Make the returned map immutable (and type to Map&lt;ApplicationId, ApplicationInfo&gt;)
- */
- // TODO: Remove when oldest model used is 6.310 or newer
- public Map<TenantName, Map<ApplicationId, ApplicationInfo>> getAllModels() {
- Map<TenantName, Map<ApplicationId, ApplicationInfo>> newModels = new LinkedHashMap<>();
-
- this.models.forEach((key, value) -> {
- if (!newModels.containsKey(key.tenant())) {
- newModels.put(key.tenant(), new LinkedHashMap<>());
- }
- newModels.get(key.tenant()).put(key, value);
- });
- return newModels ;
- }
-
public Map<TenantName, Set<ApplicationInfo>> getModelsPerTenant() {
Map<TenantName, Set<ApplicationInfo>> newModels = new LinkedHashMap<>();
@@ -81,14 +63,14 @@ public class SuperModel {
Map<ApplicationId, ApplicationInfo> newModels = cloneModels(models);
newModels.put(application.getApplicationId(), application);
- return new SuperModel(newModels, false);
+ return new SuperModel(newModels);
}
public SuperModel cloneAndRemoveApplication(ApplicationId applicationId) {
Map<ApplicationId, ApplicationInfo> newModels = cloneModels(models);
newModels.remove(applicationId);
- return new SuperModel(newModels, false);
+ return new SuperModel(newModels);
}
private static Map<ApplicationId, ApplicationInfo> cloneModels(Map<ApplicationId, ApplicationInfo> models) {
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelControllerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelControllerTest.java
index 7dead49f999..0595be3230f 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelControllerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelControllerTest.java
@@ -53,7 +53,7 @@ public class SuperModelControllerTest {
ApplicationId app = ApplicationId.from(TenantName.from("a"),
ApplicationName.from("foo"), InstanceName.defaultName());
models.put(app, new ApplicationInfo(app, 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp))));
- SuperModel superModel = new SuperModel(models, false);
+ SuperModel superModel = new SuperModel(models);
handler = new SuperModelController(new SuperModelConfigProvider(superModel, Zone.defaultZone()), new TestConfigDefinitionRepo(), 2, new UncompressedConfigResponseFactory());
}
@@ -96,7 +96,7 @@ public class SuperModelControllerTest {
models.put(advanced, createApplicationInfo(testApp2, advanced, 4l));
models.put(tooAdvanced, createApplicationInfo(testApp3, tooAdvanced, 4l));
- SuperModel superModel = new SuperModel(models, false);
+ SuperModel superModel = new SuperModel(models);
SuperModelController han = new SuperModelController(new SuperModelConfigProvider(superModel, Zone.defaultZone()), new TestConfigDefinitionRepo(), 2, new UncompressedConfigResponseFactory());
LbServicesConfig.Builder lb = new LbServicesConfig.Builder();
han.getSuperModel().getConfig(lb);
@@ -124,7 +124,7 @@ public class SuperModelControllerTest {
models.put(advanced, createApplicationInfo(testApp2, advanced, 4l));
models.put(tooAdvanced, createApplicationInfo(testApp3, tooAdvanced, 4l));
- SuperModel superModel = new SuperModel(models, false);
+ SuperModel superModel = new SuperModel(models);
SuperModelController han = new SuperModelController(new SuperModelConfigProvider(superModel, Zone.defaultZone()), new TestConfigDefinitionRepo(), 2, new UncompressedConfigResponseFactory());
LbServicesConfig.Builder lb = new LbServicesConfig.Builder();
han.getSuperModel().getConfig(lb);
diff --git a/service-monitor/src/test/java/com/yahoo/vespa/service/monitor/internal/ExampleModel.java b/service-monitor/src/test/java/com/yahoo/vespa/service/monitor/internal/ExampleModel.java
index 7341c817747..2fb7828821d 100644
--- a/service-monitor/src/test/java/com/yahoo/vespa/service/monitor/internal/ExampleModel.java
+++ b/service-monitor/src/test/java/com/yahoo/vespa/service/monitor/internal/ExampleModel.java
@@ -46,7 +46,7 @@ public class ExampleModel {
Map<ApplicationId, ApplicationInfo> applicationInfos = new HashMap<>();
applicationInfos.put(applicationInfo.getApplicationId(), applicationInfo);
- return new SuperModel(applicationInfos, false);
+ return new SuperModel(applicationInfos);
}
public static ApplicationBuilder createApplication(String tenant,