use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class BindingSetTestCase method requireThatTreeSplitCanBeBoundForHosts.
@Test
public void requireThatTreeSplitCanBeBoundForHosts() {
Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>();
RequestHandler foo = new NonWorkingRequestHandler();
RequestHandler foobar = new NonWorkingRequestHandler();
RequestHandler fooqux = new NonWorkingRequestHandler();
handlers.put(new UriPattern("http://hostabc/foo"), foobar);
handlers.put(new UriPattern("http://hostpqr/foo"), fooqux);
handlers.put(new UriPattern("http://host/foo"), foo);
BindingSet<RequestHandler> bindings = new BindingSet<>(handlers.entrySet());
assertNotNull(bindings);
}
use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class BindingSetTestCase method requireThatPathOverPortWorks.
@Test
public void requireThatPathOverPortWorks() {
Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>();
RequestHandler applicationStatus = new NonWorkingRequestHandler();
RequestHandler search = new NonWorkingRequestHandler();
RequestHandler legacy = new NonWorkingRequestHandler();
handlers.put(new UriPattern("http://*/processing/*"), new NonWorkingRequestHandler());
handlers.put(new UriPattern("http://*/statistics/*"), new NonWorkingRequestHandler());
handlers.put(new UriPattern("http://*/state/v1/*"), new NonWorkingRequestHandler());
handlers.put(new UriPattern("http://*/search/*"), search);
handlers.put(new UriPattern("http://*/status.html"), new NonWorkingRequestHandler());
handlers.put(new UriPattern("http://*/ApplicationStatus"), applicationStatus);
handlers.put(new UriPattern("http://*:" + getDefaults().vespaWebServicePort() + "/*"), legacy);
BindingSet<RequestHandler> bindings = new BindingSet<>(handlers.entrySet());
assertNotNull(bindings);
assertSame(applicationStatus, bindings.resolve(URI.create("http://abcxyz.yahoo.com:" + getDefaults().vespaWebServicePort() + "/ApplicationStatus")));
assertSame(search, bindings.resolve(URI.create("http://abcxyz.yahoo.com:" + getDefaults().vespaWebServicePort() + "/search/?query=sddocname:music")));
assertSame(legacy, bindings.resolve(URI.create("http://abcxyz.yahoo.com:" + getDefaults().vespaWebServicePort() + "/stats/?query=stat:query")));
}
use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class ThroughputTestCase method runUnthreadedMeasurementsWithWorkload.
@Test
public void runUnthreadedMeasurementsWithWorkload() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
// warmup
runMeasurements(driver, new UnthreadedHandler(MAX_LOOPS));
StringBuilder out = new StringBuilder();
out.append("\n");
out.append(" | ");
for (int i = MIN_THREADS; i <= MAX_THREADS; i *= 2) {
out.append(String.format("%10d", i));
}
out.append("\n");
out.append("------+-");
for (int i = MIN_THREADS; i <= MAX_THREADS; i *= 2) {
out.append("----------");
}
out.append("\n");
for (int i = MIN_LOOPS; i <= MAX_LOOPS; i = Math.max(1, i * 2)) {
out.append(String.format("%5d | ", i));
RequestHandler handler = new UnthreadedHandler(i);
for (Long val : runMeasurements(driver, handler)) {
out.append(String.format("%10d", val));
}
out.append("\n");
}
System.err.println(out);
System.err.println(preventOptimization);
assertTrue(driver.close());
}
Aggregations