use of com.yahoo.vespa.config.ConfigDefinitionKey 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.config.ConfigDefinitionKey in project vespa by vespa-engine.
the class UserConfigBuilderTest method no_exception_when_config_class_does_not_exist.
@Test
public void no_exception_when_config_class_does_not_exist() throws ParserConfigurationException, IOException, SAXException {
Element configRoot = getDocument("<config name=\"unknown\">" + " <foo>1</foo>" + "</config>");
UserConfigRepo repo = UserConfigBuilder.build(configRoot, configDefinitionStore, new BaseDeployLogger());
ConfigPayloadBuilder builder = repo.get(new ConfigDefinitionKey("unknown", "config"));
assertNotNull(builder);
}
use of com.yahoo.vespa.config.ConfigDefinitionKey in project vespa by vespa-engine.
the class SuperModelController method getConfigDefinition.
private InnerCNode getConfigDefinition(ConfigKey<?> configKey, DefContent defContent) {
if (defContent.isEmpty()) {
ConfigDefinitionKey configDefinitionKey = new ConfigDefinitionKey(configKey.getName(), configKey.getNamespace());
ConfigDefinition configDefinition = configDefinitionRepo.getConfigDefinitions().get(configDefinitionKey);
if (configDefinition == null) {
throw new UnknownConfigDefinitionException("Unable to find config definition for '" + configKey.getNamespace() + "." + configKey.getName());
}
return configDefinition.getCNode();
} else {
DefParser dParser = new DefParser(configKey.getName(), new StringReader(defContent.asString()));
return dParser.getTree();
}
}
use of com.yahoo.vespa.config.ConfigDefinitionKey in project vespa by vespa-engine.
the class Application method getTargetDef.
private ConfigDefinition getTargetDef(GetConfigRequest req) {
ConfigKey<?> configKey = req.getConfigKey();
DefContent def = req.getDefContent();
ConfigDefinitionKey configDefinitionKey = new ConfigDefinitionKey(configKey.getName(), configKey.getNamespace());
if (def.isEmpty()) {
if (logDebug()) {
debug("No config schema in request for " + configKey);
}
return cache.getDef(configDefinitionKey);
} else {
if (logDebug()) {
debug("Got config schema from request, length:" + def.asList().size() + " : " + configKey);
}
return new ConfigDefinition(configKey.getName(), def.asStringArray());
}
}
use of com.yahoo.vespa.config.ConfigDefinitionKey in project vespa by vespa-engine.
the class ConfigUtilsTest method testCreateConfigDefinitionKeyFromZKString.
@Test
public void testCreateConfigDefinitionKeyFromZKString() {
String input = "bar.foo,1";
ConfigDefinitionKey def = ConfigUtils.createConfigDefinitionKeyFromZKString(input);
assertThat(def.getName(), is("foo"));
assertThat(def.getNamespace(), is("bar"));
}
Aggregations