Search in sources :

Example 1 with ConfigModelRegistry

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);
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) MapConfigModelRegistry(com.yahoo.config.model.MapConfigModelRegistry) ConfigModelRegistry(com.yahoo.config.model.ConfigModelRegistry) SimpleConfigModel(com.yahoo.vespa.model.test.SimpleConfigModel) ApiConfigModel(com.yahoo.vespa.model.test.ApiConfigModel)

Example 2 with ConfigModelRegistry

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")));
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ConfigModelRegistry(com.yahoo.config.model.ConfigModelRegistry) MapConfigModelRegistry(com.yahoo.config.model.MapConfigModelRegistry) VespaModel(com.yahoo.vespa.model.VespaModel) ComponentId(com.yahoo.component.ComponentId) Test(org.junit.Test)

Aggregations

ConfigModelRegistry (com.yahoo.config.model.ConfigModelRegistry)2 MapConfigModelRegistry (com.yahoo.config.model.MapConfigModelRegistry)2 ComponentId (com.yahoo.component.ComponentId)1 HostResource (com.yahoo.vespa.model.HostResource)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 ApiConfigModel (com.yahoo.vespa.model.test.ApiConfigModel)1 SimpleConfigModel (com.yahoo.vespa.model.test.SimpleConfigModel)1 VespaModelCreatorWithFilePkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg)1 Test (org.junit.Test)1