diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-08-31 22:50:14 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-08-31 22:50:14 +0200 |
commit | adcb1d4d55e71d78c662f798b033d3abea0d4b9e (patch) | |
tree | 5867c3ac85792c1578d6ce463e8e24dd2aea7fb0 /config-lib | |
parent | 2b83da619a3ee2f38a1a3b05576f44d7451b3daf (diff) |
Add 'model' config type
Diffstat (limited to 'config-lib')
22 files changed, 298 insertions, 22 deletions
diff --git a/config-lib/abi-spec.json b/config-lib/abi-spec.json index 45290714777..19dfd8535ae 100644 --- a/config-lib/abi-spec.json +++ b/config-lib/abi-spec.json @@ -272,7 +272,8 @@ "public static java.util.Map asNodeMap(java.util.Map, com.yahoo.config.LeafNode)", "public static java.util.Map asFileNodeMap(java.util.Map)", "public static java.util.Map asPathNodeMap(java.util.Map)", - "public static java.util.Map asUrlNodeMap(java.util.Map)" + "public static java.util.Map asUrlNodeMap(java.util.Map)", + "public static java.util.Map asModelNodeMap(java.util.Map)" ], "fields": [] }, @@ -287,7 +288,8 @@ "public java.util.List asList()", "public static com.yahoo.config.LeafNodeVector createFileNodeVector(java.util.Collection)", "public static com.yahoo.config.LeafNodeVector createPathNodeVector(java.util.Collection)", - "public static com.yahoo.config.LeafNodeVector createUrlNodeVector(java.util.Collection)" + "public static com.yahoo.config.LeafNodeVector createUrlNodeVector(java.util.Collection)", + "public static com.yahoo.config.LeafNodeVector createModelNodeVector(java.util.Collection)" ], "fields": [] }, @@ -308,6 +310,51 @@ ], "fields": [] }, + "com.yahoo.config.ModelNode": { + "superClass": "com.yahoo.config.LeafNode", + "interfaces": [], + "attributes": [ + "public" + ], + "methods": [ + "public void <init>()", + "public void <init>(com.yahoo.config.ModelReference)", + "public com.yahoo.config.ModelReference value()", + "public java.lang.String getValue()", + "public java.lang.String toString()", + "protected boolean doSetValue(java.lang.String)", + "public com.yahoo.config.ModelReference getModelReference()", + "public static java.util.List toModelReferences(java.util.List)", + "public static java.util.Map toModelReferenceMap(java.util.Map)", + "public bridge synthetic java.lang.Object value()" + ], + "fields": [] + }, + "com.yahoo.config.ModelReference": { + "superClass": "java.lang.Object", + "interfaces": [], + "attributes": [ + "public" + ], + "methods": [ + "public void <init>(java.util.Optional, java.util.Optional, java.util.Optional)", + "public java.util.Optional modelId()", + "public java.util.Optional url()", + "public java.util.Optional path()", + "public com.yahoo.config.ModelReference withModelId(java.util.Optional)", + "public com.yahoo.config.ModelReference withUrl(java.util.Optional)", + "public com.yahoo.config.ModelReference withPath(java.util.Optional)", + "public java.lang.String value()", + "public boolean equals(java.lang.Object)", + "public int hashCode()", + "public java.lang.String toString()", + "public static com.yahoo.config.ModelReference fromModelId(java.lang.String)", + "public static com.yahoo.config.ModelReference fromUrl(java.lang.String)", + "public static com.yahoo.config.ModelReference fromPath(java.lang.String)", + "public static com.yahoo.config.ModelReference valueOf(java.lang.String)" + ], + "fields": [] + }, "com.yahoo.config.Node": { "superClass": "java.lang.Object", "interfaces": [], diff --git a/config-lib/src/main/java/com/yahoo/config/FileNode.java b/config-lib/src/main/java/com/yahoo/config/FileNode.java index e6a4af6f439..a7c1ebb1488 100644 --- a/config-lib/src/main/java/com/yahoo/config/FileNode.java +++ b/config-lib/src/main/java/com/yahoo/config/FileNode.java @@ -1,8 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import java.nio.file.Path; - /** * Represents a 'file' in a {@link ConfigInstance}, usually a filename. * @@ -16,8 +14,6 @@ public class FileNode extends LeafNode<FileReference> { public FileNode(String stringVal) { super(true); this.value = new FileReference(ReferenceNode.stripQuotes(stringVal)); - if (Path.of(value.value()).normalize().startsWith("..")) - throw new IllegalArgumentException("path may not start with '..', but got: " + value.value()); } public FileReference value() { diff --git a/config-lib/src/main/java/com/yahoo/config/FileReference.java b/config-lib/src/main/java/com/yahoo/config/FileReference.java index 686721e91ae..8b8434c8cc4 100755 --- a/config-lib/src/main/java/com/yahoo/config/FileReference.java +++ b/config-lib/src/main/java/com/yahoo/config/FileReference.java @@ -2,6 +2,7 @@ package com.yahoo.config; import java.io.File; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; @@ -19,6 +20,8 @@ public final class FileReference { private final String value; public FileReference(String value) { + if (Path.of(value).normalize().startsWith("..")) + throw new IllegalArgumentException("Path may not start with '..' but got '" + value + "'"); this.value = Objects.requireNonNull(value); } diff --git a/config-lib/src/main/java/com/yahoo/config/LeafNodeMaps.java b/config-lib/src/main/java/com/yahoo/config/LeafNodeMaps.java index 9435c09803f..82663fa8bfd 100644 --- a/config-lib/src/main/java/com/yahoo/config/LeafNodeMaps.java +++ b/config-lib/src/main/java/com/yahoo/config/LeafNodeMaps.java @@ -8,7 +8,6 @@ import java.util.stream.Collectors; /** * @author gjoranv - * @since 5.1.17 */ public class LeafNodeMaps { @@ -68,4 +67,11 @@ public class LeafNodeMaps { )); } + public static Map<String, ModelNode> asModelNodeMap(Map<String, ModelReference> modelReferenceMap) { + return Collections.unmodifiableMap( + modelReferenceMap.entrySet().stream().collect( + Collectors.toMap(Map.Entry::getKey, e -> new ModelNode(e.getValue())) + )); + } + } diff --git a/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java b/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java index 599385899e1..bdabc045e18 100644 --- a/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java +++ b/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java @@ -13,7 +13,6 @@ import java.util.List; * A vector of leaf nodes. * * @author gjoranv - * @since 5.1.4 */ public class LeafNodeVector<REAL, NODE extends LeafNode<REAL>> extends NodeVector<NODE> { @@ -79,5 +78,11 @@ public class LeafNodeVector<REAL, NODE extends LeafNode<REAL>> extends NodeVecto return new LeafNodeVector<>(files, new UrlNode()); } + public static LeafNodeVector<ModelReference, ModelNode> createModelNodeVector(Collection<ModelReference> values) { + List<ModelReference> models = new ArrayList<>(); + for (ModelReference modelReference : values) + models.add(modelReference); + return new LeafNodeVector<>(models, new ModelNode()); + } } diff --git a/config-lib/src/main/java/com/yahoo/config/ModelNode.java b/config-lib/src/main/java/com/yahoo/config/ModelNode.java new file mode 100644 index 00000000000..775c4a12e82 --- /dev/null +++ b/config-lib/src/main/java/com/yahoo/config/ModelNode.java @@ -0,0 +1,64 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Represents a 'model' in a {@link ConfigInstance}. + * + * @author bratseth + */ +public class ModelNode extends LeafNode<ModelReference> { + + public ModelNode() { + this.value = null; + } + + public ModelNode(ModelReference modelReference) { + super(true); + this.value = modelReference; + } + + public ModelReference value() { + return value; + } + + @Override + public String getValue() { + return value.toString(); + } + + @Override + public String toString() { + return (value == null) ? "(null)" : '"' + getValue() + '"'; + } + + @Override + protected boolean doSetValue(String stringVal) { + throw new UnsupportedOperationException(); + } + + public ModelReference getModelReference() { + return value; + } + + public static List<ModelReference> toModelReferences(List<ModelNode> modelNodes) { + List<ModelReference> modelReferences = new ArrayList<>(); + for (ModelNode modelNode : modelNodes) + modelReferences.add(modelNode.getModelReference()); + return modelReferences; + } + + public static Map<String, ModelReference> toModelReferenceMap(Map<String, ModelNode> nodeMap) { + Map<String, ModelReference> referenceMap = new LinkedHashMap<>(); + for (var entry : nodeMap.entrySet()) { + referenceMap.put(entry.getKey(), entry.getValue().getModelReference()); + } + return referenceMap; + } + +} diff --git a/config-lib/src/main/java/com/yahoo/config/ModelReference.java b/config-lib/src/main/java/com/yahoo/config/ModelReference.java new file mode 100644 index 00000000000..c0b610e4df3 --- /dev/null +++ b/config-lib/src/main/java/com/yahoo/config/ModelReference.java @@ -0,0 +1,109 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config; + +import java.io.File; +import java.util.Objects; +import java.util.Optional; + +/** + * An immutable reference to a model. + * This is a file path when read by a client but is set in a config instance either as a + * path, url or id resolved to an url during deployment. + * + * @author bratseth + */ +public class ModelReference { + + // At least one of these are set + private final Optional<String> modelId; + private final Optional<UrlReference> url; + private final Optional<FileReference> path; + + public ModelReference(Optional<String> modelId, + Optional<UrlReference> url, + Optional<FileReference> path) { + if (modelId.isEmpty() && url.isEmpty() && path.isEmpty()) + throw new IllegalArgumentException("A model reference must have either a model id, url or path"); + this.modelId = modelId; + this.url = url; + this.path = path; + } + + public Optional<String> modelId() { return modelId; } + public Optional<UrlReference> url() { return url; } + public Optional<FileReference> path() { return path; } + + public ModelReference withModelId(Optional<String> modelId) { + return new ModelReference(modelId, url, path); + } + + public ModelReference withUrl(Optional<UrlReference> url) { + return new ModelReference(modelId, url, path); + } + + public ModelReference withPath(Optional<FileReference> path) { + return new ModelReference(modelId, url, path); + } + + /** Returns the path to the file containing this model. */ + public String value() { + if (url.isPresent() && new File(url.get().value()).exists()) + return new File(url.get().value()).getAbsolutePath(); + if (path.isPresent()) + return path.get().value(); + throw new IllegalStateException("No url or path is available"); + } + + @Override + public boolean equals(Object o) { + if ( ! (o instanceof ModelReference other)) return false; + if ( ! this.modelId.equals(other.modelId)) return false; + if ( ! this.url.equals(other.url)) return false; + if ( ! this.path.equals(other.path)) return false; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(modelId, url, path); + } + + /** Returns this on the format accepted by valueOf */ + @Override + public String toString() { + return modelId.orElse("") + " " + + url.map(v -> v.value()).orElse("") + " " + + path.map(v -> v.value()).orElse(""); + } + + /** Creates a model reference having a model id only. */ + public static ModelReference fromModelId(String modelId) { + return new ModelReference(Optional.of(modelId), Optional.empty(), Optional.empty()); + } + + /** Creates a model reference having a url only. */ + public static ModelReference fromUrl(String url) { + return new ModelReference(Optional.empty(), Optional.of(new UrlReference(url)), Optional.empty()); + } + + /** Creates a model reference having a path only. */ + public static ModelReference fromPath(String path) { + return new ModelReference(Optional.empty(), Optional.empty(), Optional.of(new FileReference(path))); + } + + /** + * Creates a model reference from a three-part string on the form + * <code>modelId url path</code> + * Each of the elements are either a value not containing space, or empty represented by "". + */ + public static ModelReference valueOf(String s) { + String[] parts = s.split(" "); + if (parts.length != 3) + throw new IllegalArgumentException("Expected a config with exactly three space-separated parts, but got '" + s + "'"); + return new ModelReference(parts[0].equals("") ? Optional.empty() : Optional.of(parts[0]), + parts[1].equals("") ? Optional.empty() : Optional.of(new UrlReference(parts[1])), + parts[2].equals("") ? Optional.empty() : Optional.of(new FileReference(parts[2]))); + + } + +} diff --git a/config-lib/src/main/java/com/yahoo/config/PathNode.java b/config-lib/src/main/java/com/yahoo/config/PathNode.java index ea4c657af8c..b757e569ffe 100644 --- a/config-lib/src/main/java/com/yahoo/config/PathNode.java +++ b/config-lib/src/main/java/com/yahoo/config/PathNode.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; -import java.io.File; import java.nio.file.Path; import java.util.ArrayList; import java.util.LinkedHashMap; diff --git a/config-lib/src/main/java/com/yahoo/config/UrlReference.java b/config-lib/src/main/java/com/yahoo/config/UrlReference.java index 1adab8aaa53..d7a74165896 100755 --- a/config-lib/src/main/java/com/yahoo/config/UrlReference.java +++ b/config-lib/src/main/java/com/yahoo/config/UrlReference.java @@ -11,6 +11,7 @@ import java.util.Objects; */ public final class UrlReference { + /** Either the url or, if downloaded, the absolute path to the downloaded file. */ private final String value; public UrlReference(String value) { diff --git a/config-lib/src/test/java/com/yahoo/config/BooleanNodeTest.java b/config-lib/src/test/java/com/yahoo/config/BooleanNodeTest.java index 50d71ba50e9..4d6b39f3976 100644 --- a/config-lib/src/test/java/com/yahoo/config/BooleanNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/BooleanNodeTest.java @@ -8,9 +8,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class BooleanNodeTest { + @Test void testSetValue() { BooleanNode n = new BooleanNode(); @@ -21,4 +21,5 @@ public class BooleanNodeTest { assertFalse(n.doSetValue("FALSEa")); assertFalse(n.doSetValue("aFALSE")); } + } diff --git a/config-lib/src/test/java/com/yahoo/config/ConfigInstanceBuilderTest.java b/config-lib/src/test/java/com/yahoo/config/ConfigInstanceBuilderTest.java index f05baeff08c..d1cd7678911 100644 --- a/config-lib/src/test/java/com/yahoo/config/ConfigInstanceBuilderTest.java +++ b/config-lib/src/test/java/com/yahoo/config/ConfigInstanceBuilderTest.java @@ -15,6 +15,7 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.Optional; import static com.yahoo.foo.StructtypesConfig.Simple.Gender.Enum.FEMALE; import static com.yahoo.test.FunctionTestConfig.BasicStruct; @@ -34,10 +35,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author gjoranv - * @since 5.1.11 */ -public class ConfigInstanceBuilderTest -{ +public class ConfigInstanceBuilderTest { @Test void struct_values_can_be_set_without_declaring_a_new_struct_builder() { @@ -170,6 +169,9 @@ public class ConfigInstanceBuilderTest fileVal("etc"). pathVal(FileReference.mockFileReferenceForUnitTesting(new File("pom.xml"))). urlVal(new UrlReference("http://docs.vespa.ai")). + modelVal(new ModelReference(Optional.empty(), + Optional.empty(), + Optional.of(FileReference.mockFileReferenceForUnitTesting(new File("pom.xml"))))). boolarr(false). longarr(9223372036854775807L). longarr(-9223372036854775808L). @@ -408,4 +410,5 @@ public class ConfigInstanceBuilderTest report.toString().contains("function-test.myStructMap{one} with value \n") ); } + } diff --git a/config-lib/src/test/java/com/yahoo/config/ConfigInstanceEqualsTest.java b/config-lib/src/test/java/com/yahoo/config/ConfigInstanceEqualsTest.java index 1584293a137..1a05c08d8f2 100644 --- a/config-lib/src/test/java/com/yahoo/config/ConfigInstanceEqualsTest.java +++ b/config-lib/src/test/java/com/yahoo/config/ConfigInstanceEqualsTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test; import java.io.File; import java.util.Arrays; +import java.util.Optional; import static com.yahoo.test.FunctionTestConfig.BasicStruct; import static com.yahoo.test.FunctionTestConfig.Enum_val; @@ -18,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; public class ConfigInstanceEqualsTest { + FunctionTestConfig config1; FunctionTestConfig.Builder builder2; FunctionTestConfig config2; @@ -130,6 +132,9 @@ public class ConfigInstanceEqualsTest { fileVal("etc"). pathVal(FileReference.mockFileReferenceForUnitTesting(new File("pom.xml"))). urlVal(new UrlReference("http://docs.vespa.ai")). + modelVal(new ModelReference(Optional.of("my-model-id"), + Optional.of(new UrlReference("http://docs.vespa.ai")), + Optional.empty())). boolarr(false). longarr(9223372036854775807L). longarr(-9223372036854775808L). @@ -140,6 +145,9 @@ public class ConfigInstanceEqualsTest { refarr(Arrays.asList(":parent:", ":parent", "parent:")). // test collection based setter fileArr("bin"). urlArr(new UrlReference("http://docs.vespa.ai")). + modelArr(new ModelReference(Optional.empty(), + Optional.of(new UrlReference("http://docs.vespa.ai")), + Optional.of(FileReference.mockFileReferenceForUnitTesting(new File("pom.xml"))))). basicStruct(new BasicStruct.Builder(). foo("basicFoo"). @@ -183,4 +191,5 @@ public class ConfigInstanceEqualsTest { b(-2))); } + } diff --git a/config-lib/src/test/java/com/yahoo/config/DoubleNodeTest.java b/config-lib/src/test/java/com/yahoo/config/DoubleNodeTest.java index 475a33104b0..ae9894041f9 100644 --- a/config-lib/src/test/java/com/yahoo/config/DoubleNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/DoubleNodeTest.java @@ -10,9 +10,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class DoubleNodeTest { + @Test void testSetValue() { DoubleNode n = new DoubleNode(); @@ -20,4 +20,5 @@ public class DoubleNodeTest { assertTrue(n.doSetValue("3.14")); assertEquals(3.14, n.value(), 0.001); } + } diff --git a/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java b/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java index e7723409736..d53db9fa9c7 100644 --- a/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java @@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * @author Ulf Lilleengen */ public class EnumNodeTest { + private static class MyNode extends EnumNode<MyNode.Enum> { public enum Enum { ONE, TWO } public final static Enum ONE = Enum.ONE; @@ -39,4 +40,5 @@ public class EnumNodeTest { assertEquals("ONE", n.toString()); assertFalse(n.doSetValue("THREE")); } + } diff --git a/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java b/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java index 8bec9378f8f..49796c795a9 100644 --- a/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java @@ -9,7 +9,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class FileNodeTest { @@ -23,7 +22,7 @@ public class FileNodeTest { assertEquals("foo.txt", n.value().value()); assertEquals("\"foo.txt\"", n.toString()); - assertEquals("path may not start with '..', but got: foo/../../boo", + assertEquals("Path may not start with '..' but got 'foo/../../boo'", assertThrows(IllegalArgumentException.class, () -> new FileNode("foo/../../boo")).getMessage()); } diff --git a/config-lib/src/test/java/com/yahoo/config/IntegerNodeTest.java b/config-lib/src/test/java/com/yahoo/config/IntegerNodeTest.java index a195a5f65fb..4081192d2e8 100644 --- a/config-lib/src/test/java/com/yahoo/config/IntegerNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/IntegerNodeTest.java @@ -9,9 +9,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class IntegerNodeTest { + @Test void testSetValue() { IntegerNode n = new IntegerNode(); @@ -19,4 +19,5 @@ public class IntegerNodeTest { assertTrue(n.setValue("10")); assertEquals(10, n.value().intValue()); } + } diff --git a/config-lib/src/test/java/com/yahoo/config/LongNodeTest.java b/config-lib/src/test/java/com/yahoo/config/LongNodeTest.java index dc6d59bbc46..9e021edd3a8 100644 --- a/config-lib/src/test/java/com/yahoo/config/LongNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/LongNodeTest.java @@ -9,9 +9,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class LongNodeTest { + @Test void testSetValue() { LongNode n = new LongNode(); @@ -19,4 +19,5 @@ public class LongNodeTest { assertTrue(n.setValue("10")); assertEquals(10L, n.value().longValue()); } + } diff --git a/config-lib/src/test/java/com/yahoo/config/ModelNodeTest.java b/config-lib/src/test/java/com/yahoo/config/ModelNodeTest.java new file mode 100644 index 00000000000..696e0722714 --- /dev/null +++ b/config-lib/src/test/java/com/yahoo/config/ModelNodeTest.java @@ -0,0 +1,29 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config; + +import org.junit.jupiter.api.Test; + +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author bratseth + */ +public class ModelNodeTest { + + @Test + void testEmpty() { + assertEquals("(null)", new ModelNode().toString()); + } + + @Test + void testReference() { + var reference = new ModelReference(Optional.of("myModelId"), + Optional.of(new UrlReference("https://host:my/path")), + Optional.of(new FileReference("foo.txt"))); + assertEquals("myModelId https://host:my/path foo.txt", reference.toString()); + assertEquals(reference, ModelReference.valueOf(reference.toString())); + } + +} diff --git a/config-lib/src/test/java/com/yahoo/config/NodeVectorTest.java b/config-lib/src/test/java/com/yahoo/config/NodeVectorTest.java index e6b3b4b6a71..fb751931062 100644 --- a/config-lib/src/test/java/com/yahoo/config/NodeVectorTest.java +++ b/config-lib/src/test/java/com/yahoo/config/NodeVectorTest.java @@ -12,7 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; /** * @author Ulf Lilleengen - * @since 5.1 */ public class NodeVectorTest { diff --git a/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java b/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java index ad8f5e2e65f..622466d95a2 100644 --- a/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java @@ -10,7 +10,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; /** * @author gjoranv - * @since 5.1.28 */ public class PathNodeTest { @@ -22,7 +21,7 @@ public class PathNodeTest { n = new PathNode(new FileReference("foo.txt")); assertEquals(new File("foo.txt").toPath(), n.value()); - assertEquals("path may not start with '..', but got: foo/../../boo", + assertEquals("Path may not start with '..' but got 'foo/../../boo'", assertThrows(IllegalArgumentException.class, () -> new PathNode(new FileReference("foo/../../boo"))).getMessage()); } diff --git a/config-lib/src/test/java/com/yahoo/config/StringNodeTest.java b/config-lib/src/test/java/com/yahoo/config/StringNodeTest.java index d0baf8d1837..3470c96bbcc 100644 --- a/config-lib/src/test/java/com/yahoo/config/StringNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/StringNodeTest.java @@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; /** * @author hmusum - * @since 5.1.7 */ public class StringNodeTest { diff --git a/config-lib/src/test/resources/configdefinitions/test.function-test.def b/config-lib/src/test/resources/configdefinitions/test.function-test.def index f6a997daf77..cdd4bf012d2 100644 --- a/config-lib/src/test/resources/configdefinitions/test.function-test.def +++ b/config-lib/src/test/resources/configdefinitions/test.function-test.def @@ -45,6 +45,7 @@ refwithdef reference default=":parent:" restart fileVal file restart pathVal path restart urlVal url +modelVal model boolarr[] bool restart intarr[] int restart @@ -56,6 +57,7 @@ refarr[] reference restart fileArr[] file restart pathArr[] path restart urlArr[] url +modelArr[] model #This is a map of ints. intMap{} int restart @@ -63,6 +65,7 @@ stringMap{} string restart filemap{} file restart pathMap{} path restart urlMap{} url +modelMap{} model # A basic struct basicStruct.foo string default="basic" restart |