Search in sources :

Example 16 with VespaModelCreatorWithFilePkg

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

the class RankingConstantsValidatorTest method ensure_that_failing_ranking_constants_fails.

@Test
public void ensure_that_failing_ranking_constants_fails() {
    expectedException.expect(TensorValidationFailed.class);
    expectedException.expectMessage("Ranking constant \"constant_tensor_2\" (tensors/constant_tensor_2.json): Tensor coordinate is not a string (VALUE_NUMBER_INT)");
    expectedException.expectMessage("Ranking constant \"constant_tensor_3\" (tensors/constant_tensor_3.json): Tensor dimension \"cd\" does not exist");
    expectedException.expectMessage("Ranking constant \"constant_tensor_4\" (tensors/constant_tensor_4.json): Tensor dimension \"z\" does not exist");
    new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/ranking_constants_fail/").create();
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Test(org.junit.Test)

Example 17 with VespaModelCreatorWithFilePkg

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

the class SearchDataTypeValidatorTestCase method requireThatIndexingMapsInNonStreamingClusterIsIllegal.

@Test
public void requireThatIndexingMapsInNonStreamingClusterIsIllegal() {
    try {
        new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/index_struct/").create();
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("Field type 'Map<string,string>' cannot be indexed for search clusters (field 'baz' in definition " + "'simple' for cluster 'content').", e.getMessage());
    }
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Test(org.junit.Test)

Example 18 with VespaModelCreatorWithFilePkg

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

the class ModelConfigProviderTest method testGetModelConfig.

/**
 * Get the config via ConfigInstance based API, by getting whole config
 */
@Test
public void testGetModelConfig() {
    VespaModel vespaModel = new VespaModelCreatorWithFilePkg("src/test/cfg/admin/adminconfig20").create();
    ModelConfig config = vespaModel.getConfig(ModelConfig.class, "");
    assertEquals(config.hosts().size(), 1);
    // Actually set to hostname.
    ModelConfig.Hosts localhost = config.hosts(0);
    int numLogservers = 0;
    int numSlobroks = 0;
    for (ModelConfig.Hosts.Services service : localhost.services()) {
        if ("logserver".equals(service.type())) {
            numLogservers++;
        }
        if ("slobrok".equals(service.type())) {
            numSlobroks++;
        }
    }
    assertEquals(1, numLogservers);
    assertEquals(2, numSlobroks);
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) ModelConfig(com.yahoo.cloud.config.ModelConfig) VespaModel(com.yahoo.vespa.model.VespaModel) 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