use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class IndexingAndDocprocRoutingTest method noContentClustersOneDocprocCluster.
@Test
public void noContentClustersOneDocprocCluster() throws ParseException, IOException, SAXException {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services version='1.0'>\n" + " <admin version='2.0'>\n" + " <adminserver hostalias='node0'/>\n" + " </admin>\n" + " <jdisc version='1.0' id='dokprok'>\n" + " <document-processing />\n" + " <nodes>\n" + " <node hostalias='node0'/>\n" + " </nodes>\n" + " </jdisc>\n" + "</services>\n";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("music", "title", "artist");
VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create();
assertIndexing(model, new DocprocClusterSpec("dokprok"));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class IndexingAndDocprocRoutingTest method oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain.
@Test
public void oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain() throws IOException, SAXException, ParseException {
final String CLUSTERNAME = "musiccluster";
SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, null, null);
searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
VespaModel model = getIndexedContentVespaModel(Collections.<DocprocClusterSpec>emptyList(), Arrays.asList(searchCluster));
assertIndexing(model, new DocprocClusterSpec(CLUSTERNAME + ".indexing", new DocprocChainSpec("docproc/cluster." + CLUSTERNAME + ".indexing/chain.indexing")));
assertFeedingRoute(model, CLUSTERNAME, "docproc/cluster." + CLUSTERNAME + ".indexing/chain.indexing");
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class StorageContentTest method doTestRouting.
public void doTestRouting(String cluster1docs, String cluster2docs, String expectedRoutes) throws Exception {
VespaModel model = getStorageVespaModel(cluster1docs, cluster2docs);
if (expectedRoutes == null) {
return;
}
Routing routing = model.getRouting();
assertNotNull(routing);
assertEquals(0, routing.getErrors().size());
assertEquals(1, routing.getProtocols().size());
DocumentProtocol protocol = (DocumentProtocol) routing.getProtocols().get(0);
RoutingTableSpec spec = protocol.getRoutingTableSpec();
assertEquals(1, spec.getNumHops());
assertEquals("indexing", spec.getHop(0).getName());
assertEquals("[DocumentRouteSelector]", spec.getHop(0).getSelector());
Map<String, RouteSpec> routes = new TreeMap<>();
for (int i = 0; i < spec.getNumRoutes(); ++i) {
RouteSpec r = spec.getRoute(i);
routes.put(r.getName(), r);
}
{
RouteSpec r = routes.get("default");
assertEquals(1, r.getNumHops());
assertEquals("indexing", r.getHop(0));
}
Set<String> configuredRoutes = new TreeSet<>();
DocumentrouteselectorpolicyConfig.Builder builder = new DocumentrouteselectorpolicyConfig.Builder();
protocol.getConfig(builder);
DocumentrouteselectorpolicyConfig config = new DocumentrouteselectorpolicyConfig(builder);
for (DocumentrouteselectorpolicyConfig.Route r : config.route()) {
configuredRoutes.add(r.name() + " : " + r.selector());
}
StringBuilder routeStr = new StringBuilder();
for (String r : configuredRoutes) {
routeStr.append(r).append('\n');
}
assertEquals(expectedRoutes, routeStr.toString());
}
use of com.yahoo.vespa.model.VespaModel 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));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class IndexedTest method testMixedIndexAndStoreOnly.
@Test
public void testMixedIndexAndStoreOnly() {
String services = "<services version='1.0'>" + " <admin version='2.0'><adminserver hostalias='node0' /></admin>" + " <content id='docstore' version=\"1.0\">" + " <redundancy>1</redundancy>" + " <documents>" + " <document type=\"index_me\" mode=\"index\"/>" + " <document type=\"store_me\" mode=\"store-only\"/>" + " </documents>" + " <group>" + " <node distribution-key=\"0\" hostalias=\"node0\"/>" + " </group>" + " </content>" + "</services>";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("index_me", "store_me");
VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create();
ProtonConfig.Builder pb = new ProtonConfig.Builder();
model.getConfig(pb, "docstore/search/cluster.docstore/0");
ProtonConfig protonConfig = new ProtonConfig(pb);
assertEquals(2, protonConfig.documentdb().size());
assertEquals("index_me", protonConfig.documentdb(0).inputdoctypename());
assertEquals("docstore/search/cluster.docstore/index_me", protonConfig.documentdb(0).configid());
assertEquals("store_me", protonConfig.documentdb(1).inputdoctypename());
assertEquals("docstore/search", protonConfig.documentdb(1).configid());
}
Aggregations