use of com.yahoo.config.model.producer.UserConfigRepo in project vespa by vespa-engine.
the class VespaModel method configsProduced.
private static Set<ConfigKey<?>> configsProduced(ConfigProducer cp) {
Set<ConfigKey<?>> ret = ReflectionUtil.configsProducedByInterface(cp.getClass(), cp.getConfigId());
UserConfigRepo userConfigs = cp.getUserConfigs();
for (ConfigDefinitionKey userKey : userConfigs.configsProduced()) {
ret.add(new ConfigKey<>(userKey.getName(), cp.getConfigId(), userKey.getNamespace()));
}
return ret;
}
use of com.yahoo.config.model.producer.UserConfigRepo in project vespa by vespa-engine.
the class FileSender method sendUserConfiguredFiles.
/**
* Sends all user configured files for a producer to all given services.
*/
public static <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger) {
if (services.isEmpty())
return;
UserConfigRepo userConfigs = producer.getUserConfigs();
Map<String, FileReference> sentFiles = new HashMap<>();
for (ConfigDefinitionKey key : userConfigs.configsProduced()) {
ConfigPayloadBuilder builder = userConfigs.get(key);
try {
sendUserConfiguredFiles(builder, sentFiles, services, key, logger);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unable to send files for " + key, e);
}
}
}
use of com.yahoo.config.model.producer.UserConfigRepo 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));
}
use of com.yahoo.config.model.producer.UserConfigRepo 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"));
}
use of com.yahoo.config.model.producer.UserConfigRepo 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"));
}
Aggregations