use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class UserInputTestCase method setUp.
@Before
public void setUp() throws Exception {
searchChain = new Chain<Searcher>(new MinimalQueryInserter());
context = Execution.Context.createContextStub(null);
execution = new Execution(searchChain, context);
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class CacheControlSearcherTestCase method testNoHeader.
public void testNoHeader() {
Chain<Searcher> chain = getSearchChain();
Query query = new Query("?query=foo&custid=foo");
Result result = new Execution(chain, Execution.Context.createContextStub()).search(query);
assertEquals(0, getCacheControlHeaders(result).size());
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class CacheControlSearcherTestCase method testStateWhileRevalidate.
public void testStateWhileRevalidate() {
Chain<Searcher> chain = getSearchChain();
Query query = new Query("?query=foo&custid=foo&cachecontrol.staleage=3600");
Result result = new Execution(chain, Execution.Context.createContextStub()).search(query);
assertCacheHeaders(new String[] { "stale-while-revalidate=3600" }, getCacheControlHeaders(result));
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class CacheControlSearcherTestCase method testStaleAndMaxAge.
public void testStaleAndMaxAge() {
Chain<Searcher> chain = getSearchChain();
Query query = new Query("?query=foo&custid=foo&cachecontrol.maxage=60&cachecontrol.staleage=3600");
Result result = new Execution(chain, Execution.Context.createContextStub()).search(query);
assertCacheHeaders(new String[] { "max-age=60", "stale-while-revalidate=3600" }, getCacheControlHeaders(result));
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class CacheControlSearcherTestCase method testInvalidAgeParams.
public void testInvalidAgeParams() {
Chain<Searcher> chain = getSearchChain();
try {
Query query = new Query("?query=foo&custid=foo&cachecontrol.maxage=foo");
Result result = new Execution(chain, Execution.Context.createContextStub()).search(query);
assertEquals(0, getCacheControlHeaders(result).size());
fail("Expected exception");
} catch (NumberFormatException e) {
// success
}
try {
Query query = new Query("?query=foo&custid=foo&cachecontrol.staleage=foo");
Result result = new Execution(chain, Execution.Context.createContextStub()).search(query);
assertEquals(0, getCacheControlHeaders(result).size());
fail("Expected exception");
} catch (NumberFormatException e) {
// success
}
}
Aggregations