use of com.yahoo.vespa.configdefinition.SpecialtokensConfig in project vespa by vespa-engine.
the class UserConfigBuilderTest method assertArraysOfStructs.
private void assertArraysOfStructs(Element configRoot) {
UserConfigRepo map = UserConfigBuilder.build(configRoot, configDefinitionStore, new BaseDeployLogger());
assertFalse(map.isEmpty());
ConfigDefinitionKey key = new ConfigDefinitionKey(SpecialtokensConfig.CONFIG_DEF_NAME, SpecialtokensConfig.CONFIG_DEF_NAMESPACE);
assertNotNull(map.get(key));
SpecialtokensConfig config = createConfig(SpecialtokensConfig.class, map.get(key));
assertThat(config.tokenlist().size(), is(1));
assertThat(config.tokenlist().get(0).name(), is("default"));
assertThat(config.tokenlist().get(0).tokens().size(), is(1));
assertThat(config.tokenlist().get(0).tokens().get(0).token(), is("dvd+-r"));
}
use of com.yahoo.vespa.configdefinition.SpecialtokensConfig in project vespa by vespa-engine.
the class RewriterFeaturesTestCase method testConvertStringToQTree.
@Test
public final void testConvertStringToQTree() {
Execution placeholder = new Execution(Context.createContextStub());
SpecialTokenRegistry tokenRegistry = new SpecialTokenRegistry(new SpecialtokensConfig(new SpecialtokensConfig.Builder().tokenlist(new Tokenlist.Builder().name("default").tokens(new Tokens.Builder().token(ASCII_ELLIPSIS)))));
placeholder.context().setTokenRegistry(tokenRegistry);
Query query = new Query();
query.getModel().setExecution(placeholder);
Item parsed = RewriterFeatures.convertStringToQTree(query, "a b c " + ASCII_ELLIPSIS);
assertSame(AndItem.class, parsed.getClass());
assertEquals(4, ((CompositeItem) parsed).getItemCount());
assertEquals(ASCII_ELLIPSIS, ((CompositeItem) parsed).getItem(3).toString());
}
Aggregations