use of com.yahoo.vespa.model.container.http.JettyHttpServer in project vespa by vespa-engine.
the class JettyContainerModelBuilderTest method assertJettyServerInConfig.
private void assertJettyServerInConfig() {
ContainerCluster cluster = (ContainerCluster) root.getChildren().get("default");
List<JettyHttpServer> jettyServers = cluster.getChildrenByTypeRecursive(JettyHttpServer.class);
assertThat(jettyServers.size(), is(1));
JettyHttpServer server = jettyServers.get(0);
assertThat(server.model.bundleInstantiationSpec.classId.toString(), is(com.yahoo.jdisc.http.server.jetty.JettyHttpServer.class.getName()));
assertThat(server.model.bundleInstantiationSpec.bundle.toString(), is("jdisc_http_service"));
assertThat(server.getConnectorFactories().size(), is(1));
assertThat(extractComponentByClassName(containerComponentsConfig(), com.yahoo.jdisc.http.server.jetty.JettyHttpServer.class.getName()), is(not(nullValue())));
}
use of com.yahoo.vespa.model.container.http.JettyHttpServer in project vespa by vespa-engine.
the class JettyContainerModelBuilderTest method verify_that_old_http_config_override_inside_server_tag_works.
@Test
public void verify_that_old_http_config_override_inside_server_tag_works() throws Exception {
Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0' jetty='true'>", " <http>", " <server port='9000' id='foo'>", " <config name=\"container.jdisc.config.http-server\">", " <tcpKeepAliveEnabled>true</tcpKeepAliveEnabled>", " <tcpNoDelayEnabled>false</tcpNoDelayEnabled>", " <tcpListenBacklogLength>2</tcpListenBacklogLength>", " <idleConnectionTimeout>34.1</idleConnectionTimeout>", " <soLinger>42.2</soLinger>", " <sendBufferSize>1234</sendBufferSize>", " <maxHeaderSize>4321</maxHeaderSize>", " <ssl>", " <enabled>true</enabled>", " <keyStoreType>JKS</keyStoreType>", " <keyStorePath>apple</keyStorePath>", " <trustStorePath>grape</trustStorePath>", " <keyDBKey>tomato</keyDBKey>", " <algorithm>onion</algorithm>", " <protocol>carrot</protocol>", " </ssl>", " </config>", " </server>", " </http>", nodesXml, "</jdisc>");
createModel(root, clusterElem);
ContainerCluster cluster = (ContainerCluster) root.getChildren().get("default");
List<JettyHttpServer> jettyServers = cluster.getChildrenByTypeRecursive(JettyHttpServer.class);
assertThat(jettyServers.size(), is(1));
JettyHttpServer server = jettyServers.get(0);
assertThat(server.model.bundleInstantiationSpec.classId.toString(), is(com.yahoo.jdisc.http.server.jetty.JettyHttpServer.class.getName()));
assertThat(server.model.bundleInstantiationSpec.bundle.toString(), is("jdisc_http_service"));
assertThat(server.getConnectorFactories().size(), is(1));
ConnectorConfig.Builder connectorConfigBuilder = new ConnectorConfig.Builder();
server.getConnectorFactories().get(0).getConfig(connectorConfigBuilder);
ConnectorConfig connector = new ConnectorConfig(connectorConfigBuilder);
assertThat(connector.name(), equalTo("foo"));
assertThat(connector.tcpKeepAliveEnabled(), equalTo(true));
assertThat(connector.tcpNoDelay(), equalTo(false));
assertThat(connector.acceptQueueSize(), equalTo(2));
assertThat(connector.idleTimeout(), equalTo(34.1));
assertThat(connector.soLingerTime(), equalTo(42.2));
assertThat(connector.outputBufferSize(), equalTo(1234));
assertThat(connector.headerCacheSize(), equalTo(4321));
assertThat(connector.ssl().enabled(), equalTo(true));
assertThat(connector.ssl().keyStoreType(), equalTo(KeyStoreType.Enum.JKS));
assertThat(connector.ssl().keyStorePath(), equalTo("apple"));
assertThat(connector.ssl().trustStorePath(), equalTo("grape"));
assertThat(connector.ssl().keyDbKey(), equalTo("tomato"));
assertThat(connector.ssl().sslKeyManagerFactoryAlgorithm(), equalTo("onion"));
assertThat(connector.ssl().protocol(), equalTo("carrot"));
assertThat(extractComponentByClassName(clusterComponentsConfig(), com.yahoo.jdisc.http.server.jetty.JettyHttpServer.class.getName()), is(not(nullValue())));
}
use of com.yahoo.vespa.model.container.http.JettyHttpServer in project vespa by vespa-engine.
the class JettyHttpServerBuilder method doBuild.
@Override
protected JettyHttpServer doBuild(AbstractConfigProducer ancestor, Element http) {
JettyHttpServer jettyHttpServer = new JettyHttpServer(new ComponentId("jdisc-jetty"));
for (Element serverSpec : XML.getChildren(http, "server")) {
ConnectorFactory connectorFactory = new JettyConnectorBuilder().build(ancestor, serverSpec);
jettyHttpServer.addConnector(connectorFactory);
}
return jettyHttpServer;
}
Aggregations