use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTypeInheritanceTestCase method testInheritance.
public void testInheritance() {
type.inherited().add(user);
type.freeze();
user.freeze();
assertFalse(type.isOverridable("myUserString"));
assertEquals("myUserInteger", type.getField("myUserInteger").getName());
QueryProfile test = new QueryProfile("test");
test.setType(type);
test.set("myUserInteger", "37", (QueryProfileRegistry) null);
test.set("myUnknownInteger", "38", (QueryProfileRegistry) null);
CompiledQueryProfile ctest = test.compile(null);
assertEquals(37, ctest.get("myUserInteger"));
assertEquals("38", ctest.get("myUnknownInteger"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class CloningTestCase method testReAssignment.
public void testReAssignment() {
QueryProfile test = new QueryProfile("test");
test.setDimensions(new String[] { "x" });
test.freeze();
Query q1 = new Query(HttpRequest.createTestRequest("?query=q&x=x1", Method.GET), test.compile(null));
q1.properties().set("a", "a1");
q1.properties().set("a", "a2");
assertEquals("a2", q1.properties().get("a"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class CloningTestCase method testThreeLevelsOfCloningMiddleFirstSetOrder2.
public void testThreeLevelsOfCloningMiddleFirstSetOrder2() {
QueryProfile test = new QueryProfile("test");
test.set("a", "config-a", (QueryProfileRegistry) null);
test.freeze();
Query q1 = new Query(HttpRequest.createTestRequest("?query=q", Method.GET), test.compile(null));
Query q2 = q1.clone();
Query q31 = q2.clone();
Query q32 = q2.clone();
q2.properties().set("a", "q2-a");
q31.properties().set("a", "q31-a");
q1.properties().set("a", "q1-a");
assertEquals("q1-a", q1.properties().get("a").toString());
assertEquals("q2-a", q2.properties().get("a").toString());
assertEquals("q31-a", q31.properties().get("a").toString());
assertEquals("config-a", q32.properties().get("a").toString());
q1.properties().set("a", "q1-a-2");
assertEquals("q1-a-2", q1.properties().get("a").toString());
assertEquals("q2-a", q2.properties().get("a").toString());
assertEquals("q31-a", q31.properties().get("a").toString());
assertEquals("config-a", q32.properties().get("a").toString());
q2.properties().set("a", "q2-a-2");
assertEquals("q1-a-2", q1.properties().get("a").toString());
assertEquals("q2-a-2", q2.properties().get("a").toString());
assertEquals("q31-a", q31.properties().get("a").toString());
assertEquals("config-a", q32.properties().get("a").toString());
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class CloningTestCase method testShallowCloning.
public void testShallowCloning() {
QueryProfile test = new QueryProfile("test");
test.freeze();
Query q1 = new Query(HttpRequest.createTestRequest("?query=q", Method.GET), test.compile(null));
q1.properties().set("a", new MutableString("a1"));
Query q2 = q1.clone();
((MutableString) q2.properties().get("a")).set("a2");
assertEquals("a2", q1.properties().get("a").toString());
assertEquals("a2", q2.properties().get("a").toString());
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class CloningTestCase method testCloningWithVariants.
public void testCloningWithVariants() {
QueryProfile test = new QueryProfile("test");
test.setDimensions(new String[] { "x" });
test.freeze();
Query q1 = new Query(HttpRequest.createTestRequest("?query=q&x=x1", Method.GET), test.compile(null));
q1.properties().set("a", "a1");
Query q2 = q1.clone();
q2.properties().set("a", "a2");
assertEquals("a1", q1.properties().get("a"));
assertEquals("a2", q2.properties().get("a"));
}
Aggregations