use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class CloningTestCase method testThreeLevelsOfCloningMiddleFirstSetOrder1.
public void testThreeLevelsOfCloningMiddleFirstSetOrder1() {
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");
q32.properties().set("a", "q32-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("q32-a", q32.properties().get("a").toString());
q2.properties().set("a", "q2-a-2");
assertEquals("q1-a", q1.properties().get("a").toString());
assertEquals("q2-a-2", q2.properties().get("a").toString());
assertEquals("q31-a", q31.properties().get("a").toString());
assertEquals("q32-a", q32.properties().get("a").toString());
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class CloningTestCase method testThreeLevelsOfCloningReverseSetOrder.
public void testThreeLevelsOfCloningReverseSetOrder() {
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();
q32.properties().set("a", "q32-a");
q31.properties().set("a", "q31-a");
q2.properties().set("a", "q2-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("q32-a", q32.properties().get("a").toString());
q2.properties().set("a", "q2-a-2");
assertEquals("q1-a", q1.properties().get("a").toString());
assertEquals("q2-a-2", q2.properties().get("a").toString());
assertEquals("q31-a", q31.properties().get("a").toString());
assertEquals("q32-a", q32.properties().get("a").toString());
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileGetMicroBenchmark method createQuery.
private Query createQuery() {
QueryProfile main = new QueryProfile("main");
main.set("a", "value1", (QueryProfileRegistry) null);
main.set("b", "value2", useDimensions ? new String[] { "x1" } : null, null);
main.set("c", "value3", useDimensions ? new String[] { "x1", "y2" } : null, null);
main.freeze();
Query query = new Query(HttpRequest.createTestRequest("?query=test&x=1&y=2", Method.GET), main.compile(null));
setValues(query);
return query;
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryTestCase method testSetNullProperty.
@Test
public void testSetNullProperty() {
QueryProfile profile = new QueryProfile("test");
profile.set("property", "initialValue", (QueryProfileRegistry) null);
Query query = new Query(httpEncode("?query=test"), profile.compile(null));
assertEquals("initialValue", query.properties().get("property"));
query.properties().set("property", null);
assertNull(query.properties().get("property"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryTestCase method testTimeoutInRequestOverridesQueryProfile.
@Test
public void testTimeoutInRequestOverridesQueryProfile() {
QueryProfile profile = new QueryProfile("test");
profile.set("timeout", 318, (QueryProfileRegistry) null);
Query q = new Query(QueryTestCase.httpEncode("/search?timeout=500"), profile.compile(null));
assertEquals(500000L, q.getTimeout());
}
Aggregations