Search in sources :

Example 36 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class AccessControlTest method getHttp.

private Http getHttp(Element clusterElem) throws SAXException, IOException {
    createModel(root, clusterElem);
    ContainerCluster cluster = (ContainerCluster) root.getChildren().get("jdisc");
    Http http = cluster.getHttp();
    assertNotNull(http);
    return http;
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Http(com.yahoo.vespa.model.container.http.Http)

Example 37 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class ContainerDocumentApiBuilderTest method document_api_config_is_added_to_container_cluster.

@Test
public void document_api_config_is_added_to_container_cluster() throws Exception {
    Element elem = DomBuilderTest.parse("<jdisc id='cluster1' version='1.0'>", "  <document-api>", "    <abortondocumenterror>false</abortondocumenterror>", "    <maxpendingdocs>4321</maxpendingdocs>", "    <retrydelay>12.34</retrydelay>", "    <route>non-default</route>", "  </document-api>", nodesXml, "</jdisc>");
    createModel(root, elem);
    ContainerCluster cluster = (ContainerCluster) root.getProducer("cluster1");
    FeederConfig.Builder builder = new FeederConfig.Builder();
    cluster.getDocumentApi().getConfig(builder);
    FeederConfig config = new FeederConfig(builder);
    assertThat(config.abortondocumenterror(), is(false));
    assertThat(config.maxpendingdocs(), is(4321));
    assertThat(config.retrydelay(), is(12.34));
    assertThat(config.route(), is("non-default"));
}
Also used : Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 38 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class ContainerDocumentApiBuilderTest method getHandlers.

private Map<String, Handler<?>> getHandlers(String clusterName) {
    ContainerCluster cluster = (ContainerCluster) root.getChildren().get(clusterName);
    Map<String, Handler<?>> handlerMap = new HashMap<>();
    Collection<Handler<?>> handlers = cluster.getHandlers();
    for (Handler<?> handler : handlers) {
        // die on overwrites
        assertThat(handlerMap.containsKey(handler.getComponentId().toString()), is(false));
        handlerMap.put(handler.getComponentId().toString(), handler);
    }
    return handlerMap;
}
Also used : HashMap(java.util.HashMap) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Handler(com.yahoo.vespa.model.container.component.Handler)

Example 39 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class ClusterTest method testEndToEnd.

@Test
public void testEndToEnd() throws Exception {
    String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<services>\n" + "\n" + "  <admin version=\"2.0\">\n" + "    <adminserver hostalias=\"configserver\" />\n" + "    <logserver hostalias=\"logserver\" />\n" + "    <slobroks>\n" + "      <slobrok hostalias=\"configserver\" />\n" + "      <slobrok hostalias=\"logserver\" />\n" + "    </slobroks>\n" + "    <cluster-controllers>\n" + "      <cluster-controller hostalias=\"configserver\"/>" + "      <cluster-controller hostalias=\"configserver2\"/>" + "      <cluster-controller hostalias=\"configserver3\"/>" + "    </cluster-controllers>\n" + "  </admin>\n" + "  <content version='1.0' id='bar'>" + "     <redundancy>1</redundancy>\n" + "     <documents>" + "       <document type=\"type1\" mode=\"index\"/>\n" + "       <document type=\"type2\" mode=\"index\"/>\n" + "     </documents>\n" + "     <group>" + "       <node hostalias='node0' distribution-key='0' />" + "     </group>" + "    <tuning>" + "      <cluster-controller>\n" + "        <init-progress-time>34567</init-progress-time>" + "      </cluster-controller>" + "    </tuning>" + "   </content>" + "\n" + "</services>";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1", "type2");
    VespaModel model = (new VespaModelCreatorWithMockPkg(null, xml, sds)).create();
    assertEquals(2, model.getContentClusters().get("bar").getDocumentDefinitions().size());
    ContainerCluster cluster = model.getAdmin().getClusterControllers();
    assertEquals(3, cluster.getContainers().size());
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Test(org.junit.Test)

Example 40 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class StandaloneDocprocContainerTest method requireNoMbusProvidersWhenStandalone.

@Test
public void requireNoMbusProvidersWhenStandalone() {
    ContainerCluster containerCluster = setupCluster(true);
    Map<ComponentId, Component<?, ?>> components = containerCluster.getComponentsMap();
    boolean foundAtLeastOneClient = false;
    boolean foundAtLeastOneServer = false;
    for (ComponentId componentId : components.keySet()) {
        if (componentId.stringValue().contains("MbusClient"))
            foundAtLeastOneClient = true;
        if (componentId.stringValue().contains("MbusServer"))
            foundAtLeastOneServer = true;
    }
    assertThat(foundAtLeastOneClient, is(false));
    assertThat(foundAtLeastOneServer, is(false));
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Component(com.yahoo.vespa.model.container.component.Component) ComponentId(com.yahoo.component.ComponentId) 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