diff options
author | Harald Musum <musum@oath.com> | 2018-08-16 12:21:46 +0200 |
---|---|---|
committer | Harald Musum <musum@oath.com> | 2018-08-16 12:21:46 +0200 |
commit | 2f6833dc2ac909982f94710a646f384cc1aba9d4 (patch) | |
tree | 134e0c3ce8ea5c924e32c7c6ccf63f36b0c8e12e /config-model/src/test/java | |
parent | 9bf4c6a5c602f3ae72f18dff295d774390fc4e12 (diff) |
Add support for https tensor constant uris
Diffstat (limited to 'config-model/src/test/java')
-rw-r--r-- | config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java index 9bad5373191..9e1fdd258e2 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java @@ -114,7 +114,7 @@ public class RankingConstantTest { " document test { }", " constant foo {", " type: tensor(x{})", - " uri: http://somwhere.far.away/in/another-galaxy", + " uri: http://somewhere.far.away/in/another-galaxy", " }", "}" )); @@ -122,8 +122,29 @@ public class RankingConstantTest { Search search = searchBuilder.getSearch(); RankingConstant constant = search.getRankingConstants().values().iterator().next(); assertEquals(RankingConstant.PathType.URI, constant.getPathType()); - assertEquals("http://somwhere.far.away/in/another-galaxy", constant.getUri()); + assertEquals("http://somewhere.far.away/in/another-galaxy", constant.getUri()); } + + @Test + public void constant_https_uri_is_allowed() throws Exception { + RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); + SearchBuilder searchBuilder = new SearchBuilder(rankProfileRegistry); + searchBuilder.importString(joinLines( + "search test {", + " document test { }", + " constant foo {", + " type: tensor(x{})", + " uri: https://somewhere.far.away:4443/in/another-galaxy", + " }", + "}" + )); + searchBuilder.build(); + Search search = searchBuilder.getSearch(); + RankingConstant constant = search.getRankingConstants().values().iterator().next(); + assertEquals(RankingConstant.PathType.URI, constant.getPathType()); + assertEquals("https://somewhere.far.away:4443/in/another-galaxy", constant.getUri()); + } + @Test public void constant_uri_with_port_is_allowed() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); @@ -133,7 +154,7 @@ public class RankingConstantTest { " document test { }", " constant foo {", " type: tensor(x{})", - " uri: http://somwhere.far.away:4080/in/another-galaxy", + " uri: http://somewhere.far.away:4080/in/another-galaxy", " }", "}" )); @@ -141,8 +162,9 @@ public class RankingConstantTest { Search search = searchBuilder.getSearch(); RankingConstant constant = search.getRankingConstants().values().iterator().next(); assertEquals(RankingConstant.PathType.URI, constant.getPathType()); - assertEquals("http://somwhere.far.away:4080/in/another-galaxy", constant.getUri()); + assertEquals("http://somewhere.far.away:4080/in/another-galaxy", constant.getUri()); } + @Test public void constant_uri_no_dual_slashes_is_allowed() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); @@ -152,7 +174,7 @@ public class RankingConstantTest { " document test { }", " constant foo {", " type: tensor(x{})", - " uri: http:somwhere.far.away/in/another-galaxy", + " uri: http:somewhere.far.away/in/another-galaxy", " }", "}" )); @@ -160,10 +182,11 @@ public class RankingConstantTest { Search search = searchBuilder.getSearch(); RankingConstant constant = search.getRankingConstants().values().iterator().next(); assertEquals(RankingConstant.PathType.URI, constant.getPathType()); - assertEquals("http:somwhere.far.away/in/another-galaxy", constant.getUri()); + assertEquals("http:somewhere.far.away/in/another-galaxy", constant.getUri()); } + @Test - public void constant_uri_only_supports_http() throws Exception { + public void constant_uri_only_supports_http_and_https() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SearchBuilder searchBuilder = new SearchBuilder(rankProfileRegistry); thrown.expect(ParseException.class); @@ -175,7 +198,7 @@ public class RankingConstantTest { " document test { }", " constant foo {", " type: tensor(x{})", - " uri: ftp:somwhere.far.away/in/another-galaxy", + " uri: ftp:somewhere.far.away/in/another-galaxy", " }", "}" )); |