Search in sources :

Example 31 with ContainerCluster

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"));
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Component(com.yahoo.vespa.model.container.component.Component) ComponentId(com.yahoo.component.ComponentId) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Example 32 with ContainerCluster

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())));
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) JettyHttpServer(com.yahoo.vespa.model.container.http.JettyHttpServer)

Example 33 with ContainerCluster

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");
    }
}
Also used : ConnectorFactory(com.yahoo.vespa.model.container.http.ConnectorFactory) Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 34 with ContainerCluster

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())));
}
Also used : ConnectorConfig(com.yahoo.jdisc.http.ConnectorConfig) Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) JettyHttpServer(com.yahoo.vespa.model.container.http.JettyHttpServer) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 35 with ContainerCluster

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());
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Aggregations

ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)42 Test (org.junit.Test)28 VespaModel (com.yahoo.vespa.model.VespaModel)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)11 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)10 Element (org.w3c.dom.Element)6 Component (com.yahoo.vespa.model.container.component.Component)4 ComponentId (com.yahoo.component.ComponentId)3 ContainerModel (com.yahoo.vespa.model.container.ContainerModel)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 DeployState (com.yahoo.config.model.deploy.DeployState)2 Container (com.yahoo.vespa.model.container.Container)2 ContainerDocproc (com.yahoo.vespa.model.container.docproc.ContainerDocproc)2 JettyHttpServer (com.yahoo.vespa.model.container.http.JettyHttpServer)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)1 ConfigModel (com.yahoo.config.model.ConfigModel)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 Zone (com.yahoo.config.provision.Zone)1