Search in sources :

Example 21 with BaseDeployLogger

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

the class RankProfileTestCase method requireThatConfigIsDerivedForQueryFeatureTypeSettings.

@Test
public void requireThatConfigIsDerivedForQueryFeatureTypeSettings() throws ParseException {
    RankProfileRegistry registry = new RankProfileRegistry();
    SearchBuilder builder = new SearchBuilder(registry, setupQueryProfileTypes());
    builder.importString("search test {\n" + "  document test { } \n" + "  rank-profile p1 {}\n" + "  rank-profile p2 {}\n" + "}");
    builder.build(true, new BaseDeployLogger());
    Search search = builder.getSearch();
    assertEquals(4, registry.allRankProfiles().size());
    assertQueryFeatureTypeSettings(registry.getRankProfile(search, "default"), search);
    assertQueryFeatureTypeSettings(registry.getRankProfile(search, "unranked"), search);
    assertQueryFeatureTypeSettings(registry.getRankProfile(search, "p1"), search);
    assertQueryFeatureTypeSettings(registry.getRankProfile(search, "p2"), search);
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Test(org.junit.Test)

Example 22 with BaseDeployLogger

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

the class SDDocumentTypeOrdererTestCase method testOrder.

@Test
public void testOrder() {
    List<SDDocumentType> types = new ArrayList<>();
    SDDocumentType a = new SDDocumentType("a");
    SDDocumentType b = new SDDocumentType("b");
    SDDocumentType c = new SDDocumentType("c");
    SDDocumentType d = new SDDocumentType("d");
    SDDocumentType e = new SDDocumentType("e");
    SDDocumentType f = new SDDocumentType("f");
    SDDocumentType g = new SDDocumentType("g");
    b.inherit(new TemporarySDDocumentType(new DataTypeName("a")));
    c.inherit(new TemporarySDDocumentType(new DataTypeName("b")));
    d.inherit(new TemporarySDDocumentType(new DataTypeName("e")));
    g.inherit(new TemporarySDDocumentType(new DataTypeName("e")));
    g.inherit(new TemporarySDDocumentType(new DataTypeName("c")));
    SDField aFieldTypeB = new TemporarySDField("atypeb", DataType.STRING);
    a.addField(aFieldTypeB);
    SDField bFieldTypeC = new TemporarySDField("btypec", DataType.STRING);
    b.addField(bFieldTypeC);
    SDField cFieldTypeG = new TemporarySDField("ctypeg", DataType.STRING);
    c.addField(cFieldTypeG);
    SDField gFieldTypeF = new TemporarySDField("gtypef", DataType.STRING);
    g.addField(gFieldTypeF);
    SDField fFieldTypeC = new TemporarySDField("ftypec", DataType.STRING);
    f.addField(fFieldTypeC);
    SDField dFieldTypeE = new TemporarySDField("dtypee", DataType.STRING);
    d.addField(dFieldTypeE);
    types.add(a);
    types.add(b);
    types.add(c);
    types.add(d);
    types.add(e);
    types.add(f);
    types.add(g);
    SDDocumentTypeOrderer app = new SDDocumentTypeOrderer(types, new BaseDeployLogger());
    app.process();
    assertEquals(7, app.processingOrder.size());
    assertEquals(a, app.processingOrder.get(0));
    assertEquals(b, app.processingOrder.get(1));
    assertEquals(c, app.processingOrder.get(2));
    assertEquals(e, app.processingOrder.get(3));
    assertEquals(d, app.processingOrder.get(4));
    assertEquals(f, app.processingOrder.get(5));
    assertEquals(g, app.processingOrder.get(6));
}
Also used : TemporarySDDocumentType(com.yahoo.searchdefinition.document.TemporarySDDocumentType) TemporarySDField(com.yahoo.searchdefinition.document.TemporarySDField) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) TemporarySDDocumentType(com.yahoo.searchdefinition.document.TemporarySDDocumentType) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) ArrayList(java.util.ArrayList) DataTypeName(com.yahoo.document.DataTypeName) TemporarySDField(com.yahoo.searchdefinition.document.TemporarySDField) Test(org.junit.Test)

Example 23 with BaseDeployLogger

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

the class ComponentValidatorTest method validateWithException.

private void validateWithException(String jarName, String exceptionMessage) throws IOException {
    try {
        JarFile jarFile = new JarFile(JARS_DIR + jarName);
        ComponentValidator componentValidator = new ComponentValidator(jarFile);
        componentValidator.validateAll(new BaseDeployLogger());
        assert (false);
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage(), is(exceptionMessage));
    }
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) JarFile(java.util.jar.JarFile)

Example 24 with BaseDeployLogger

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

the class SummaryFieldsMustHaveValidSourceTestCase method requireThatDocumentIdIsAllowedToPass.

@Test
public void requireThatDocumentIdIsAllowedToPass() throws IOException, ParseException {
    Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/documentidinsummary.sd");
    search.process();
    BaseDeployLogger deployLogger = new BaseDeployLogger();
    RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
    new SummaryFieldsMustHaveValidSource(search, deployLogger, rankProfileRegistry, new QueryProfiles()).process(true);
    assertEquals("documentid", search.getSummary("withid").getSummaryField("w").getSingleSource());
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) Test(org.junit.Test)

Example 25 with BaseDeployLogger

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

the class SummaryTestCase method testDeriving.

@Test
public void testDeriving() throws IOException, ParseException {
    Search search = SearchBuilder.buildFromFile("src/test/examples/simple.sd");
    SummaryClass summary = new SummaryClass(search, search.getSummary("default"), new BaseDeployLogger());
    assertEquals("default", summary.getName());
    Iterator<SummaryClassField> fields = summary.fieldIterator();
    SummaryClassField field;
    assertEquals(13, summary.getFieldCount());
    field = (SummaryClassField) fields.next();
    assertEquals("exactemento", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("exact", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("title", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("description", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("dyndesc", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("longdesc", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("longstat", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("dynlong", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("dyndesc2", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("measurement", field.getName());
    assertEquals(SummaryClassField.Type.INTEGER, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("rankfeatures", field.getName());
    assertEquals(SummaryClassField.Type.FEATUREDATA, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("summaryfeatures", field.getName());
    assertEquals(SummaryClassField.Type.FEATUREDATA, field.getType());
    field = (SummaryClassField) fields.next();
    assertEquals("documentid", field.getName());
    assertEquals(SummaryClassField.Type.LONGSTRING, field.getType());
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) 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