use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class BindingSetTestCase method requireThatToStringMethodWorks.
@Test
public void requireThatToStringMethodWorks() {
Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>();
RequestHandler foo = new NonWorkingRequestHandler();
RequestHandler bar = new NonWorkingRequestHandler();
handlers.put(new UriPattern("http://host/foo"), foo);
handlers.put(new UriPattern("http://host/bar"), bar);
BindingSet<RequestHandler> bindings = new BindingSet<>(handlers.entrySet());
assertNotNull(bindings);
// Just to get code coverage.
assertNotNull(bindings.toString());
}
use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class BindingSetTestCase method requireThatPathOverPortsDoNotWorkOverStricterPatterns.
@Test
public void requireThatPathOverPortsDoNotWorkOverStricterPatterns() {
Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>();
RequestHandler foo = new NonWorkingRequestHandler();
RequestHandler bar = new NonWorkingRequestHandler();
handlers.put(new UriPattern("http://host:4050/a/"), foo);
handlers.put(new UriPattern("http://host/a/"), bar);
BindingSet<RequestHandler> bindings = new BindingSet<>(handlers.entrySet());
assertNotNull(bindings);
assertSame(foo, bindings.resolve(URI.create("http://host:4050/a/")));
}
use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class BindingSetTestCase method requireThatPathsAreOrdered.
@Test
public void requireThatPathsAreOrdered() {
Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>();
RequestHandler foo = new NonWorkingRequestHandler();
RequestHandler bar = new NonWorkingRequestHandler();
RequestHandler car = new NonWorkingRequestHandler();
handlers.put(new UriPattern("http://host:5050/a/"), foo);
handlers.put(new UriPattern("http://host:5050/b/"), bar);
handlers.put(new UriPattern("http://host/a/"), car);
BindingSet<RequestHandler> bindings = new BindingSet<>(handlers.entrySet());
assertNotNull(bindings);
assertSame(foo, bindings.resolve(URI.create("http://host:5050/a/")));
assertSame(bar, bindings.resolve(URI.create("http://host:5050/b/")));
assertSame(car, bindings.resolve(URI.create("http://host/a/")));
assertSame(car, bindings.resolve(URI.create("http://host:8080/a/")));
assertSame(car, bindings.resolve(URI.create("http://host:80/a/")));
}
use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class BindingSetTestCase method requireThatPortsAreOrdered.
@Test
public void requireThatPortsAreOrdered() {
Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>();
RequestHandler foo = new NonWorkingRequestHandler();
RequestHandler bar = new NonWorkingRequestHandler();
RequestHandler car = new NonWorkingRequestHandler();
handlers.put(new UriPattern("http://host:5050/a/"), foo);
handlers.put(new UriPattern("http://host:5051/a/"), bar);
handlers.put(new UriPattern("http://host/a/"), car);
BindingSet<RequestHandler> bindings = new BindingSet<>(handlers.entrySet());
assertNotNull(bindings);
assertSame(foo, bindings.resolve(URI.create("http://host:5050/a/")));
assertSame(bar, bindings.resolve(URI.create("http://host:5051/a/")));
assertSame(car, bindings.resolve(URI.create("http://host/a/")));
assertSame(car, bindings.resolve(URI.create("http://host:8080/a/")));
assertSame(car, bindings.resolve(URI.create("http://host:80/a/")));
}
use of com.yahoo.jdisc.handler.RequestHandler in project vespa by vespa-engine.
the class BindingSetTestCase method requireThatTreeSplitCanBeBoundForSchemes.
@Test
public void requireThatTreeSplitCanBeBoundForSchemes() {
Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>();
RequestHandler httpfoo = new NonWorkingRequestHandler();
RequestHandler httpsfoo = new NonWorkingRequestHandler();
RequestHandler ftpfoo = new NonWorkingRequestHandler();
handlers.put(new UriPattern("http://host/foo"), httpfoo);
handlers.put(new UriPattern("https://host/foo"), httpsfoo);
handlers.put(new UriPattern("ftp://host/foo"), ftpfoo);
BindingSet<RequestHandler> bindings = new BindingSet<>(handlers.entrySet());
assertNotNull(bindings);
}
Aggregations