use of com.yahoo.container.jdisc.JdiscBindingsConfig.Handlers in project vespa by vespa-engine.
the class ApplicationStatusHandlerTest method client_providers_are_rendered.
@Test
public void client_providers_are_rendered() throws Exception {
final String id = "myClient";
final String clientBinding = "http://*/clientBinding";
final String clientBinding2 = "http://*/anotherClientBinding";
final String serverBinding = "http://*/serverBinding";
HashMap<ComponentId, ClientProvider> clientsById = new HashMap<>();
clientsById.put(new ComponentId(id), Mockito.mock(ClientProvider.class));
JdiscBindingsConfig bindingsConfig = new JdiscBindingsConfig(new JdiscBindingsConfig.Builder().handlers(id, new Handlers.Builder().clientBindings(clientBinding).clientBindings(clientBinding2).serverBindings(serverBinding)));
String json = ApplicationStatusHandler.renderRequestHandlers(bindingsConfig, clientsById).toString();
System.out.println(json);
assertThat(json, containsString("\"" + id + "\""));
assertThat(json, containsString(clientBinding));
assertThat(json, containsString(clientBinding2));
assertThat(json, containsString(serverBinding));
}
use of com.yahoo.container.jdisc.JdiscBindingsConfig.Handlers 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));
}
Aggregations