use of com.yahoo.container.jdisc.HttpRequest in project vespa by vespa-engine.
the class XmlReadingTestCase method testSystemtest.
/**
* Tests a subset of the configuration in the system test of this
*/
@Test
public void testSystemtest() {
String queryString = "?query=test";
QueryProfileXMLReader reader = new QueryProfileXMLReader();
CompiledQueryProfileRegistry registry = reader.read("src/test/java/com/yahoo/search/query/profile/config/test/systemtest/").compile();
HttpRequest request = HttpRequest.createTestRequest(queryString, Method.GET);
CompiledQueryProfile profile = registry.findQueryProfile("default");
Query query = new Query(request, profile);
Properties p = query.properties();
assertEquals("test", query.getModel().getQueryString());
assertEquals("test", p.get("query"));
assertEquals("test", p.get("QueRY"));
assertEquals("test", p.get("model.queryString"));
assertEquals("bar", p.get("foo"));
assertEquals(5, p.get("hits"));
assertEquals("tit", p.get("subst"));
assertEquals("le", p.get("subst.end"));
assertEquals("title", p.get("model.defaultIndex"));
Map<String, Object> ps = p.listProperties();
assertEquals(6, ps.size());
assertEquals("bar", ps.get("foo"));
assertEquals("5", ps.get("hits"));
assertEquals("tit", ps.get("subst"));
assertEquals("le", ps.get("subst.end"));
assertEquals("title", ps.get("model.defaultIndex"));
assertEquals("test", ps.get("model.queryString"));
}
use of com.yahoo.container.jdisc.HttpRequest in project vespa by vespa-engine.
the class XmlReadingTestCase method testQueryProfileVariants.
@Test
public void testQueryProfileVariants() {
String query = "?query=test&dim1=yahoo&dim2=uk&dim3=test";
QueryProfileXMLReader reader = new QueryProfileXMLReader();
CompiledQueryProfileRegistry registry = reader.read("src/test/java/com/yahoo/search/query/profile/config/test/news/").compile();
HttpRequest request = HttpRequest.createTestRequest(query, Method.GET);
CompiledQueryProfile profile = registry.findQueryProfile("default");
Query q = new Query(request, profile);
assertEquals("c", q.properties().get("a.c"));
assertEquals("b", q.properties().get("a.b"));
}
Aggregations