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));
}
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"));
}
Aggregations