use of com.yahoo.config.model.ConfigModelRegistry in project vespa by vespa-engine.
the class SystemModelTestCase method getVespaModelDoNotValidateXml.
private static VespaModel getVespaModelDoNotValidateXml(String configPath) {
ConfigModelRegistry registry = MapConfigModelRegistry.createFromList(new SimpleConfigModel.Builder(), new ApiConfigModel.Builder());
VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg(configPath, registry);
// do not validate against schema -- the xml files used here are not valid
return creator.create(false);
}
use of com.yahoo.config.model.ConfigModelRegistry in project vespa by vespa-engine.
the class ModelAmendingTestCase method testModelAmending.
@Test
public void testModelAmending() throws IOException, SAXException {
ConfigModelRegistry amendingModelRepo = MapConfigModelRegistry.createFromList(new AdminModelAmenderBuilder(), new ContainerModelAmenderBuilder(), new ContentModelAmenderBuilder());
String services = "<services version='1.0'>" + " <admin version='4.0'/>" + " <jdisc id='test1' version='1.0'>" + " <search/>" + " <nodes count='2'/>" + " </jdisc>" + " <jdisc id='test2' version='1.0'>" + " <http><server id='server1' port='19110'/></http>" + " <document-api/>" + " <nodes count='2'/>" + " </jdisc>" + " <content id='test3' version='1.0'>" + " <redundancy>1</redundancy>" + " <documents>" + " <document mode='index' type='type1'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + " <content id='test4' version='1.0'>" + " <redundancy>1</redundancy>" + " <documents>" + " <document mode='index' type='type1'/>" + " </documents>" + " <nodes count='3'/>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester(amendingModelRepo);
tester.addHosts(10);
VespaModel model = tester.createModel(services);
// Check that all hosts are amended
for (HostResource host : model.getAdmin().getHostSystem().getHosts()) {
assertFalse(host + " is amended", host.getHost().getChildrenByTypeRecursive(AmendedService.class).isEmpty());
}
// Check that jdisc clusters are amended
assertEquals(2, model.getContainerClusters().size());
assertNotNull(model.getContainerClusters().get("test1").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
assertNotNull(model.getContainerClusters().get("test2").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
}
Aggregations