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