Search in sources :

Example 6 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class SummaryTestCase method reference_fields_can_be_part_of_summary_classes.

@Test
public void reference_fields_can_be_part_of_summary_classes() throws ParseException {
    Search adSearch = buildCampaignAdModel();
    SummaryClass defaultClass = new SummaryClass(adSearch, adSearch.getSummary("default"), new BaseDeployLogger());
    assertEquals(SummaryClassField.Type.LONGSTRING, defaultClass.getField("campaign_ref").getType());
    assertEquals(SummaryClassField.Type.LONGSTRING, defaultClass.getField("other_campaign_ref").getType());
    SummaryClass myClass = new SummaryClass(adSearch, adSearch.getSummary("my_summary"), new BaseDeployLogger());
    assertNull(myClass.getField("campaign_ref"));
    assertEquals(SummaryClassField.Type.LONGSTRING, myClass.getField("other_campaign_ref").getType());
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Example 7 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class IntegerIndex2AttributeTestCase method testIntegerIndex2Attribute.

@Test
public void testIntegerIndex2Attribute() throws IOException, ParseException {
    Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/integerindex2attribute.sd");
    search.process();
    new IntegerIndex2Attribute(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true);
    SDField f;
    f = search.getConcreteField("s1");
    assertTrue(f.getAttributes().isEmpty());
    assertTrue(f.existsIndex("s1"));
    f = search.getConcreteField("s2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(f.existsIndex("s2"));
    f = search.getConcreteField("as1");
    assertTrue(f.getAttributes().isEmpty());
    assertTrue(f.existsIndex("as1"));
    f = search.getConcreteField("as2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(f.existsIndex("as2"));
    f = search.getConcreteField("i1");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(!f.existsIndex("i1"));
    f = search.getConcreteField("i2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(!f.existsIndex("i2"));
    f = search.getConcreteField("ai1");
    assertEquals(search.getConcreteField("ai1").getAttributes().size(), 1);
    assertTrue(!search.getConcreteField("ai1").existsIndex("ai1"));
    f = search.getConcreteField("ai2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(!f.existsIndex("ai2"));
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) Test(org.junit.Test)

Example 8 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class ComponentValidatorTest method basicComponentValidation.

@Test
public void basicComponentValidation() throws Exception {
    // Valid jar file
    JarFile ok = new JarFile(new File(JARS_DIR + "ok.jar"));
    ComponentValidator componentValidator = new ComponentValidator(ok);
    componentValidator.validateAll(new BaseDeployLogger());
    // No manifest
    validateWithException("nomanifest.jar", "Non-existing or invalid manifest in " + JARS_DIR + "nomanifest.jar");
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) JarFile(java.util.jar.JarFile) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 9 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class UserConfigBuilderTest method require_that_arrays_config_is_resolved.

@Test
public void require_that_arrays_config_is_resolved() throws ParserConfigurationException, IOException, SAXException {
    Element configRoot = getDocument("<config name=\"arraytypes\">" + "    <intarr operation=\"append\">13</intarr>" + "    <intarr operation=\"append\">10</intarr>" + "    <intarr operation=\"append\">1337</intarr>" + "</config>");
    UserConfigRepo map = UserConfigBuilder.build(configRoot, configDefinitionStore, new BaseDeployLogger());
    assertFalse(map.isEmpty());
    ConfigDefinitionKey key = new ConfigDefinitionKey("arraytypes", "config");
    assertNotNull(map.get(key));
    ArraytypesConfig config = createConfig(ArraytypesConfig.class, map.get(key));
    assertThat(config.intarr().size(), is(3));
    assertThat(config.intarr(0), is(13));
    assertThat(config.intarr(1), is(10));
    assertThat(config.intarr(2), is(1337));
}
Also used : UserConfigRepo(com.yahoo.config.model.producer.UserConfigRepo) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Element(org.w3c.dom.Element) ConfigDefinitionKey(com.yahoo.vespa.config.ConfigDefinitionKey) ArraytypesConfig(com.yahoo.test.ArraytypesConfig) Test(org.junit.Test)

Example 10 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class UserConfigBuilderTest method require_that_simple_config_is_resolved.

@Test
public void require_that_simple_config_is_resolved() throws ParserConfigurationException, IOException, SAXException {
    Element configRoot = getDocument("<config name=\"simpletypes\">" + "    <intval>13</intval>" + "</config>" + "<config name=\"simpletypes\" version=\"1\">" + "    <stringval>foolio</stringval>" + "</config>");
    UserConfigRepo map = UserConfigBuilder.build(configRoot, configDefinitionStore, new BaseDeployLogger());
    assertFalse(map.isEmpty());
    ConfigDefinitionKey key = new ConfigDefinitionKey("simpletypes", "config");
    assertNotNull(map.get(key));
    SimpletypesConfig config = createConfig(SimpletypesConfig.class, map.get(key));
    assertThat(config.intval(), is(13));
    assertThat(config.stringval(), is("foolio"));
}
Also used : UserConfigRepo(com.yahoo.config.model.producer.UserConfigRepo) SimpletypesConfig(com.yahoo.test.SimpletypesConfig) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Element(org.w3c.dom.Element) ConfigDefinitionKey(com.yahoo.vespa.config.ConfigDefinitionKey) Test(org.junit.Test)

Aggregations

BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)39 Test (org.junit.Test)30 Search (com.yahoo.searchdefinition.Search)12 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)12 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)10 FileNode (com.yahoo.config.FileNode)8 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)7 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)6 SDField (com.yahoo.searchdefinition.document.SDField)6 UserConfigRepo (com.yahoo.config.model.producer.UserConfigRepo)4 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)4 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)3 File (java.io.File)3 Iterator (java.util.Iterator)3 Element (org.w3c.dom.Element)3 Version (com.yahoo.component.Version)2 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)2 DeployLogger (com.yahoo.config.application.api.DeployLogger)2 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)2 RankProfile (com.yahoo.searchdefinition.RankProfile)2