aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-11-04 21:23:21 +0100
committerJon Bratseth <bratseth@gmail.com>2020-11-04 21:23:21 +0100
commit3c49543bb514abd8c3040fc4355f6ccc537468e1 (patch)
treee9b48215a89c2170853a3fd16e69b5b70846c8e3 /container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java
parent95ca6fdcb45b1d3ae805c5c9f3d20cc7972f136d (diff)
Revert "Merge pull request #15181 from vespa-engine/revert-15180-bratseth/override-in-variant-references"
This reverts commit 95ca6fdcb45b1d3ae805c5c9f3d20cc7972f136d, reversing changes made to 19f9396e6b60e49c7830d78d504a14c015600f2b.
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.java52
1 files changed, 52 insertions, 0 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 03faeaae8a0..89217bb7f0c 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
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/**
@@ -74,6 +75,57 @@ public class QueryProfileVariantsTestCase {
}
@Test
+ public void testReferenceInVariant() {
+ QueryProfileRegistry registry = new QueryProfileRegistry();
+ QueryProfile test = new QueryProfile("test");
+ test.setDimensions(new String[] { "d1" });
+ registry.register(test);
+
+ QueryProfile references = new QueryProfile("referenced");
+ references.setDimensions(new String[] { "d1" });
+ registry.register(references);
+
+ QueryProfile other = new QueryProfile("other");
+ other.setDimensions(new String[] { "d1" });
+ registry.register(other);
+
+ test.set( "a", references, new String[] { "d1v"}, registry);
+ test.set( "a.b", "test-value", new String[] { "d1v"}, registry);
+ other.set( "a", references, new String[] { "d1v"}, registry);
+ other.set("a.b", "other-value", new String[] { "d1v"}, registry);
+
+ assertEquals("test-value", test.get("a.b", new String[] { "d1v"}));
+ assertEquals("other-value", other.get("a.b", new String[] { "d1v"}));
+ assertNull(references.get("b", new String[] { "d1v"}));
+
+ var cRegistry = registry.compile();
+ assertEquals("test-value",
+ cRegistry.getComponent("test").get("a.b", Map.of("d1", "d1v")));
+ }
+
+ @Test
+ public void testReference() {
+ QueryProfileRegistry registry = new QueryProfileRegistry();
+ QueryProfile test = new QueryProfile("test");
+ registry.register(test);
+
+ QueryProfile references = new QueryProfile("referenced");
+ registry.register(references);
+
+ QueryProfile other = new QueryProfile("other");
+ registry.register(other);
+
+ test.set( "a", references, registry);
+ test.set( "a.b", "test-value", registry);
+ other.set( "a", references, registry);
+ other.set("a.b", "other-value", registry);
+
+ assertEquals("test-value", test.get("a.b"));
+ assertEquals("other-value", other.get("a.b"));
+ assertNull(references.get("b"));
+ }
+
+ @Test
public void testVariantInReferencedAndParentWithOtherMatchingVariant() {
QueryProfileRegistry registry = new QueryProfileRegistry();
QueryProfile parent = new QueryProfile("parent");