Search in sources :

Example 11 with HostResource

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

the class ContentBuilderTest method handleIndexedOnlyWithoutPersistence.

@Test
public void handleIndexedOnlyWithoutPersistence() throws Exception {
    VespaModel m = new VespaModelCreatorWithMockPkg(createAppWithMusic(getHosts(), getBasicServices())).create();
    ContentCluster c = CollectionUtil.first(m.getContentClusters().values());
    ContentSearchCluster s = c.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertEquals(1, s.getClusters().size());
    assertNotNull(s.getIndexed());
    assertEquals("clu", s.getIndexed().getClusterName());
    assertEquals(7.3, s.getIndexed().getQueryTimeout(), 0.0);
    assertTrue(c.getPersistence() instanceof ProtonEngine.Factory);
    assertEquals(1, c.getStorageNodes().getChildren().size());
    assertEquals("clu", c.getConfigId());
    // assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId()); // This is how it should look like in an ideal world.
    // Due to reuse.
    assertEquals("clu/storage/0", c.getRootGroup().getNodes().get(0).getConfigId());
    assertEquals(1, c.getRoot().getHostSystem().getHosts().size());
    HostResource h = c.getRoot().getHostSystem().getHost("mockhost");
    String[] expectedServices = { "logd", "configproxy", "config-sentinel", "qrserver", "storagenode", "searchnode", "distributor", "topleveldispatch", "transactionlogserver" };
    // TODO        assertServices(h, expectedServices);
    assertEquals("clu/storage/0", h.getService("storagenode").getConfigId());
    assertEquals("clu/search/cluster.clu/0", h.getService("searchnode").getConfigId());
    assertEquals("clu/distributor/0", h.getService("distributor").getConfigId());
    assertEquals("clu/search/cluster.clu/tlds/qrc.0.tld.0", h.getService("topleveldispatch").getConfigId());
    // assertEquals("tcp/node0:19104", h.getService("topleveldispatch").getConfig("partitions", "").innerArray("dataset").value("0").innerArray("engine").value("0").getString("name_and_port"));
    PartitionsConfig partitionsConfig = new PartitionsConfig((PartitionsConfig.Builder) m.getConfig(new PartitionsConfig.Builder(), "clu/search/cluster.clu/tlds/qrc.0.tld.0"));
    assertTrue(partitionsConfig.dataset(0).engine(0).name_and_port().startsWith("tcp/node0:191"));
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) HostResource(com.yahoo.vespa.model.HostResource) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ProtonEngine(com.yahoo.vespa.model.content.engines.ProtonEngine) Matchers.containsString(org.hamcrest.Matchers.containsString) PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 12 with HostResource

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

the class VespaDomBuilderTest method testHostSystem.

@Test
public void testHostSystem() {
    VespaModel model = createModel(hosts, services);
    HostSystem hostSystem = model.getHostSystem();
    assertThat(hostSystem.getHosts().size(), is(1));
    HostResource host = hostSystem.getHosts().get(0);
    assertThat(host, is(hostSystem.getHostByHostname(host.getHostname())));
    assertNotNull(hostSystem.getHost("node1"));
    assertThat(hostSystem.toString(), is("host '" + host.getHostname() + "'"));
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) VespaModel(com.yahoo.vespa.model.VespaModel) HostSystem(com.yahoo.vespa.model.HostSystem) Test(org.junit.Test)

Example 13 with HostResource

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

the class MultilevelDispatchTest method createCluster.

private ContentCluster createCluster(String dispatchXml) throws Exception {
    String[] hosts = { "mh0", "mh1", "mh2", "mh3", "mh4", "mh5" };
    MockRoot root = ContentClusterUtils.createMockRoot(hosts);
    ContentCluster cluster = ContentClusterUtils.createCluster(createClusterXml(getGroupXml(), Optional.of(dispatchXml), 1, 1), root);
    AbstractConfigProducer<Dispatch> dispatchParent = new SimpleConfigProducer<>(root, "tlds");
    HostResource hostResource = new HostResource(new Host(root, "mockhost"));
    IndexedSearchCluster index = cluster.getSearch().getIndexed();
    index.addTld(dispatchParent, hostResource);
    index.setupDispatchGroups();
    root.freezeModelTopology();
    cluster.validate();
    return cluster;
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) MockRoot(com.yahoo.config.model.test.MockRoot) SimpleConfigProducer(com.yahoo.vespa.model.SimpleConfigProducer) Host(com.yahoo.vespa.model.Host) Matchers.containsString(org.hamcrest.Matchers.containsString) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 14 with HostResource

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

