Search in sources :

Example 41 with ContainerCluster

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

the class StandaloneDocprocContainerTest method requireMbusProvidersWhenNonStandalone.

@Test
public void requireMbusProvidersWhenNonStandalone() {
    ContainerCluster containerCluster = setupCluster(false);
    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(true));
    assertThat(foundAtLeastOneServer, is(true));
}
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)

Example 42 with ContainerCluster

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

the class SearchClusterTest method search_model_is_connected_to_container_clusters_two_content_clusters.

@Test
public void search_model_is_connected_to_container_clusters_two_content_clusters() throws Exception {
    String services = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<services version=\"1.0\">" + "  <admin version='2.0'>" + "    <adminserver hostalias='node0' />" + "  </admin>\n" + "  <jdisc version='1.0' id='j1'>\n" + "    <search>" + "      <chain id='s1Chain'>" + "        <searcher id='S1ClusterSearcher'/>" + "      </chain>" + "      <provider cluster='normal' id='normal' type='local'/>\n" + "    </search>" + "    <nodes>" + "      <node hostalias=\"node0\" />" + "    </nodes>" + "  </jdisc>" + "  <jdisc version='1.0' id='j2'>" + "    <search>" + "      <chain id='s2Chain'>" + "        <searcher id='S2ClusterSearcher'/>" + "      </chain>" + "      <provider cluster='xbulk' id='xbulk' type='local'/>" + "    </search>" + "    <nodes>" + "      <node hostalias=\"node2\" />" + "    </nodes>" + "  </jdisc>" + "  <content id='xbulk' version=\"1.0\">" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document mode='index' type=\"music\" />" + "     </documents>" + "         <nodes>" + "            <node hostalias=\"node0\" distribution-key=\"0\" />" + "         </nodes>" + "  </content>" + "  <content id=\"normal\" version='1.0'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document mode='index' type=\"music\" />" + "     </documents>" + "         <nodes>" + "            <node hostalias=\"node2\" distribution-key=\"0\" />" + "         </nodes>" + "  </content>" + "</services>";
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, services, ApplicationPackageUtils.generateSearchDefinitions("music")).create();
    ContainerCluster cluster1 = (ContainerCluster) model.getConfigProducer("j1").get();
    assertFalse(cluster1.getSearch().getChains().localProviders().isEmpty());
    ContainerCluster cluster2 = (ContainerCluster) model.getConfigProducer("j2").get();
    assertFalse(cluster2.getSearch().getChains().localProviders().isEmpty());
    QrSearchersConfig.Builder builder = new QrSearchersConfig.Builder();
    cluster1.getConfig(builder);
    QrSearchersConfig config = new QrSearchersConfig(builder);
    assertThat(config.searchcluster().size(), is(2));
    int normalId = 0;
    int bulkId = 1;
    assertThat(config.searchcluster().get(normalId).name(), is("normal"));
    assertThat(config.searchcluster().get(bulkId).name(), is("xbulk"));
    ClusterConfig.Builder clusterConfigBuilder = new ClusterConfig.Builder();
    model.getConfig(clusterConfigBuilder, "j1/searchchains/chain/normal/component/com.yahoo.prelude.cluster.ClusterSearcher");
    ClusterConfig clusterConfig = new ClusterConfig(clusterConfigBuilder);
    assertThat(clusterConfig.clusterId(), is(normalId));
    assertThat(clusterConfig.clusterName(), is("normal"));
    ClusterConfig.Builder clusterConfigBuilder2 = new ClusterConfig.Builder();
    model.getConfig(clusterConfigBuilder2, "j2/searchchains/chain/xbulk/component/com.yahoo.prelude.cluster.ClusterSearcher");
    ClusterConfig clusterConfig2 = new ClusterConfig(clusterConfigBuilder2);
    assertThat(clusterConfig2.clusterId(), is(bulkId));
    assertThat(clusterConfig2.clusterName(), is("xbulk"));
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ClusterConfig(com.yahoo.search.config.ClusterConfig) Test(org.junit.Test)

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