aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2022-12-03 14:40:39 +0100
committerHarald Musum <musum@yahooinc.com>2022-12-03 14:41:03 +0100
commitd603afa302dc5911eda46360f08ff708f19c2a1a (patch)
treeb71d498b48242cab42e18542a57c51cc6397233a /config-model
parentafcf1bb71cb7b87a03149d197f724cfc7603ef92 (diff)
Remove unused and undocumented support for permanent-services.xml
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java26
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java14
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java7
-rw-r--r--config-model/src/test/cfg/application/app_permanent/permanent-services.xml7
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/MockModelContext.java5
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java15
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java18
7 files changed, 13 insertions, 79 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java b/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java
index 01b66057038..95d97bc9e87 100644
--- a/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java
+++ b/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model;
-import com.yahoo.config.application.api.ApplicationFile;
import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.config.model.ConfigModelContext.ApplicationType;
import com.yahoo.config.model.builder.xml.ConfigModelBuilder;
@@ -12,7 +11,6 @@ import com.yahoo.config.model.graph.ModelGraphBuilder;
import com.yahoo.config.model.graph.ModelNode;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.config.model.provision.HostsXmlProvisioner;
-import com.yahoo.path.Path;
import com.yahoo.text.XML;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.builder.VespaModelBuilder;
@@ -20,8 +18,6 @@ import com.yahoo.vespa.model.content.Content;
import com.yahoo.vespa.model.routing.Routing;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
@@ -33,7 +29,6 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -82,7 +77,7 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter
VespaModel vespaModel,
VespaModelBuilder builder,
ApplicationConfigProducerRoot root,
- ConfigModelRegistry configModelRegistry) throws IOException, SAXException {
+ ConfigModelRegistry configModelRegistry) throws IOException {
Element userServicesElement = getServicesFromApp(deployState.getApplicationPackage());
readConfigModels(root, userServicesElement, deployState, vespaModel, configModelRegistry);
builder.postProc(deployState.getDeployLogger(), root, this);
@@ -117,7 +112,7 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter
Element servicesRoot,
DeployState deployState,
VespaModel vespaModel,
- ConfigModelRegistry configModelRegistry) throws IOException, SAXException {
+ ConfigModelRegistry configModelRegistry) {
final Map<ConfigModelBuilder, List<Element>> model2Element = new LinkedHashMap<>();
ModelGraphBuilder graphBuilder = new ModelGraphBuilder();
@@ -126,8 +121,6 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter
if (XML.getChild(servicesRoot, "admin") == null)
children.add(getImplicitAdmin(deployState));
- children.addAll(getPermanentServices(deployState));
-
for (Element servicesElement : children) {
String tagName = servicesElement.getTagName();
if (tagName.equals("legacy")) {
@@ -170,21 +163,6 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter
.orElse(ApplicationType.DEFAULT);
}
- private Collection<Element> getPermanentServices(DeployState deployState) throws IOException, SAXException {
- List<Element> permanentServices = new ArrayList<>();
- Optional<ApplicationPackage> applicationPackage = deployState.getPermanentApplicationPackage();
- if (applicationPackage.isPresent()) {
- ApplicationFile file = applicationPackage.get().getFile(Path.fromString(ApplicationPackage.PERMANENT_SERVICES));
- if (file.exists()) {
- try (Reader reader = file.createReader()) {
- Element permanentServicesRoot = getServicesFromReader(reader);
- permanentServices.addAll(getServiceElements(permanentServicesRoot));
- }
- }
- }
- return permanentServices;
- }
-
private Element getServicesFromReader(Reader reader) {
Document doc = XmlHelper.getDocument(reader);
return doc.getDocumentElement();
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
index 679a27df990..985fc5fd22e 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
@@ -71,7 +71,6 @@ public class DeployState implements ConfigDefinitionStore {
private final List<Schema> schemas;
private final ApplicationPackage applicationPackage;
private final Optional<ConfigDefinitionRepo> configDefinitionRepo;
- private final Optional<ApplicationPackage> permanentApplicationPackage;
private final Optional<Model> previousModel;
private final boolean accessLoggingEnabledByDefault;
private final ModelContext.Properties properties;
@@ -111,7 +110,6 @@ public class DeployState implements ConfigDefinitionStore {
Provisioned provisioned,
ModelContext.Properties properties,
Version vespaVersion,
- Optional<ApplicationPackage> permanentApplicationPackage,
Optional<ConfigDefinitionRepo> configDefinitionRepo,
Optional<Model> previousModel,
Set<ContainerEndpoint> endpoints,
@@ -137,7 +135,6 @@ public class DeployState implements ConfigDefinitionStore {
this.provisioned = provisioned;
this.schemas = List.copyOf(application.schemas().values());
this.documentModel = application.documentModel();
- this.permanentApplicationPackage = permanentApplicationPackage;
this.configDefinitionRepo = configDefinitionRepo;
this.endpoints = Set.copyOf(endpoints);
this.zone = zone;
@@ -251,10 +248,6 @@ public class DeployState implements ConfigDefinitionStore {
public HostProvisioner getProvisioner() { return provisioner; }
- public Optional<ApplicationPackage> getPermanentApplicationPackage() {
- return permanentApplicationPackage;
- }
-
public ModelContext.Properties getProperties() { return properties; }
public ModelContext.FeatureFlags featureFlags() { return properties.featureFlags(); }
@@ -317,7 +310,6 @@ public class DeployState implements ConfigDefinitionStore {
private DeployLogger logger = new BaseDeployLogger();
private Optional<HostProvisioner> hostProvisioner = Optional.empty();
private Provisioned provisioned = new Provisioned();
- private Optional<ApplicationPackage> permanentApplicationPackage = Optional.empty();
private ModelContext.Properties properties = new TestProperties();
private Version version = new Version(1, 0, 0);
private Optional<ConfigDefinitionRepo> configDefinitionRepo = Optional.empty();
@@ -365,11 +357,6 @@ public class DeployState implements ConfigDefinitionStore {
return this;
}
- public Builder permanentApplicationPackage(Optional<ApplicationPackage> permanentApplicationPackage) {
- this.permanentApplicationPackage = permanentApplicationPackage;
- return this;
- }
-
public Builder properties(ModelContext.Properties properties) {
this.properties = properties;
return this;
@@ -466,7 +453,6 @@ public class DeployState implements ConfigDefinitionStore {
provisioned,
properties,
version,
- permanentApplicationPackage,
configDefinitionRepo,
previousModel,
endpoints,
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java
index 1ba8b470891..9e867a4c3bc 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java
@@ -64,10 +64,10 @@ public class VespaModelFactory implements ModelFactory {
ComponentRegistry<Validator> additionalValidators,
Zone zone) {
this.version = new Version(VespaVersion.major, VespaVersion.minor, VespaVersion.micro);
- List<ConfigModelBuilder> modelBuilders = new ArrayList<>();
+ List<ConfigModelBuilder<?>> modelBuilders = new ArrayList<>();
for (ConfigModelPlugin plugin : pluginRegistry.allComponents()) {
- if (plugin instanceof ConfigModelBuilder) {
- modelBuilders.add((ConfigModelBuilder) plugin);
+ if (plugin instanceof ConfigModelBuilder p) {
+ modelBuilders.add(p);
}
}
this.configModelRegistry = new MapConfigModelRegistry(modelBuilders);
@@ -187,7 +187,6 @@ public class VespaModelFactory implements ModelFactory {
.configDefinitionRepo(modelContext.configDefinitionRepo())
.fileRegistry(modelContext.getFileRegistry())
.executor(modelContext.getExecutor())
- .permanentApplicationPackage(modelContext.permanentApplicationPackage())
.properties(modelContext.properties())
.vespaVersion(version())
.modelHostProvisioner(modelContext.getHostProvisioner())
diff --git a/config-model/src/test/cfg/application/app_permanent/permanent-services.xml b/config-model/src/test/cfg/application/app_permanent/permanent-services.xml
deleted file mode 100644
index bf00993d3e2..00000000000
--- a/config-model/src/test/cfg/application/app_permanent/permanent-services.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
-<services version="1.0">
- <container version="1.0">
- <search />
- </container>
-</services>
diff --git a/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java b/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java
index 49b4e9820de..af05a144b79 100644
--- a/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java
+++ b/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java
@@ -47,11 +47,6 @@ public class MockModelContext implements ModelContext {
}
@Override
- public Optional<ApplicationPackage> permanentApplicationPackage() {
- return Optional.empty();
- }
-
- @Override
public HostProvisioner getHostProvisioner() {
return DeployState.getDefaultModelHostProvisioner(applicationPackage);
}
diff --git a/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java b/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java
index f0b729a718c..e0726e9443c 100644
--- a/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java
+++ b/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java
@@ -16,16 +16,16 @@ import com.yahoo.vespa.config.ConfigDefinitionKey;
import com.yahoo.vespa.model.VespaModel;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
-
import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Ulf Lilleengen
@@ -42,15 +42,6 @@ public class DeployStateTest {
}
@Test
- void testBuilder() {
- DeployState.Builder builder = new DeployState.Builder();
- ApplicationPackage app = MockApplicationPackage.createEmpty();
- builder.permanentApplicationPackage(Optional.of(app));
- DeployState state = builder.build();
- assertEquals(app, state.getPermanentApplicationPackage().get());
- }
-
- @Test
void testPreviousModelIsProvided() throws IOException, SAXException {
VespaModel prevModel = new VespaModel(MockApplicationPackage.createEmpty());
DeployState.Builder builder = new DeployState.Builder();
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
index 1aa010020f5..68782b947e3 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
@@ -34,18 +34,20 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
-
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.logging.Level;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author gjoranv
@@ -294,16 +296,6 @@ public class VespaModelTestCase {
}
@Test
- void testPermanentServices() throws IOException, SAXException {
- ApplicationPackage app = MockApplicationPackage.createEmpty();
- DeployState.Builder builder = new DeployState.Builder().applicationPackage(app);
- VespaModel model = new VespaModel(new NullConfigModelRegistry(), builder.build());
- assertTrue(model.getContainerClusters().isEmpty());
- model = new VespaModel(new NullConfigModelRegistry(), builder.permanentApplicationPackage(Optional.of(FilesApplicationPackage.fromFile(new File(TESTDIR, "app_permanent")))).build());
- assertEquals(1, model.getContainerClusters().size());
- }
-
- @Test
void testThatDeployLogContainsWarningWhenUsingSearchdefinitionsDir() throws IOException, SAXException {
ApplicationPackage app = FilesApplicationPackage.fromFile(
new File("src/test/cfg/application/deprecated_features_app/"));