use of com.yahoo.container.jdisc.JdiscBindingsConfig in project vespa by vespa-engine.
the class MultipleRestApisTest method jersey_bindings_are_included_in_config.
@Test
public void jersey_bindings_are_included_in_config() {
JdiscBindingsConfig config = root.getConfig(JdiscBindingsConfig.class, CLUSTER_ID);
assertThat(config.handlers(HANDLER_ID_1).serverBindings(), hasItems(HTTP_BINDING_1, HTTPS_BINDING_1));
assertThat(config.handlers(HANDLER_ID_2).serverBindings(), hasItems(HTTP_BINDING_2, HTTPS_BINDING_2));
}
use of com.yahoo.container.jdisc.JdiscBindingsConfig in project vespa by vespa-engine.
the class RestApiTest method jersey_bindings_are_included_in_config.
@Test
public void jersey_bindings_are_included_in_config() throws Exception {
setup();
JdiscBindingsConfig config = root.getConfig(JdiscBindingsConfig.class, ClusterId);
assertThat(config.handlers(HandlerId).serverBindings(), hasItems(HttpBinding, HttpsBinding));
}
use of com.yahoo.container.jdisc.JdiscBindingsConfig in project vespa by vespa-engine.
the class RestApiTest method legacy_syntax_should_produce_valid_model.
@Test
public void legacy_syntax_should_produce_valid_model() throws Exception {
String legacyXml = "<container version=\"1.0\" >\n" + " <handler id=\"" + JerseyHandler.CLASS + "\" >\n" + " <binding>" + HttpBinding + "</binding>\n" + " <config name=\"jdisc.jersey.jersey-handler\">\n" + " <jerseyMapping>jersey</jerseyMapping>\n" + " </config>\n" + " </handler>\n" + "</container>";
createModel(root, DomBuilderTest.parse(legacyXml));
Handler<?> handler = (Handler<?>) getContainerComponent("container", JerseyHandler.CLASS);
assertThat(handler, not(nullValue()));
assertThat(handler.getServerBindings(), hasItem(HttpBinding));
JdiscBindingsConfig bindingsConfig = root.getConfig(JdiscBindingsConfig.class, ClusterId);
assertThat(bindingsConfig.handlers(JerseyHandler.CLASS).serverBindings(), hasItem(HttpBinding));
}
use of com.yahoo.container.jdisc.JdiscBindingsConfig 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 in project vespa by vespa-engine.
the class ContainerModelBuilderTest method verify_bindings_for_builtin_handlers.
@Test
public void verify_bindings_for_builtin_handlers() throws Exception {
Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0' />");
createModel(root, clusterElem);
JdiscBindingsConfig config = root.getConfig(JdiscBindingsConfig.class, "default/container.0");
JdiscBindingsConfig.Handlers defaultRootHandler = config.handlers(BindingsOverviewHandler.class.getName());
assertThat(defaultRootHandler.serverBindings(), contains("*://*/"));
JdiscBindingsConfig.Handlers applicationStatusHandler = config.handlers(ApplicationStatusHandler.class.getName());
assertThat(applicationStatusHandler.serverBindings(), contains("http://*/ApplicationStatus", "https://*/ApplicationStatus"));
JdiscBindingsConfig.Handlers statisticsRequestHandler = config.handlers(StatisticsRequestHandler.class.getName());
assertTrue(statisticsRequestHandler.serverBindings(0).startsWith("http://*/statistics"));
assertTrue(statisticsRequestHandler.serverBindings(1).startsWith("https://*/statistics"));
JdiscBindingsConfig.Handlers fileRequestHandler = config.handlers(VipStatusHandler.class.getName());
assertThat(fileRequestHandler.serverBindings(), contains("http://*/status.html", "https://*/status.html"));
}
Aggregations