diff options
author | Lester Solbakken <lesters@oath.com> | 2018-12-18 10:37:27 +0100 |
---|---|---|
committer | Lester Solbakken <lesters@oath.com> | 2018-12-18 10:37:27 +0100 |
commit | 7caa60913e4db267f7d7bdfe0e1de90ec12db13f (patch) | |
tree | bbb2e77e81d2823fc7c1048a39a7d38c20edfc44 /config-lib/src/test/java/com | |
parent | 305d22637387d183be17a0582b1ced76f2b44982 (diff) |
Add url config type
Diffstat (limited to 'config-lib/src/test/java/com')
3 files changed, 36 insertions, 1 deletions
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 cc3515f95db..dc365cc60e7 100644 --- a/config-lib/src/test/java/com/yahoo/config/ConfigInstanceBuilderTest.java +++ b/config-lib/src/test/java/com/yahoo/config/ConfigInstanceBuilderTest.java @@ -159,6 +159,7 @@ public class ConfigInstanceBuilderTest refwithdef(":parent:"). fileVal("etc"). pathVal(FileReference.mockFileReferenceForUnitTesting(new File("pom.xml"))). + urlVal(new UrlReference("http://docs.vespa.ai")). boolarr(false). longarr(9223372036854775807L). longarr(-9223372036854775808L). @@ -173,6 +174,8 @@ public class ConfigInstanceBuilderTest stringMap("one", "first"). filemap("f1", "/var"). filemap("f2", "/store"). + urlMap("u1", new UrlReference("http://docs.vespa.ai/1")). + urlMap("u2", new UrlReference("http://docs.vespa.ai/2")). basicStruct(new BasicStruct.Builder(). foo("basicFoo"). @@ -198,6 +201,7 @@ public class ConfigInstanceBuilderTest enumval(Myarray.Enumval.INNER). refval(":parent:"). fileVal("file0"). + urlVal(new UrlReference("http://docs.vespa.ai/1")). anotherarray(new Myarray.Anotherarray.Builder(). foo(7)). myStruct(new Myarray.MyStruct.Builder(). @@ -209,6 +213,7 @@ public class ConfigInstanceBuilderTest enumval(Myarray.Enumval.INNER). refval(":parent:"). fileVal("file1"). + urlVal(new UrlReference("http://docs.vespa.ai/2")). anotherarray(new Myarray.Anotherarray.Builder(). foo(1). foo(2)). @@ -344,7 +349,7 @@ public class ConfigInstanceBuilderTest funcBuilder.intMap.put("three", 3); funcBuilder.myarray.get(1).intval(17); funcBuilder.myarray.get(0).anotherarray.get(0).foo(32); - funcBuilder.myarray.add(new Myarray.Builder().refval("refval").fileVal("fileval").myStruct(new Myarray.MyStruct.Builder().a(4))); + funcBuilder.myarray.add(new Myarray.Builder().refval("refval").fileVal("fileval").urlVal(new UrlReference("urlval")).myStruct(new Myarray.MyStruct.Builder().a(4))); funcBuilder.myStructMap.put("new", new MyStructMap.Builder().myString("string").myInt(13)); funcBuilder.basicStruct(new BasicStruct.Builder().bar(1234)); FunctionTestConfig function2 = new FunctionTestConfig(funcBuilder); 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 ca8b9aea2fe..06db64fb20c 100644 --- a/config-lib/src/test/java/com/yahoo/config/ConfigInstanceEqualsTest.java +++ b/config-lib/src/test/java/com/yahoo/config/ConfigInstanceEqualsTest.java @@ -131,6 +131,7 @@ public class ConfigInstanceEqualsTest { refval(":parent:"). fileVal("etc"). pathVal(FileReference.mockFileReferenceForUnitTesting(new File("pom.xml"))). + urlVal(new UrlReference("http://docs.vespa.ai")). boolarr(false). longarr(9223372036854775807L). longarr(-9223372036854775808L). @@ -140,6 +141,7 @@ public class ConfigInstanceEqualsTest { enumarr(Enumarr.VALUES). refarr(Arrays.asList(":parent:", ":parent", "parent:")). // test collection based setter fileArr("bin"). + urlArr(new UrlReference("http://docs.vespa.ai")). basicStruct(new BasicStruct.Builder(). foo("basicFoo"). @@ -162,6 +164,7 @@ public class ConfigInstanceEqualsTest { enumval(Myarray.Enumval.INNER). refval(":parent:"). fileVal("file0"). + urlVal(new UrlReference("http://docs.vespa.ai/1")). anotherarray(new Myarray.Anotherarray.Builder(). foo(7)). myStruct(new Myarray.MyStruct.Builder(). @@ -173,6 +176,7 @@ public class ConfigInstanceEqualsTest { enumval(Myarray.Enumval.INNER). refval(":parent:"). fileVal("file1"). + urlVal(new UrlReference("http://docs.vespa.ai/2")). anotherarray(new Myarray.Anotherarray.Builder(). foo(1). foo(2)). diff --git a/config-lib/src/test/java/com/yahoo/config/UrlNodeTest.java b/config-lib/src/test/java/com/yahoo/config/UrlNodeTest.java new file mode 100644 index 00000000000..d8d6cc0f1f1 --- /dev/null +++ b/config-lib/src/test/java/com/yahoo/config/UrlNodeTest.java @@ -0,0 +1,26 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config; + +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +/** + * @author lesters + */ +public class UrlNodeTest { + + @Test + public void testSetValue() { + UrlNode url = new UrlNode(); + assertThat(url.toString(), is("(null)")); + + url = new UrlNode(new UrlReference("https://docs.vespa.ai/")); + assertThat(url.getUrlReference().value(), is("https://docs.vespa.ai/")); + + url = new UrlNode(new UrlReference("pom.xml")); + assertThat(url.getValue(), is("pom.xml")); + } + +} |