Search in sources :

Example 21 with NonWorkingRequestHandler

use of com.yahoo.jdisc.test.NonWorkingRequestHandler 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);
}
Also used : RequestHandler(com.yahoo.jdisc.handler.RequestHandler) NonWorkingRequestHandler(com.yahoo.jdisc.test.NonWorkingRequestHandler) NonWorkingRequestHandler(com.yahoo.jdisc.test.NonWorkingRequestHandler) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 22 with NonWorkingRequestHandler

use of com.yahoo.jdisc.test.NonWorkingRequestHandler 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);
}
Also used : RequestHandler(com.yahoo.jdisc.handler.RequestHandler) NonWorkingRequestHandler(com.yahoo.jdisc.test.NonWorkingRequestHandler) NonWorkingRequestHandler(com.yahoo.jdisc.test.NonWorkingRequestHandler) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 23 with NonWorkingRequestHandler

use of com.yahoo.jdisc.test.NonWorkingRequestHandler 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")));
}
Also used : RequestHandler(com.yahoo.jdisc.handler.RequestHandler) NonWorkingRequestHandler(com.yahoo.jdisc.test.NonWorkingRequestHandler) NonWorkingRequestHandler(com.yahoo.jdisc.test.NonWorkingRequestHandler) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

NonWorkingRequestHandler (com.yahoo.jdisc.test.NonWorkingRequestHandler)23 Test (org.junit.Test)23 RequestHandler (com.yahoo.jdisc.handler.RequestHandler)22 LinkedHashMap (java.util.LinkedHashMap)19 Map (java.util.Map)3 BindingSet (com.yahoo.jdisc.application.BindingSet)2 ContainerBuilder (com.yahoo.jdisc.application.ContainerBuilder)2 UriPattern (com.yahoo.jdisc.application.UriPattern)2 TestDriver (com.yahoo.jdisc.test.TestDriver)2 Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)1 SimpleProtocol (com.yahoo.messagebus.test.SimpleProtocol)1