Search in sources :

Example 1 with VespaModelCreatorWithFilePkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg in project vespa by vespa-engine.

the class QrserverAndGatewayPortAllocationTest method testPorts.

@Test
public void testPorts() throws IOException, SAXException {
    String appDir = "src/test/cfg/application/app_qrserverandgw/";
    VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg(appDir);
    VespaModel vespaModel = creator.create();
    List<Container> qrservers = vespaModel.getContainerClusters().get("container").getContainers();
    assertThat(qrservers.size(), is(1));
    assertThat(qrservers.get(0).getSearchPort(), is(Container.BASEPORT));
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Container(com.yahoo.vespa.model.container.Container) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 2 with VespaModelCreatorWithFilePkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg 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 3 with VespaModelCreatorWithFilePkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg in project vespa by vespa-engine.

the class NoPrefixForIndexesTest method requireThatPrefixIsIllegalForMixedAttributeAndIndexField.

@Test
public void requireThatPrefixIsIllegalForMixedAttributeAndIndexField() {
    try {
        new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/prefix_index_and_attribute/").create();
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("For search 'simple', field 'artist': match/index:prefix is not supported for indexes.", e.getMessage());
    }
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Test(org.junit.Test)

Example 4 with VespaModelCreatorWithFilePkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg in project vespa by vespa-engine.

the class NoPrefixForIndexesTest method requireThatPrefixIsIllegalForIndexField.

@Test
public void requireThatPrefixIsIllegalForIndexField() {
    try {
        new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/prefix_index/").create();
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("For search 'simple', field 'artist': match/index:prefix is not supported for indexes.", e.getMessage());
    }
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Test(org.junit.Test)

Example 5 with VespaModelCreatorWithFilePkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg in project vespa by vespa-engine.

the class ContainerIncludeTest method included_file_with_xml_schema_violation.

@Test
public void included_file_with_xml_schema_violation() throws Exception {
    try {
        VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg("src/test/cfg/container/data/include_xml_error/");
        creator.create(true);
        fail("Expected exception due to xml schema violation ('zearcer')");
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage(), containsString("XML error"));
        assertThat(e.getMessage(), containsString("zearcer"));
    }
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Test(org.junit.Test)

Aggregations

VespaModelCreatorWithFilePkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg)18 Test (org.junit.Test)16 VespaModel (com.yahoo.vespa.model.VespaModel)5 HashMap (java.util.HashMap)2 ModelConfig (com.yahoo.cloud.config.ModelConfig)1 ComponentId (com.yahoo.component.ComponentId)1 ConfigModelRegistry (com.yahoo.config.model.ConfigModelRegistry)1 MapConfigModelRegistry (com.yahoo.config.model.MapConfigModelRegistry)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 DocumentrouteselectorpolicyConfig (com.yahoo.documentapi.messagebus.protocol.DocumentrouteselectorpolicyConfig)1 MessagebusConfig (com.yahoo.messagebus.MessagebusConfig)1 Container (com.yahoo.vespa.model.container.Container)1 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)1 Component (com.yahoo.vespa.model.container.component.Component)1 DocprocChain (com.yahoo.vespa.model.container.docproc.DocprocChain)1 ProcessingChain (com.yahoo.vespa.model.container.processing.ProcessingChain)1 SearchChain (com.yahoo.vespa.model.container.search.searchchain.SearchChain)1 ApiConfigModel (com.yahoo.vespa.model.test.ApiConfigModel)1 SimpleConfigModel (com.yahoo.vespa.model.test.SimpleConfigModel)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1