diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-08-30 12:30:36 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-08-30 12:30:36 +0200 |
commit | 3d20fdae88511eade993688926294c3861497bbe (patch) | |
tree | 17d9f8b8bf1d91d7e67f5d65c806b6a0f54e48df /container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java | |
parent | 91339a737e354062c97ce8081d8a7f939a9259e4 (diff) |
Compile all variants also with multiple inheritance
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java index b14e73d156d..46dbac859a2 100644 --- a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java @@ -72,7 +72,7 @@ public class QueryProfileVariantsTestCase { QueryProfile parent = new QueryProfile("parent"); parent.setDimensions(new String[] { "parentDim" }); parent.set("property", "defaultValue", null); - parent.set("property", "variantValue", new String[] {"V2" }, null); + parent.set("property", "variantValue", new String[] { "V2" }, null); QueryProfile child = new QueryProfile("child"); child.addInherited(parent); @@ -82,7 +82,32 @@ public class QueryProfileVariantsTestCase { CompiledQueryProfile cchild = child.compile(null); assertEquals("defaultValue", new Query("?query=test", cchild).properties().get("property")); assertEquals("variantValue", new Query("?parentDim=V2", cchild).properties().get("property")); + assertEquals("defaultValue", new Query("?childDim=V1", cchild).properties().get("property")); assertEquals("variantValue", new Query("?parentDim=V2&childDim=V1", cchild).properties().get("property")); + assertEquals("variantValue", new Query("?parentDim=V2&childDim=NO", cchild).properties().get("property")); + } + + @Test + public void testInheritedVariantsMultipleInheritance() { + QueryProfile parent = new QueryProfile("parent"); + parent.setDimensions(new String[] { "parentDim" }); + parent.set("property", "defaultValue", null); + parent.set("property", "variantValue", new String[] { "V2" }, null); + + QueryProfile otherParent = new QueryProfile("otherParent"); + + QueryProfile child = new QueryProfile("child"); + child.addInherited(parent); + child.addInherited(otherParent); + child.setDimensions(new String[] { "childDim" }); + child.set("otherProperty", "otherPropertyValue", new String[] { "V1" }, null); + + CompiledQueryProfile cchild = child.compile(null); + assertEquals("defaultValue", new Query("?query=test", cchild).properties().get("property")); + assertEquals("variantValue", new Query("?parentDim=V2", cchild).properties().get("property")); + assertEquals("defaultValue", new Query("?childDim=V1", cchild).properties().get("property")); + assertEquals("variantValue", new Query("?parentDim=V2&childDim=V1", cchild).properties().get("property")); + assertEquals("variantValue", new Query("?parentDim=V2&childDim=NO", cchild).properties().get("property")); } @Test |