use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.
the class ContainerModelBuilderTest method component_includes_are_added.
@Test
public void component_includes_are_added() {
VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg("src/test/cfg/application/include_dirs");
VespaModel model = creator.create(true);
ContainerCluster cluster = model.getContainerClusters().get("default");
Map<ComponentId, Component<?, ?>> componentsMap = cluster.getComponentsMap();
Component<?, ?> example = componentsMap.get(ComponentId.fromString("test.Exampledocproc"));
assertThat(example.getComponentId().getName(), is("test.Exampledocproc"));
}
use of com.yahoo.vespa.model.container.ContainerCluster 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.ContainerCluster in project vespa by vespa-engine.
the class JettyContainerModelBuilderTest method ssl_keystore_and_truststore_configurator_can_be_overriden.
@Test
public void ssl_keystore_and_truststore_configurator_can_be_overriden() throws IOException, SAXException {
Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0' jetty='true'>", " <http>", " <server port='9000' id='foo'>", " <ssl-keystore-configurator class='com.yahoo.MySslKeyStoreConfigurator' bundle='mybundle'/>", " <ssl-truststore-configurator class='com.yahoo.MySslTrustStoreConfigurator' bundle='mybundle'/>", " </server>", " <server port='9001' id='bar'/>", " </http>", nodesXml, "</jdisc>");
createModel(root, clusterElem);
ContainerCluster cluster = (ContainerCluster) root.getChildren().get("default");
List<ConnectorFactory> connectorFactories = cluster.getChildrenByTypeRecursive(ConnectorFactory.class);
{
ConnectorFactory firstConnector = connectorFactories.get(0);
assertConnectorHasInjectedComponents(firstConnector, "ssl-keystore-configurator@foo", "ssl-truststore-configurator@foo");
assertComponentHasClassNameAndBundle(getChildComponent(firstConnector, 0), "com.yahoo.MySslKeyStoreConfigurator", "mybundle");
assertComponentHasClassNameAndBundle(getChildComponent(firstConnector, 1), "com.yahoo.MySslTrustStoreConfigurator", "mybundle");
}
{
ConnectorFactory secondConnector = connectorFactories.get(1);
assertConnectorHasInjectedComponents(secondConnector, "ssl-keystore-configurator@bar", "ssl-truststore-configurator@bar");
assertComponentHasClassNameAndBundle(getChildComponent(secondConnector, 0), DefaultSslKeyStoreConfigurator.class.getName(), "jdisc_http_service");
assertComponentHasClassNameAndBundle(getChildComponent(secondConnector, 1), DefaultSslTrustStoreConfigurator.class.getName(), "jdisc_http_service");
}
}
use of com.yahoo.vespa.model.container.ContainerCluster 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.ContainerCluster in project vespa by vespa-engine.
the class SearchBuilderTest method cluster_is_connected_to_content_clusters.
@Test
public void cluster_is_connected_to_content_clusters() throws Exception {
String hosts = hostsXml();
String services = "" + "<services>" + " <admin version='2.0'>" + " <adminserver hostalias='mockhost'/>" + " </admin>" + " <jdisc version='1.0' id='container'>" + " <search>" + " <chain id='mychain' inherits='vespa'/>" + " </search>" + " <nodes>" + " <node hostalias=\"mockhost\" />" + " </nodes>" + " </jdisc>" + contentXml() + "</services>";
VespaModel model = getVespaModelWithMusic(hosts, services);
ContainerCluster cluster = model.getContainerClusters().get("container");
assertFalse(cluster.getSearchChains().localProviders().isEmpty());
}
Aggregations