use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.
the class AttributePropertiesTestCase method testValidAttributeProperties.
@Test
public void testValidAttributeProperties() throws IOException, ParseException {
Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/attributeproperties2.sd");
new AttributeProperties(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true);
}
use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.
the class SearchImporterTestCase method testSimpleImporting.
@Test
public void testSimpleImporting() throws IOException, ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
SearchBuilder sb = new UnprocessingSearchBuilder(rankProfileRegistry, new QueryProfileRegistry());
sb.importFile("src/test/examples/simple.sd");
sb.build();
Search search = sb.getSearch();
assertEquals("simple", search.getName());
assertTrue(search.hasDocument());
SDDocumentType document = search.getDocument();
assertEquals("simple", document.getName());
assertEquals(12, document.getFieldCount());
SDField field;
Attribute attribute;
new MakeAliases(search, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles()).process(true);
// First field
field = (SDField) document.getField("title");
assertEquals(DataType.STRING, field.getDataType());
assertEquals("{ summary | index; }", field.getIndexingScript().toString());
assertTrue(!search.getIndex("default").isPrefix());
assertTrue(search.getIndex("title").isPrefix());
Iterator<String> titleAliases = search.getIndex("title").aliasIterator();
assertEquals("aliaz", titleAliases.next());
assertEquals("analias.totitle", titleAliases.next());
assertEquals("analias.todefault", search.getIndex("default").aliasIterator().next());
assertEquals(RankType.IDENTITY, field.getRankType());
assertTrue(field.getAttributes().size() == 0);
assertNull(field.getStemming());
assertTrue(field.getNormalizing().doRemoveAccents());
assertTrue(field.isHeader());
// Second field
field = (SDField) document.getField("description");
assertEquals(RankType.ABOUT, field.getRankType());
assertEquals(SummaryTransform.NONE, field.getSummaryField("description").getTransform());
assertEquals(SummaryTransform.DYNAMICTEASER, field.getSummaryField("dyndesc").getTransform());
assertNull(field.getStemming());
assertTrue(field.getNormalizing().doRemoveAccents());
assertEquals("hallo", search.getIndex("description").aliasIterator().next());
// Third field
field = (SDField) document.getField("chatter");
assertEquals(RankType.ABOUT, field.getRankType());
assertNull(field.getStemming());
assertTrue(field.getNormalizing().doRemoveAccents());
// Fourth field
field = (SDField) document.getField("category");
assertEquals(0, field.getAttributes().size());
assertEquals(Stemming.NONE, field.getStemming());
assertTrue(!field.getNormalizing().doRemoveAccents());
// Fifth field
field = (SDField) document.getField("popularity");
assertEquals("{ attribute; }", field.getIndexingScript().toString());
// Sixth field
field = (SDField) document.getField("measurement");
assertEquals(DataType.INT, field.getDataType());
assertEquals(RankType.EMPTY, field.getRankType());
assertEquals(1, field.getAttributes().size());
// Seventh field
field = search.getConcreteField("categories");
assertEquals("{ input categories_src | lowercase | normalize | index; }", field.getIndexingScript().toString());
assertTrue(!field.isHeader());
// Eight field
field = search.getConcreteField("categoriesagain");
assertEquals("{ input categoriesagain_src | lowercase | normalize | index; }", field.getIndexingScript().toString());
assertTrue(field.isHeader());
// Ninth field
field = search.getConcreteField("exactemento");
assertEquals("{ input exactemento_src | lowercase | index | summary; }", field.getIndexingScript().toString());
// Tenth field
field = search.getConcreteField("category_arr");
assertEquals(1, field.getAttributes().size());
attribute = field.getAttributes().get("category_arr");
assertNotNull(attribute);
assertEquals("category_arr", attribute.getName());
assertEquals(Attribute.Type.STRING, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
assertTrue(field.isHeader());
// Eleventh field
field = search.getConcreteField("measurement_arr");
assertEquals(1, field.getAttributes().size());
attribute = field.getAttributes().get("measurement_arr");
assertEquals("measurement_arr", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
// Rank Profiles
RankProfile profile = rankProfileRegistry.getRankProfile(search, "default");
assertNotNull(profile);
assertNull(profile.getInheritedName());
assertEquals(null, profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE));
assertEquals(RankType.EMPTY, profile.getRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue());
profile = rankProfileRegistry.getRankProfile(search, "experimental");
assertNotNull(profile);
assertEquals("default", profile.getInheritedName());
assertEquals(RankType.IDENTITY, profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue());
profile = rankProfileRegistry.getRankProfile(search, "other");
assertNotNull(profile);
assertEquals("experimental", profile.getInheritedName());
// The extra-document field
SDField exact = search.getConcreteField("exact");
assertNotNull("Extra field was parsed", exact);
assertEquals("exact", exact.getName());
assertEquals(Stemming.NONE, exact.getStemming());
assertTrue(!exact.getNormalizing().doRemoveAccents());
assertEquals("{ input title . \" \" . input category | summary | index; }", exact.getIndexingScript().toString());
assertEquals(RankType.IDENTITY, exact.getRankType());
}
use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.
the class FileSenderTest method require_that_arrays_are_modified.
@Test
public void require_that_arrays_are_modified() {
def.arrayDef("fileArray").setTypeSpec(new ConfigDefinition.TypeSpec("fileArray", "file", null, null, null, null));
def.arrayDef("pathArray").setTypeSpec(new ConfigDefinition.TypeSpec("pathArray", "path", null, null, null, null));
def.arrayDef("stringArray").setTypeSpec(new ConfigDefinition.TypeSpec("stringArray", "string", null, null, null, null));
builder.getArray("fileArray").append("foo.txt");
builder.getArray("fileArray").append("bar.txt");
builder.getArray("pathArray").append("path.txt");
builder.getArray("stringArray").append("foo.txt");
service.pathToRef.put("foo.txt", new FileNode("foohash").value());
service.pathToRef.put("bar.txt", new FileNode("barhash").value());
service.pathToRef.put("path.txt", new FileNode("pathhash").value());
FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
assertThat(builder.getArray("fileArray").get(0).getValue(), is("foohash"));
assertThat(builder.getArray("fileArray").get(1).getValue(), is("barhash"));
assertThat(builder.getArray("pathArray").get(0).getValue(), is("pathhash"));
assertThat(builder.getArray("stringArray").get(0).getValue(), is("foo.txt"));
}
use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.
the class FileSenderTest method require_that_simple_path_fields_are_modified.
@Test
public void require_that_simple_path_fields_are_modified() {
def.addPathDef("fileVal");
def.addStringDef("stringVal");
builder.setField("fileVal", "foo.txt");
builder.setField("stringVal", "foo.txt");
service.pathToRef.put("foo.txt", new FileNode("fooshash").value());
FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
assertThat(builder.getObject("fileVal").getValue(), is("fooshash"));
assertThat(builder.getObject("stringVal").getValue(), is("foo.txt"));
}
use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.
the class FileSenderTest method require_that_fields_in_inner_arrays_are_modified.
@Test
public void require_that_fields_in_inner_arrays_are_modified() {
def.innerArrayDef("inner").addFileDef("fileVal");
def.innerArrayDef("inner").addStringDef("stringVal");
ConfigPayloadBuilder inner = builder.getArray("inner").append();
inner.setField("fileVal", "bar.txt");
inner.setField("stringVal", "bar.txt");
service.pathToRef.put("bar.txt", new FileNode("barhash").value());
FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
assertThat(builder.getArray("inner").get(0).getObject("fileVal").getValue(), is("barhash"));
assertThat(builder.getArray("inner").get(0).getObject("stringVal").getValue(), is("bar.txt"));
}
Aggregations