use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class DocumentDatabaseTestCase method assertAttributesConfigIndependentOfMode.
private void assertAttributesConfigIndependentOfMode(String mode, List<String> sds, List<String> documentDBConfigIds, Map<String, List<String>> expectedAttributesMap) {
VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, mode), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
ProtonConfig proton = getProtonCfg(contentSearchCluster);
assertEquals(sds.size(), proton.documentdb().size());
for (int i = 0; i < sds.size(); i++) {
assertEquals(sds.get(i), proton.documentdb(i).inputdoctypename());
assertEquals(documentDBConfigIds.get(i), proton.documentdb(i).configid());
List<String> expectedAttributes = expectedAttributesMap.get(sds.get(i));
if (expectedAttributes != null) {
AttributesConfig rac1 = model.getConfig(AttributesConfig.class, proton.documentdb(i).configid());
assertEquals(expectedAttributes.size(), rac1.attribute().size());
for (int j = 0; j < expectedAttributes.size(); j++) {
assertEquals(expectedAttributes.get(j), rac1.attribute(j).name());
}
}
}
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class DocumentDatabaseTestCase method requireThatRelevantConfigIsAvailableForClusterSearcher.
@Test
public void requireThatRelevantConfigIsAvailableForClusterSearcher() throws ParseException, IOException, SAXException {
final List<String> sds = Arrays.asList("type1", "type2");
VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, "index"), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
String searcherId = "container/searchchains/chain/test/component/com.yahoo.prelude.cluster.ClusterSearcher";
{
// documentdb-info config
DocumentdbInfoConfig dcfg = model.getConfig(DocumentdbInfoConfig.class, searcherId);
assertEquals(2, dcfg.documentdb().size());
{
// type1
DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(0);
assertEquals("type1", db.name());
assertEquals(6, db.rankprofile().size());
assertRankProfile(db, 0, "default", false, false);
assertRankProfile(db, 1, "unranked", false, false);
assertRankProfile(db, 2, "staticrank", false, false);
assertRankProfile(db, 3, "summaryfeatures", true, false);
assertRankProfile(db, 4, "inheritedsummaryfeatures", true, false);
assertRankProfile(db, 5, "rankfeatures", false, true);
assertEquals(2, db.summaryclass().size());
assertEquals("default", db.summaryclass(0).name());
assertEquals("attributeprefetch", db.summaryclass(1).name());
assertSummaryField(db, 0, 0, "f1", "longstring", true);
assertSummaryField(db, 0, 1, "f2", "integer", false);
}
{
// type2
DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(1);
assertEquals("type2", db.name());
}
}
{
// attributes config
AttributesConfig acfg = model.getConfig(AttributesConfig.class, searcherId);
assertEquals(4, acfg.attribute().size());
assertEquals("f2", acfg.attribute(0).name());
assertEquals("f2_nfa", acfg.attribute(1).name());
assertEquals("f4", acfg.attribute(2).name());
assertEquals("f4_nfa", acfg.attribute(3).name());
}
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class VespaModelTestCase method testCommonConfig.
// Verify that common config from plugins is delivered from the root node for any configId, using the Builder based API
@Test
public void testCommonConfig() throws Exception {
VespaModel model = getVespaModel(TESTDIR + "app_nohosts/");
LogdConfig.Builder b = new LogdConfig.Builder();
b = (LogdConfig.Builder) model.getConfig(b, "");
LogdConfig c = new LogdConfig(b);
assertEquals(HostName.getLocalhost(), c.logserver().host());
SlobroksConfig.Builder sb = new SlobroksConfig.Builder();
sb = (com.yahoo.cloud.config.SlobroksConfig.Builder) model.getConfig(sb, "");
SlobroksConfig sbc = new SlobroksConfig(sb);
assertEquals(sbc.slobrok().size(), 1);
ZookeepersConfig.Builder zb = new ZookeepersConfig.Builder();
zb = (ZookeepersConfig.Builder) model.getConfig(zb, "");
ZookeepersConfig zc = new ZookeepersConfig(zb);
assertEquals(zc.zookeeperserverlist().split(",").length, 2);
assertTrue(zc.zookeeperserverlist().startsWith(HostName.getLocalhost()));
ApplicationIdConfig.Builder appIdBuilder = new ApplicationIdConfig.Builder();
appIdBuilder = (ApplicationIdConfig.Builder) model.getConfig(appIdBuilder, "");
ApplicationIdConfig applicationIdConfig = new ApplicationIdConfig(appIdBuilder);
assertEquals(ApplicationId.defaultId().tenant().value(), applicationIdConfig.tenant());
assertEquals(ApplicationId.defaultId().application().value(), applicationIdConfig.application());
assertEquals(ApplicationId.defaultId().instance().value(), applicationIdConfig.instance());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class VespaModelTestCase method testIllegalConfigIdWithBuilders.
@Ignore
@Test(expected = UnknownConfigIdException.class)
public void testIllegalConfigIdWithBuilders() {
VespaModel model = getVespaModel(TESTDIR + "app_nohosts/");
DocumentmanagerConfig.Builder db = new DocumentmanagerConfig.Builder();
model.getConfig(db, "bogus");
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class VespaModelTestCase method testCreateFromReaders.
@Test
public void testCreateFromReaders() throws SAXException, IOException {
VespaModel model = CommonVespaModelSetup.createVespaModelWithMusic(simpleHosts, "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<services version=\"1.0\">" + "<admin version=\"2.0\">" + " <adminserver hostalias=\"node0\" />" + "</admin>" + "<container version=\"1.0\">" + " <nodes>" + " <node hostalias=\"node0\" />" + " </nodes>" + " <search/>" + " <document-api/>" + "</container>" + "<content id=\"music\" version=\"1.0\">" + " <redundancy>1</redundancy>" + " <nodes>" + " <node hostalias=\"node0\" distribution-key=\"0\"/>" + " </nodes>" + " <documents>" + " <document type=\"music\" mode=\"index\"/>" + " </documents>" + "</content>" + "</services>");
MessagebusConfig.Builder mBusB = new MessagebusConfig.Builder();
model.getConfig(mBusB, "client");
MessagebusConfig mBus = new MessagebusConfig(mBusB);
assertEquals(mBus.routingtable().size(), 1);
}
Aggregations