Search in sources :

Example 6 with JdiscBindingsConfig

use of com.yahoo.container.jdisc.JdiscBindingsConfig in project vespa by vespa-engine.

the class ApplicationStatusHandlerTest method request_handlers_are_rendered.

@Test
public void request_handlers_are_rendered() throws Exception {
    final String id = "myHandler";
    final String serverBinding1 = "http://*/serverBinding";
    final String serverBinding2 = "http://*/anotherServerBinding";
    final String clientBinding = "http://*/clientBinding";
    HashMap<ComponentId, RequestHandler> handlersById = new HashMap<>();
    handlersById.put(new ComponentId(id), Mockito.mock(RequestHandler.class));
    JdiscBindingsConfig bindingsConfig = new JdiscBindingsConfig(new JdiscBindingsConfig.Builder().handlers(id, new Handlers.Builder().serverBindings(serverBinding1).serverBindings(serverBinding2).clientBindings(clientBinding)));
    String json = ApplicationStatusHandler.renderRequestHandlers(bindingsConfig, handlersById).toString();
    assertThat(json, containsString("\"" + id + "\""));
    assertThat(json, containsString(serverBinding1));
    assertThat(json, containsString(serverBinding2));
    assertThat(json, containsString(clientBinding));
}
Also used : Handlers(com.yahoo.container.jdisc.JdiscBindingsConfig.Handlers) RequestHandler(com.yahoo.jdisc.handler.RequestHandler) HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ComponentId(com.yahoo.component.ComponentId) JdiscBindingsConfig(com.yahoo.container.jdisc.JdiscBindingsConfig) Test(org.junit.Test)

Aggregations

JdiscBindingsConfig (com.yahoo.container.jdisc.JdiscBindingsConfig)6 Test (org.junit.Test)6 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 ComponentId (com.yahoo.component.ComponentId)2 Handlers (com.yahoo.container.jdisc.JdiscBindingsConfig.Handlers)2 HashMap (java.util.HashMap)2 StatisticsRequestHandler (com.yahoo.container.config.StatisticsRequestHandler)1 VipStatusHandler (com.yahoo.container.handler.VipStatusHandler)1 ApplicationStatusHandler (com.yahoo.container.handler.observability.ApplicationStatusHandler)1 BindingsOverviewHandler (com.yahoo.container.usability.BindingsOverviewHandler)1 RequestHandler (com.yahoo.jdisc.handler.RequestHandler)1 ClientProvider (com.yahoo.jdisc.service.ClientProvider)1 Handler (com.yahoo.vespa.model.container.component.Handler)1 JerseyHandler (com.yahoo.vespa.model.container.jersey.JerseyHandler)1 Element (org.w3c.dom.Element)1