aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-10-29 14:41:55 +0200
committerJon Bratseth <bratseth@gmail.com>2021-10-29 14:41:55 +0200
commit91d9fdf134e51322d57d1634253ded11a5ad9f48 (patch)
tree30deb780c81b0148f56d4d2827c43e5070faf4fd /container-search/src/test/java/com/yahoo/search
parent2b392be81f7a63d0f2e17c48ac365e4e55bb8a7c (diff)
Stable query profile ids
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search')
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/profile/config/test/XmlReadingTestCase.java12
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/child.xml5
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/parent.xml5
3 files changed, 22 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/config/test/XmlReadingTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/XmlReadingTestCase.java
index e04835c01b2..a24e9af5928 100644
--- a/container-search/src/test/java/com/yahoo/search/query/profile/config/test/XmlReadingTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/XmlReadingTestCase.java
@@ -449,6 +449,18 @@ public class XmlReadingTestCase {
query = new Query(HttpRequest.createTestRequest("?query=test&profileRef=ref:MyProfile2", Method.GET), registry.getComponent("default"));
assertEquals("MyProfile2", query.properties().get("profileRef.name"));
}
+
+ }
+
+ @Test
+ public void testAnonymousIdsAreStableBetweenImports() {
+ QueryProfileRegistry registry1 = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance");
+ var childIn1 = registry1.findQueryProfile("child");
+
+ QueryProfileRegistry registry2 = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance");
+ var childIn2 = registry2.findQueryProfile("child");
+ assertEquals(((QueryProfile)childIn1.lookup("a", Map.of())).getId().stringValue(),
+ ((QueryProfile)childIn2.lookup("a", Map.of())).getId().stringValue());
}
@Test
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/child.xml b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/child.xml
new file mode 100644
index 00000000000..10edbacba60
--- /dev/null
+++ b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/child.xml
@@ -0,0 +1,5 @@
+<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<query-profile id="child" inherits="parent">
+ <field name="a.b.c">a.b.c-child</field>
+</query-profile>
+
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/parent.xml b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/parent.xml
new file mode 100644
index 00000000000..2e576186628
--- /dev/null
+++ b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typedinheritance/parent.xml
@@ -0,0 +1,5 @@
+<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<query-profile id="parent">
+ <field name="a.b">a.b-parent</field>
+ <field name="a.b.c">a.b.c-parent</field>
+</query-profile>