the class SearchNodeTest method prepare.

private void prepare(MockRoot root, SearchNode node) {
    Host host = new Host(root, "mockhost");
    TransactionLogServer tls = new TransactionLogServer(root, "mycluster");
    tls.setHostResource(new HostResource(host));
    tls.setBasePort(100);
    tls.initService();
    node.setTls(tls);
    node.setHostResource(new HostResource(host));
    node.setBasePort(200);
    node.initService();
    root.freezeModelTopology();
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) TransactionLogServer(com.yahoo.vespa.model.search.TransactionLogServer) Host(com.yahoo.vespa.model.Host)

Example 15 with HostResource

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

the class IndexedTest method requireIndexedOnlyServices.

@Test
public void requireIndexedOnlyServices() {
    VespaModel model = getIndexedVespaModel();
    HostResource h = model.getHostSystem().getHosts().get(0);
    String[] expectedServices = { "logserver", "configserver", "adminserver", "slobrok", "logd", "configproxy", "config-sentinel", "qrserver", "fleetcontroller", "topleveldispatch", "docprocservice", "storagenode", "searchnode", "distributor", "transactionlogserver" };
    // TODO DomContentBuilderTest.assertServices(h, expectedServices);
    Routing routing = model.getRouting();
    assertNotNull(routing);
    assertEquals("[]", routing.getErrors().toString());
    assertEquals(1, routing.getProtocols().size());
    DocumentProtocol protocol = (DocumentProtocol) routing.getProtocols().get(0);
    RoutingTableSpec spec = protocol.getRoutingTableSpec();
    assertEquals(2, spec.getNumHops());
    assertEquals("docproc/cluster.test.indexing/chain.indexing", spec.getHop(0).getName());
    assertEquals("indexing", spec.getHop(1).getName());
    RouteSpec r;
    r = spec.getRoute(0);
    assertEquals("default", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("indexing", r.getHop(0));
    r = spec.getRoute(1);
    assertEquals("storage/cluster.test", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("route:test", r.getHop(0));
    r = spec.getRoute(2);
    assertEquals("test", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("[MessageType:test]", r.getHop(0));
    r = spec.getRoute(3);
    assertEquals("test-direct", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("[Content:cluster=test]", r.getHop(0));
    r = spec.getRoute(4);
    assertEquals("test-index", r.getName());
    assertEquals(2, r.getNumHops());
    assertEquals("docproc/cluster.test.indexing/chain.indexing", r.getHop(0));
    assertEquals("[Content:cluster=test]", r.getHop(1));
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) VespaModel(com.yahoo.vespa.model.VespaModel) Routing(com.yahoo.vespa.model.routing.Routing) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) DocumentProtocol(com.yahoo.vespa.model.routing.DocumentProtocol) Test(org.junit.Test)

Aggregations

HostResource (com.yahoo.vespa.model.HostResource)25 Test (org.junit.Test)10 ClusterMembership (com.yahoo.config.provision.ClusterMembership)6 Host (com.yahoo.vespa.model.Host)6 VespaModel (com.yahoo.vespa.model.VespaModel)6 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)5 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)4 ArrayList (java.util.ArrayList)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 MockRoot (com.yahoo.config.model.test.MockRoot)3 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Element (org.w3c.dom.Element)3 HostSystem (com.yahoo.vespa.model.HostSystem)2 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)2 NodesSpecification (com.yahoo.vespa.model.builder.xml.dom.NodesSpecification)2 Container (com.yahoo.vespa.model.container.Container)2 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)2 NodeSpec (com.yahoo.vespa.model.search.NodeSpec)2 SearchNode (com.yahoo.vespa.model.search.SearchNode)2