Search in sources :

Example 76 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class IndexedHierarchicDistributionTest method requireThatDispatcherIsCorrectWithOneGroup.

@Test
public void requireThatDispatcherIsCorrectWithOneGroup() throws Exception {
    ContentCluster c = getOneGroupCluster();
    PartitionsConfig.Dataset dataset = getDataset(c.getSearch().getIndexed().getTLDs().get(0));
    assertEquals(3, dataset.numparts());
    assertEquals(PartitionsConfig.Dataset.Querydistribution.AUTOMATIC, dataset.querydistribution());
    List<PartitionsConfig.Dataset.Engine> engines = dataset.engine();
    assertEquals(3, engines.size());
    assertEngine(0, 0, engines.get(0));
    assertEngine(0, 1, engines.get(1));
    assertEngine(0, 2, engines.get(2));
}
Also used : PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) DispatchUtils.assertEngine(com.yahoo.vespa.model.search.utils.DispatchUtils.assertEngine) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 77 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class IndexedTest method requireCorrectClusterList.

@Test
public void requireCorrectClusterList() {
    VespaModel model = getStreamingVespaModel();
    ContentCluster s = model.getContentClusters().get("test");
    assertNotNull(s);
    assertFalse(s.getSearch().hasIndexedCluster());
    ClusterListConfig config = model.getConfig(ClusterListConfig.class, VespaModel.ROOT_CONFIGID);
    assertThat(config.storage().size(), is(1));
    assertThat(config.storage(0).name(), is("test"));
    assertThat(config.storage(0).configid(), is("test"));
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ClusterListConfig(com.yahoo.cloud.config.ClusterListConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 78 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class StorageClusterTest method parse.

StorageCluster parse(String xml) throws Exception {
    MockRoot root = new MockRoot();
    root.getDeployState().getDocumentModel().getDocumentManager().add(new NewDocumentType(new NewDocumentType.Name("music")));
    root.getDeployState().getDocumentModel().getDocumentManager().add(new NewDocumentType(new NewDocumentType.Name("movies")));
    ContentCluster cluster = ContentClusterUtils.createCluster(xml, root);
    root.freezeModelTopology();
    return cluster.getStorageNodes();
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) NewDocumentType(com.yahoo.documentmodel.NewDocumentType) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 79 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class StorageGroupTest method testSingleGroup.

@Test
public void testSingleGroup() throws Exception {
    StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
    ContentCluster cluster = parse("<content id=\"storage\">\n" + "  <documents/>" + "  <group>\n" + "    <node jvmargs=\"foo\" hostalias=\"mockhost\" distribution-key=\"0\"/>\n" + "    <node hostalias=\"mockhost\" distribution-key=\"1\"/>\n" + "  </group>\n" + "</content>");
    cluster.getConfig(builder);
    assertEquals("content", cluster.getStorageNodes().getChildren().get("0").getServicePropertyString("clustertype"));
    assertEquals("storage", cluster.getStorageNodes().getChildren().get("0").getServicePropertyString("clustername"));
    assertEquals("0", cluster.getStorageNodes().getChildren().get("0").getServicePropertyString("index"));
    assertEquals("content", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("clustertype"));
    assertEquals("storage", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("clustername"));
    assertEquals("0", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("index"));
    StorDistributionConfig config = new StorDistributionConfig(builder);
    assertEquals(1, config.group().size());
    assertEquals("invalid", config.group(0).index());
    assertEquals("invalid", config.group(0).name());
    assertEquals(2, config.group(0).nodes().size());
    assertEquals(0, config.group(0).nodes(0).index());
    assertEquals(1, config.group(0).nodes(1).index());
// assertNotNull(cluster.getRootGroup().getNodes().get(0).getHost());
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 80 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentClusterUtils method createCluster.

public static ContentCluster createCluster(String clusterXml, List<String> searchDefinitions) throws Exception {
    MockRoot root = createMockRoot(searchDefinitions);
    ContentCluster cluster = createCluster(clusterXml, root);
    root.freezeModelTopology();
    cluster.validate();
    return cluster;
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Aggregations

ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)83 Test (org.junit.Test)70 VespaModel (com.yahoo.vespa.model.VespaModel)22 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)20 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)18 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)15 MockRoot (com.yahoo.config.model.test.MockRoot)7 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)7 SearchDefinitionBuilder (com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder)6 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)5 HostResource (com.yahoo.vespa.model.HostResource)5 SearchNode (com.yahoo.vespa.model.search.SearchNode)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)4 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)4 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)4 VDSEngine (com.yahoo.vespa.model.content.engines.VDSEngine)4 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)3 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)2