summaryrefslogtreecommitdiffstats
path: root/config-application-package
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2023-01-11 13:07:53 +0100
committerjonmv <venstad@gmail.com>2023-01-11 13:07:53 +0100
commitdb88fbc87584f715379b75d7f24b7ae8fc1e246b (patch)
treea291b70d6e0d720b5964d02e369dc3c2f057c991 /config-application-package
parentf1ad36324188c14d4ca60679c53b90c20d5a4d70 (diff)
Use text blocks, and kill xml unit test dependency
Diffstat (limited to 'config-application-package')
-rw-r--r--config-application-package/pom.xml6
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorComplexTest.java5
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTagsTest.java5
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTest.java64
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java101
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/MultiOverrideProcessorTest.java179
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java5
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/PropertiesProcessorTest.java173
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/TestBase.java18
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java297
-rw-r--r--config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java60
11 files changed, 453 insertions, 460 deletions
diff --git a/config-application-package/pom.xml b/config-application-package/pom.xml
index 41e65f19b79..dc2c8d91db1 100644
--- a/config-application-package/pom.xml
+++ b/config-application-package/pom.xml
@@ -109,12 +109,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <version>1.5</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
<plugins>
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorComplexTest.java b/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorComplexTest.java
index 4af8d3d7028..93e038c786a 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorComplexTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorComplexTest.java
@@ -8,7 +8,6 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Tags;
-
import org.junit.Test;
import org.w3c.dom.Document;
@@ -22,10 +21,6 @@ public class HostedOverrideProcessorComplexTest {
private static final String servicesFile = "src/test/resources/complex-app/services.xml";
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
@Test
public void testProdBetaUsWest2a() throws TransformerException, IOException {
String expected =
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTagsTest.java b/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTagsTest.java
index 8d7431d33b6..b8b09396fb4 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTagsTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTagsTest.java
@@ -5,7 +5,6 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Tags;
-import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -17,10 +16,6 @@ import java.io.StringReader;
*/
public class HostedOverrideProcessorTagsTest {
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
private static final String input =
"<?xml version='1.0' encoding='UTF-8' standalone='no'?>" +
"<services xmlns:deploy='vespa' xmlns:preprocess='?' version='1.0'>" +
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTest.java
index 451c7a3c217..eb65c01522e 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/HostedOverrideProcessorTest.java
@@ -5,51 +5,42 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Tags;
-import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
import javax.xml.transform.TransformerException;
-import java.io.IOException;
import java.io.StringReader;
-import java.util.List;
/**
* @author bratseth
*/
public class HostedOverrideProcessorTest {
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
private static final String input =
- "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" +
- "<services xmlns:deploy='vespa' xmlns:preprocess='?' version='1.0'>" +
- " <container id='foo' version='1.0'>" +
- " <nodes count='1'/>" +
- " <nodes count='3' deploy:environment='perf'/>" +
- " <nodes deploy:environment='staging' count='2' required='true'/>" +
- " <nodes deploy:environment='prod' count='3' flavor='v-4-8-100'/>" +
- " <nodes deploy:environment='prod' deploy:region='us-west' count='4'/>" +
- " <nodes deploy:environment='prod' deploy:region='us-east-3' flavor='v-8-8-100' count='5'/>" +
- " <nodes deploy:instance='myinstance' deploy:environment='prod' deploy:region='us-west' count='1'/>" +
- " </container>" +
- "</services>";
+ """
+ <?xml version='1.0' encoding='UTF-8' standalone='no'?>
+ <services xmlns:deploy='vespa' xmlns:preprocess='?' version='1.0'>
+ <container id='foo' version='1.0'>
+ <nodes count='1'/>
+ <nodes count='3' deploy:environment='perf'/>
+ <nodes deploy:environment='staging' count='2' required='true'/>
+ <nodes deploy:environment='prod' count='3' flavor='v-4-8-100'/>
+ <nodes deploy:environment='prod' deploy:region='us-west' count='4'/>
+ <nodes deploy:environment='prod' deploy:region='us-east-3' flavor='v-8-8-100' count='5'/>
+ <nodes deploy:instance='myinstance' deploy:environment='prod' deploy:region='us-west' count='1'/>
+ </container></services>""";
@Test
public void testParsingDefault() throws TransformerException {
- String expected =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"?\" version=\"1.0\">" +
- " <container id=\"foo\" version=\"1.0\">" +
- " <nodes count='1'/>" +
- " </container>" +
- "</services>";
+ String expected =
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="?" version="1.0">
+ <container id="foo" version="1.0">
+ <nodes count='1'/>
+ </container>
+ </services>""";
assertOverride(InstanceName.defaultName(),
Environment.test,
RegionName.defaultName(),
@@ -59,13 +50,14 @@ public class HostedOverrideProcessorTest {
@Test
public void testParsingEnvironmentAndRegion() throws TransformerException {
- String expected =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"?\" version=\"1.0\">" +
- " <container id=\"foo\" version=\"1.0\">" +
- " <nodes count='4' required='true'/>" +
- " </container>" +
- "</services>";
+ String expected =
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="?" version="1.0">
+ <container id="foo" version="1.0">
+ <nodes count='4' required='true'/>
+ </container>
+ </services>""";
assertOverride(InstanceName.defaultName(),
Environment.from("prod"),
RegionName.from("us-west"),
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java
index 3de624c78ac..697d8c208d3 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java
@@ -2,7 +2,6 @@
package com.yahoo.config.application;
import com.yahoo.config.application.api.ApplicationPackage;
-import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -28,54 +27,58 @@ public class IncludeProcessorTest {
DocumentBuilder docBuilder = Xml.getPreprocessDocumentBuilder();
String expected =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" +
- " <preprocess:properties>\n" +
- " <qrs.port>4099</qrs.port>\n" +
- " <qrs.port>5000</qrs.port>\n" +
- " </preprocess:properties>\n" +
- " <preprocess:properties deploy:environment='prod'>\n" +
- " <qrs.port deploy:region='us-west'>5001</qrs.port>" +
- " <qrs.port deploy:region='us-east us-central'>5002</qrs.port>" +
- " </preprocess:properties>\n" +
- " <admin version=\"2.0\">\n" +
- " <adminserver hostalias=\"node0\"/>\n" +
- " </admin>\n" +
- " <admin deploy:environment=\"staging prod\" deploy:region=\"us-east us-central\" version=\"2.0\">\n" +
- " <adminserver hostalias=\"node1\"/>\n" +
- " </admin>\n" +
- " <content id=\"foo\" version=\"1.0\">\n" +
- " <redundancy>1</redundancy><documents>\n" +
- " <document mode=\"index\" type=\"music.sd\"/>\n" +
- " </documents><nodes>\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " </nodes>" +
- " <nodes deploy:environment=\"prod\">\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " <node distribution-key=\"1\" hostalias=\"node1\"/>\n" +
- " </nodes>" +
- " <nodes deploy:environment=\"prod\" deploy:region=\"us-west\">\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " <node distribution-key=\"1\" hostalias=\"node1\"/>\n" +
- " <node distribution-key=\"2\" hostalias=\"node2\"/>\n" +
- " </nodes>" +
- "</content>\n" +
- "<container id=\"stateless\" version=\"1.0\">\n" +
- " <search deploy:environment=\"prod\">\n" +
- " <chain id=\"common\">\n" +
- " <searcher id=\"MySearcher1\" />\n" +
- " <searcher deploy:environment=\"prod\" id=\"MySearcher2\" />\n" +
- " </chain>\n" +
- " </search>\n" +
- " <search/>\n" +
- " <component id=\"foo\" class=\"MyFoo\" bundle=\"foobundle\" />\n" +
- " <component id=\"bar\" class=\"TestBar\" bundle=\"foobundle\" deploy:environment=\"dev\" />\n" +
- " <component id=\"bar\" class=\"ProdBar\" bundle=\"foobundle\" deploy:environment=\"prod\" />\n" +
- " <component id=\"baz\" class=\"ProdBaz\" bundle=\"foobundle\" deploy:environment=\"prod\" />\n" +
- " <nodes>\n" +
- " <node baseport=\"${qrs.port}\" hostalias=\"node0\"/>\n" +
- " </nodes>\n" +
- "</container></services>";
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --><services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <preprocess:properties>
+ <qrs.port>4099</qrs.port>
+ <qrs.port>5000</qrs.port>
+ </preprocess:properties>
+ <preprocess:properties deploy:environment="prod">
+ <qrs.port deploy:region="us-west">5001</qrs.port>
+ <qrs.port deploy:region="us-east us-central">5002</qrs.port>
+ </preprocess:properties>
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ </admin>
+ <admin deploy:environment="staging prod" deploy:region="us-east us-central" version="2.0">
+ <adminserver hostalias="node1"/>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>1</redundancy>
+ <documents>
+ <document mode="index" type="music.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="0" hostalias="node0"/>
+ </nodes>
+ <nodes deploy:environment="prod">
+ <node distribution-key="0" hostalias="node0"/>
+ <node distribution-key="1" hostalias="node1"/>
+ </nodes>
+ <nodes deploy:environment="prod" deploy:region="us-west">
+ <node distribution-key="0" hostalias="node0"/>
+ <node distribution-key="1" hostalias="node1"/>
+ <node distribution-key="2" hostalias="node2"/>
+ </nodes>
+ </content>
+ <container id="stateless" version="1.0">
+ <search deploy:environment="prod">
+ <chain id="common">
+ <searcher id="MySearcher1"/>
+ <searcher deploy:environment="prod" id="MySearcher2"/>
+ </chain>
+ </search>
+ <search/>
+ <component bundle="foobundle" class="MyFoo" id="foo"/>
+ <component bundle="foobundle" class="TestBar" deploy:environment="dev" id="bar"/>
+ <component bundle="foobundle" class="ProdBar" deploy:environment="prod" id="bar"/>
+ <component bundle="foobundle" class="ProdBaz" deploy:environment="prod" id="baz"/>
+ <nodes>
+ <node baseport="${qrs.port}" hostalias="node0"/>
+ </nodes>
+ </container>
+ </services>""";
Document doc = new IncludeProcessor(app).process(docBuilder.parse(getServices(app)));
// System.out.println(Xml.documentAsString(doc));
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/MultiOverrideProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/MultiOverrideProcessorTest.java
index debde6c1438..8602b2955aa 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/MultiOverrideProcessorTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/MultiOverrideProcessorTest.java
@@ -5,7 +5,6 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Tags;
-import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -19,107 +18,109 @@ import java.io.StringReader;
*/
public class MultiOverrideProcessorTest {
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
private static final String input =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<services version=\"1.0\" xmlns:deploy=\"vespa\">\n" +
- " <container id='default' version='1.0'>\n" +
- " <component id=\"comp-B\" class=\"com.yahoo.ls.MyComponent\" bundle=\"lsbe-hv\">\n" +
- " <config name=\"ls.config.resource-pool\">\n" +
- " <resource>\n" +
- " <item>\n" +
- " <id>comp-B-item-0</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " <item deploy:environment=\"dev perf test staging prod\" deploy:region=\"us-west-1 us-east-3\">\n" +
- " <id>comp-B-item-1</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " <item>\n" +
- " <id>comp-B-item-2</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " </resource>\n" +
- " </config>\n" +
- " </component>\n" +
- " </container>\n" +
- "</services>\n";
+ """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <services version="1.0" xmlns:deploy="vespa">
+ <container id='default' version='1.0'>
+ <component id="comp-B" class="com.yahoo.ls.MyComponent" bundle="lsbe-hv">
+ <config name="ls.config.resource-pool">
+ <resource>
+ <item>
+ <id>comp-B-item-0</id>
+ <type></type>
+ </item>
+ <item deploy:environment="dev perf test staging prod" deploy:region="us-west-1 us-east-3">
+ <id>comp-B-item-1</id>
+ <type></type>
+ </item>
+ <item>
+ <id>comp-B-item-2</id>
+ <type></type>
+ </item>
+ </resource>
+ </config>
+ </component>
+ </container>
+ </services>
+ """;
private static final String inputWithIds =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<services version=\"1.0\" xmlns:deploy=\"vespa\">\n" +
- " <container id='default' version='1.0'>\n" +
- " <component id=\"comp-B\" class=\"com.yahoo.ls.MyComponent\" bundle=\"lsbe-hv\">\n" +
- " <config name=\"ls.config.resource-pool\">\n" +
- " <resource>\n" +
- " <item id='1'>\n" +
- " <id>comp-B-item-0</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " <item id='2' deploy:environment=\"dev perf test staging prod\" deploy:region=\"us-west-1 us-east-3\">\n" +
- " <id>comp-B-item-1</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " <item id='3'>\n" +
- " <id>comp-B-item-2</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " </resource>\n" +
- " </config>\n" +
- " </component>\n" +
- " </container>\n" +
- "</services>\n";
+ """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <services version="1.0" xmlns:deploy="vespa">
+ <container id='default' version='1.0'>
+ <component id="comp-B" class="com.yahoo.ls.MyComponent" bundle="lsbe-hv">
+ <config name="ls.config.resource-pool">
+ <resource>
+ <item id='1'>
+ <id>comp-B-item-0</id>
+ <type></type>
+ </item>
+ <item id='2' deploy:environment="dev perf test staging prod" deploy:region="us-west-1 us-east-3">
+ <id>comp-B-item-1</id>
+ <type></type>
+ </item>
+ <item id='3'>
+ <id>comp-B-item-2</id>
+ <type></type>
+ </item>
+ </resource>
+ </config>
+ </component>
+ </container>
+ </services>
+ """;
@Test
public void testParsingDev() throws TransformerException {
String expected =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<services version=\"1.0\" xmlns:deploy=\"vespa\">\n" +
- " <container id='default' version='1.0'>\n" +
- " <component id=\"comp-B\" class=\"com.yahoo.ls.MyComponent\" bundle=\"lsbe-hv\">\n" +
- " <config name=\"ls.config.resource-pool\">\n" +
- " <resource>\n" +
- " <item>\n" +
- " <id>comp-B-item-1</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " </resource>\n" +
- " </config>\n" +
- " </component>\n" +
- " </container>\n" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <services version="1.0" xmlns:deploy="vespa">
+ <container id='default' version='1.0'>
+ <component id="comp-B" class="com.yahoo.ls.MyComponent" bundle="lsbe-hv">
+ <config name="ls.config.resource-pool">
+ <resource>
+ <item>
+ <id>comp-B-item-1</id>
+ <type></type>
+ </item>
+ </resource>
+ </config>
+ </component>
+ </container>
+ </services>""";
assertOverride(Environment.dev, RegionName.from("us-east-3"), expected);
}
@Test
public void testParsingDevWithIds() throws TransformerException {
String expected =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<services version=\"1.0\" xmlns:deploy=\"vespa\">\n" +
- " <container id='default' version='1.0'>\n" +
- " <component id=\"comp-B\" class=\"com.yahoo.ls.MyComponent\" bundle=\"lsbe-hv\">\n" +
- " <config name=\"ls.config.resource-pool\">\n" +
- " <resource>\n" +
- " <item id='1'>\n" +
- " <id>comp-B-item-0</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " <item id='2'>\n" +
- " <id>comp-B-item-1</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " <item id='3'>\n" +
- " <id>comp-B-item-2</id>\n" +
- " <type></type>\n" +
- " </item>\n" +
- " </resource>\n" +
- " </config>\n" +
- " </component>\n" +
- " </container>\n" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <services version="1.0" xmlns:deploy="vespa">
+ <container id='default' version='1.0'>
+ <component id="comp-B" class="com.yahoo.ls.MyComponent" bundle="lsbe-hv">
+ <config name="ls.config.resource-pool">
+ <resource>
+ <item id='1'>
+ <id>comp-B-item-0</id>
+ <type></type>
+ </item>
+ <item id='2'>
+ <id>comp-B-item-1</id>
+ <type></type>
+ </item>
+ <item id='3'>
+ <id>comp-B-item-2</id>
+ <type></type>
+ </item>
+ </resource>
+ </config>
+ </component>
+ </container>
+ </services>""";
assertOverrideWithIds(Environment.dev, RegionName.from("us-east-3"), expected);
}
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java
index 150999390d8..ca074ef9704 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java
@@ -5,7 +5,6 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Tags;
-import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -17,10 +16,6 @@ import java.io.StringReader;
*/
public class OverrideProcessorTest {
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
private static final String input =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
"<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"?\" version=\"1.0\">" +
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/PropertiesProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/PropertiesProcessorTest.java
index 3bf0f25766c..b8896ca2b79 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/PropertiesProcessorTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/PropertiesProcessorTest.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.application;
-import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -16,25 +15,22 @@ import static org.junit.Assert.assertEquals;
*/
public class PropertiesProcessorTest {
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
@Test
public void testPropertyValues() throws TransformerException {
- String input = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">" +
- " <preprocess:properties>" +
- " <slobrok.port>4099</slobrok.port>" +
- " <redundancy>2</redundancy>" +
- " </preprocess:properties>" +
- " <admin version=\"2.0\">" +
- " <adminserver hostalias=\"node0\"/>" +
- " <slobroks>" +
- " <slobrok hostalias=\"node1\" baseport=\"${slobrok.port}\"/>" +
- " </slobroks>" +
- " </admin>" +
- "</services>";
+ String input = """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <preprocess:properties>
+ <slobrok.port>4099</slobrok.port>
+ <redundancy>2</redundancy>
+ </preprocess:properties>
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ <slobroks>
+ <slobrok hostalias="node1" baseport="${slobrok.port}"/>
+ </slobroks>
+ </admin>
+ </services>""";
PropertiesProcessor p = new PropertiesProcessor();
p.process(Xml.getDocument(new StringReader(input)));
@@ -46,49 +42,51 @@ public class PropertiesProcessorTest {
@Test
public void testPropertyApplying() throws TransformerException {
- String input = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">" +
- " <preprocess:properties>" +
- " <slobrok.port>4099</slobrok.port>" +
- " <redundancy>2</redundancy>" +
- " <doctype>music</doctype>" +
- " <zero>0</zero>" +
- " </preprocess:properties>" +
- " <admin version=\"2.0\">" +
- " <adminserver hostalias=\"node0\"/>" +
- " <slobroks>" +
- " <slobrok hostalias=\"node1\" baseport=\"${slobrok.port}\"/>" +
- " </slobroks>" +
- " </admin>" +
- " <content id=\"foo\" version=\"1.0\">" +
- " <redundancy>${redundancy}</redundancy>" +
- " <documents>" +
- " <document mode=\"index\" type=\"${doctype}.sd\"/>" +
- " </documents>" +
- " <nodes>" +
- " <node distribution-key=\"${zero}\" hostalias=\"node${zero}\"/>" +
- " </nodes>" +
- " </content>" +
- "</services>";
-
- String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">" +
- " <admin version=\"2.0\">" +
- " <adminserver hostalias=\"node0\"/>" +
- " <slobroks>" +
- " <slobrok hostalias=\"node1\" baseport=\"4099\"/>" +
- " </slobroks>" +
- " </admin>" +
- " <content id=\"foo\" version=\"1.0\">" +
- " <redundancy>2</redundancy>" +
- " <documents>" +
- " <document mode=\"index\" type=\"music.sd\"/>" +
- " </documents>" +
- " <nodes>" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>" +
- " </nodes>" +
- " </content>" +
- "</services>";
+ String input = """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <preprocess:properties>
+ <slobrok.port>4099</slobrok.port>
+ <redundancy>2</redundancy>
+ <doctype>music</doctype>
+ <zero>0</zero>
+ </preprocess:properties>
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ <slobroks>
+ <slobrok hostalias="node1" baseport="${slobrok.port}"/>
+ </slobroks>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>${redundancy}</redundancy>
+ <documents>
+ <document mode="index" type="${doctype}.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="${zero}" hostalias="node${zero}"/>
+ </nodes>
+ </content>
+ </services>""";
+
+ String expected = """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ <slobroks>
+ <slobrok hostalias="node1" baseport="4099"/>
+ </slobroks>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>2</redundancy>
+ <documents>
+ <document mode="index" type="music.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="0" hostalias="node0"/>
+ </nodes>
+ </content>
+ </services>""";
Document inputDoc = Xml.getDocument(new StringReader(input));
@@ -100,31 +98,34 @@ public class PropertiesProcessorTest {
// TODO: Check that warning is actually logged
@Test
public void testWarnIfDuplicatePropertyForSameEnvironment() throws TransformerException {
- String input = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">" +
- " <preprocess:properties>" +
- " <slobrok.port>4099</slobrok.port>" +
- " <slobrok.port>5000</slobrok.port>" +
- " <redundancy>2</redundancy>" +
- " </preprocess:properties>" +
- " <admin version=\"2.0\">" +
- " <adminserver hostalias=\"node0\"/>" +
- " <slobroks>" +
- " <slobrok hostalias=\"node1\" baseport=\"${slobrok.port}\"/>" +
- " </slobroks>" +
- " </admin>" +
- "</services>";
-
-
- String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">" +
- " <admin version=\"2.0\">" +
- " <adminserver hostalias=\"node0\"/>" +
- " <slobroks>" +
- " <slobrok hostalias=\"node1\" baseport=\"5000\"/>" + // Should get the last defined value
- " </slobroks>" +
- " </admin>" +
- "</services>";
+ String input = """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <preprocess:properties>
+ <slobrok.port>4099</slobrok.port>
+ <slobrok.port>5000</slobrok.port>
+ <redundancy>2</redundancy>
+ </preprocess:properties>
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ <slobroks>
+ <slobrok hostalias="node1" baseport="${slobrok.port}"/>
+ </slobroks>
+ </admin>
+ </services>""";
+
+
+ // Should get the last defined value
+ String expected = """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ <slobroks>
+ <slobrok hostalias="node1" baseport="5000"/>
+ </slobroks>
+ </admin>
+ </services>""";
Document inputDoc = Xml.getDocument(new StringReader(input));
Document newDoc = new PropertiesProcessor().process(inputDoc);
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/TestBase.java b/config-application-package/src/test/java/com/yahoo/config/application/TestBase.java
index 06172c2698f..7e3a4758f8e 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/TestBase.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/TestBase.java
@@ -1,14 +1,13 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.application;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLUnit;
import org.w3c.dom.Document;
+import javax.xml.transform.TransformerException;
import java.io.Reader;
import java.io.StringReader;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
/**
* Utilities for tests
@@ -16,14 +15,15 @@ import static org.junit.Assert.assertTrue;
* @author hmusum
*/
public class TestBase {
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
static void assertDocument(String expected, Document output) {
- Document expectedDoc = Xml.getDocument(new StringReader(expected));
- Diff diff = new Diff(expectedDoc, output);
- assertTrue(diff.toString(), diff.identical());
+ try {
+ assertEquals(Xml.documentAsString(Xml.getDocument(new StringReader(expected)), true),
+ Xml.documentAsString(output, true));
+ }
+ catch (TransformerException e) {
+ throw new AssertionError(e);
+ }
}
public static void assertDocument(String expectedDocument, Reader document) {
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java
index 0da94b69e58..49dbacbae3d 100644
--- a/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java
@@ -23,29 +23,31 @@ public class XmlPreprocessorTest {
@Test
public void testPreProcessing() throws Exception {
String expectedDev =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" +
- " <admin version=\"2.0\">\n" +
- " <adminserver hostalias=\"node0\"/>\n" +
- " </admin>\n" +
- " <content id=\"foo\" version=\"1.0\">\n" +
- " <redundancy>1</redundancy>\n" +
- " <documents>\n" +
- " <document mode=\"index\" type=\"music.sd\"/>\n" +
- " </documents>\n" +
- " <nodes>\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " </nodes>\n" +
- " </content>\n" +
- " <container id=\"stateless\" version=\"1.0\">\n" +
- " <search/>\n" +
- " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" +
- " <component bundle=\"foobundle\" class=\"TestBar\" id=\"bar\"/>\n" +
- " <nodes>\n" +
- " <node hostalias=\"node0\" baseport=\"5000\"/>\n" +
- " </nodes>\n" +
- " </container>\n" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>1</redundancy>
+ <documents>
+ <document mode="index" type="music.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="0" hostalias="node0"/>
+ </nodes>
+ </content>
+ <container id="stateless" version="1.0">
+ <search/>
+ <component bundle="foobundle" class="MyFoo" id="foo"/>
+ <component bundle="foobundle" class="TestBar" id="bar"/>
+ <nodes>
+ <node hostalias="node0" baseport="5000"/>
+ </nodes>
+ </container>
+ </services>""";
TestBase.assertDocument(expectedDev,
new XmlPreProcessor(appDir,
services,
@@ -54,30 +56,33 @@ public class XmlPreprocessorTest {
RegionName.defaultName(),
Tags.empty()).run());
+ // Difference from dev: node1
+ // Difference from dev: no TestBar
String expectedStaging =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" +
- " <admin version=\"2.0\">\n" +
- " <adminserver hostalias=\"node1\"/>\n" + // Difference from dev: node1
- " </admin>\n" +
- " <content id=\"foo\" version=\"1.0\">\n" +
- " <redundancy>1</redundancy>\n" +
- " <documents>\n" +
- " <document mode=\"index\" type=\"music.sd\"/>\n" +
- " </documents>\n" +
- " <nodes>\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " </nodes>\n" +
- " </content>\n" +
- " <container id=\"stateless\" version=\"1.0\">\n" +
- " <search/>\n" +
- " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" +
- "" + // Difference from dev: no TestBar
- " <nodes>\n" +
- " <node hostalias=\"node0\" baseport=\"5000\"/>\n" +
- " </nodes>\n" +
- " </container>\n" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <admin version="2.0">
+ <adminserver hostalias="node1"/>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>1</redundancy>
+ <documents>
+ <document mode="index" type="music.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="0" hostalias="node0"/>
+ </nodes>
+ </content>
+ <container id="stateless" version="1.0">
+ <search/>
+ <component bundle="foobundle" class="MyFoo" id="foo"/>
+ <nodes>
+ <node hostalias="node0" baseport="5000"/>
+ </nodes>
+ </container>
+ </services>""";
TestBase.assertDocument(expectedStaging,
new XmlPreProcessor(appDir,
services,
@@ -87,37 +92,39 @@ public class XmlPreprocessorTest {
Tags.empty()).run());
String expectedUsWest =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" +
- " <admin version=\"2.0\">\n" +
- " <adminserver hostalias=\"node0\"/>\n" +
- " </admin>\n" +
- " <content id=\"foo\" version=\"1.0\">\n" +
- " <redundancy>1</redundancy>\n" +
- " <documents>\n" +
- " <document mode=\"index\" type=\"music.sd\"/>\n" +
- " </documents>\n" +
- " <nodes>\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " <node distribution-key=\"1\" hostalias=\"node1\"/>\n" +
- " <node distribution-key=\"2\" hostalias=\"node2\"/>\n" +
- " </nodes>\n" +
- " </content>\n" +
- " <container id=\"stateless\" version=\"1.0\">\n" +
- " <search>\n" +
- " <chain id=\"common\">\n" +
- " <searcher id=\"MySearcher1\"/>\n" +
- " <searcher id=\"MySearcher2\"/>\n" +
- " </chain>\n" +
- " </search>\n" +
- " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" +
- " <component bundle=\"foobundle\" class=\"ProdBar\" id=\"bar\"/>\n" +
- " <component bundle=\"foobundle\" class=\"ProdBaz\" id=\"baz\"/>\n" +
- " <nodes>\n" +
- " <node hostalias=\"node0\" baseport=\"5001\"/>\n" +
- " </nodes>\n" +
- " </container>\n" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>1</redundancy>
+ <documents>
+ <document mode="index" type="music.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="0" hostalias="node0"/>
+ <node distribution-key="1" hostalias="node1"/>
+ <node distribution-key="2" hostalias="node2"/>
+ </nodes>
+ </content>
+ <container id="stateless" version="1.0">
+ <search>
+ <chain id="common">
+ <searcher id="MySearcher1"/>
+ <searcher id="MySearcher2"/>
+ </chain>
+ </search>
+ <component bundle="foobundle" class="MyFoo" id="foo"/>
+ <component bundle="foobundle" class="ProdBar" id="bar"/>
+ <component bundle="foobundle" class="ProdBaz" id="baz"/>
+ <nodes>
+ <node hostalias="node0" baseport="5001"/>
+ </nodes>
+ </container>
+ </services>""";
TestBase.assertDocument(expectedUsWest,
new XmlPreProcessor(appDir,
services,
@@ -127,36 +134,38 @@ public class XmlPreprocessorTest {
Tags.empty()).run());
String expectedUsEastAndCentral =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" +
- " <admin version=\"2.0\">\n" +
- " <adminserver hostalias=\"node1\"/>\n" +
- " </admin>\n" +
- " <content id=\"foo\" version=\"1.0\">\n" +
- " <redundancy>1</redundancy>\n" +
- " <documents>\n" +
- " <document mode=\"index\" type=\"music.sd\"/>\n" +
- " </documents>\n" +
- " <nodes>\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " <node distribution-key=\"1\" hostalias=\"node1\"/>\n" +
- " </nodes>\n" +
- " </content>\n" +
- " <container id=\"stateless\" version=\"1.0\">\n" +
- " <search>\n" +
- " <chain id=\"common\">\n" +
- " <searcher id=\"MySearcher1\"/>\n" +
- " <searcher id=\"MySearcher2\"/>\n" +
- " </chain>\n" +
- " </search>\n" +
- " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" +
- " <component bundle=\"foobundle\" class=\"ProdBar\" id=\"bar\"/>\n" +
- " <component bundle=\"foobundle\" class=\"ProdBaz\" id=\"baz\"/>\n" +
- " <nodes>\n" +
- " <node hostalias=\"node0\" baseport=\"5002\"/>\n" +
- " </nodes>\n" +
- " </container>\n" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <admin version="2.0">
+ <adminserver hostalias="node1"/>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>1</redundancy>
+ <documents>
+ <document mode="index" type="music.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="0" hostalias="node0"/>
+ <node distribution-key="1" hostalias="node1"/>
+ </nodes>
+ </content>
+ <container id="stateless" version="1.0">
+ <search>
+ <chain id="common">
+ <searcher id="MySearcher1"/>
+ <searcher id="MySearcher2"/>
+ </chain>
+ </search>
+ <component bundle="foobundle" class="MyFoo" id="foo"/>
+ <component bundle="foobundle" class="ProdBar" id="bar"/>
+ <component bundle="foobundle" class="ProdBaz" id="baz"/>
+ <nodes>
+ <node hostalias="node0" baseport="5002"/>
+ </nodes>
+ </container>
+ </services>""";
TestBase.assertDocument(expectedUsEastAndCentral,
new XmlPreProcessor(appDir,
services,
@@ -176,44 +185,46 @@ public class XmlPreprocessorTest {
@Test
public void testPropertiesWithOverlappingNames() throws Exception {
String input =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">" +
- " <preprocess:properties>" +
- " <sherpa.host>gamma-usnc1.dht.yahoo.com</sherpa.host>" +
- " <sherpa.port>4080</sherpa.port>" +
- " <lidspacecompaction_interval>3600</lidspacecompaction_interval>" +
- " <lidspacecompaction_interval deploy:environment='prod'>36000</lidspacecompaction_interval>" +
- " <lidspacecompaction_allowedlidbloat>50000</lidspacecompaction_allowedlidbloat>" +
- " <lidspacecompaction_allowedlidbloat deploy:environment='prod'>50000000</lidspacecompaction_allowedlidbloat>" +
- " <lidspacecompaction_allowedlidbloatfactor>0.01</lidspacecompaction_allowedlidbloatfactor>" +
- " <lidspacecompaction_allowedlidbloatfactor deploy:environment='prod'>0.91</lidspacecompaction_allowedlidbloatfactor>" +
- " </preprocess:properties>" +
- " <config name='a'>" +
- " <a>${lidspacecompaction_interval}</a>" +
- " <b>${lidspacecompaction_allowedlidbloat}</b>" +
- " <c>${lidspacecompaction_allowedlidbloatfactor}</c>" +
- " <host>${sherpa.host}</host>" +
- " <port>${sherpa.port}</port>" +
- " </config>" +
- " <admin version=\"2.0\">" +
- " <adminserver hostalias=\"node0\"/>" +
- " </admin>" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <preprocess:properties>
+ <sherpa.host>gamma-usnc1.dht.yahoo.com</sherpa.host>
+ <sherpa.port>4080</sherpa.port>
+ <lidspacecompaction_interval>3600</lidspacecompaction_interval>
+ <lidspacecompaction_interval deploy:environment='prod'>36000</lidspacecompaction_interval>
+ <lidspacecompaction_allowedlidbloat>50000</lidspacecompaction_allowedlidbloat>
+ <lidspacecompaction_allowedlidbloat deploy:environment='prod'>50000000</lidspacecompaction_allowedlidbloat>
+ <lidspacecompaction_allowedlidbloatfactor>0.01</lidspacecompaction_allowedlidbloatfactor>
+ <lidspacecompaction_allowedlidbloatfactor deploy:environment='prod'>0.91</lidspacecompaction_allowedlidbloatfactor>
+ </preprocess:properties>
+ <config name='a'>
+ <a>${lidspacecompaction_interval}</a>
+ <b>${lidspacecompaction_allowedlidbloat}</b>
+ <c>${lidspacecompaction_allowedlidbloatfactor}</c>
+ <host>${sherpa.host}</host>
+ <port>${sherpa.port}</port>
+ </config>
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ </admin>
+ </services>""";
String expectedProd =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
- "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">" +
- " <config name='a'>" +
- " <a>36000</a>" +
- " <b>50000000</b>" +
- " <c>0.91</c>" +
- " <host>gamma-usnc1.dht.yahoo.com</host>" +
- " <port>4080</port>" +
- " </config>" +
- " <admin version=\"2.0\">" +
- " <adminserver hostalias=\"node0\"/>" +
- " </admin>" +
- "</services>";
+ """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <config name='a'>
+ <a>36000</a>
+ <b>50000000</b>
+ <c>0.91</c>
+ <host>gamma-usnc1.dht.yahoo.com</host>
+ <port>4080</port>
+ </config>
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ </admin>
+ </services>""";
Document docDev = (new XmlPreProcessor(appDir,
new StringReader(input),
InstanceName.defaultName(),
diff --git a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java
index 29bc2b6fbd6..6c83b2029ad 100644
--- a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java
+++ b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java
@@ -41,34 +41,40 @@ public class FilesApplicationPackageTest {
ApplicationPackage processed = app.preprocess(new Zone(Environment.dev, RegionName.defaultName()),
new BaseDeployLogger());
assertTrue(new File(appDir, ".preprocessed").exists());
- String expectedServices = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" +
- " <admin version=\"2.0\">\n" +
- " <adminserver hostalias=\"node0\"/>\n" +
- " </admin>\n" +
- " <content id=\"foo\" version=\"1.0\">\n" +
- " <redundancy>1</redundancy>\n" +
- " <documents>\n" +
- " <document mode=\"index\" type=\"music.sd\"/>\n" +
- " </documents>\n" +
- " <nodes>\n" +
- " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" +
- " </nodes>\n" +
- " </content>\n" +
- " <container id=\"stateless\" version=\"1.0\">\n" +
- " <search/>\n" +
- " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" +
- " <component bundle=\"foobundle\" class=\"TestBar\" id=\"bar\"/>\n" +
- " <nodes>\n" +
- " <node hostalias=\"node0\" baseport=\"5000\"/>\n" +
- " </nodes>\n" +
- " </container>\n" +
- "</services>";
+ String expectedServices = """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+ <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0">
+ <admin version="2.0">
+ <adminserver hostalias="node0"/>
+ </admin>
+ <content id="foo" version="1.0">
+ <redundancy>1</redundancy>
+ <documents>
+ <document mode="index" type="music.sd"/>
+ </documents>
+ <nodes>
+ <node distribution-key="0" hostalias="node0"/>
+ </nodes>
+ </content>
+ <container id="stateless" version="1.0">
+ <search/>
+ <component bundle="foobundle" class="MyFoo" id="foo"/>
+ <component bundle="foobundle" class="TestBar" id="bar"/>
+ <nodes>
+ <node hostalias="node0" baseport="5000"/>
+ </nodes>
+ </container>
+ </services>""";
TestBase.assertDocument(expectedServices, processed.getServices());
- String expectedHosts = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><hosts xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\">\n" +
- " <host name=\"bar.yahoo.com\">\n" +
- " <alias>node1</alias>\n" +
- " </host>\n" +
- "</hosts>";
+ String expectedHosts = """
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+ <hosts xmlns:deploy="vespa" xmlns:preprocess="properties">
+ <host name="bar.yahoo.com">
+ <alias>node1</alias>
+ </host>
+ </hosts>""";
TestBase.assertDocument(expectedHosts, processed.getHosts());
}