Search in sources :

Example 6 with UserConfigRepo

use of com.yahoo.config.model.producer.UserConfigRepo 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);
}
Also used : UserConfigRepo(com.yahoo.config.model.producer.UserConfigRepo) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Element(org.w3c.dom.Element) ConfigDefinitionKey(com.yahoo.vespa.config.ConfigDefinitionKey) ConfigPayloadBuilder(com.yahoo.vespa.config.ConfigPayloadBuilder) Test(org.junit.Test)

Example 7 with UserConfigRepo

use of com.yahoo.config.model.producer.UserConfigRepo in project vespa by vespa-engine.

the class FileSenderTest method setup.

@Before
public void setup() {
    MockRoot root = new MockRoot();
    producer = new SimpleConfigProducer<>(root, "test");
    service = new TestService(root, "service");
    serviceList = new ArrayList<>();
    serviceList.add(service);
    ConfigDefinitionKey key = new ConfigDefinitionKey("myname", "mynamespace");
    def = new ConfigDefinition("myname", "1", "mynamespace");
    builder = new ConfigPayloadBuilder(def);
    Map<ConfigDefinitionKey, ConfigPayloadBuilder> builderMap = new HashMap<>();
    builderMap.put(key, builder);
    UserConfigRepo testRepo = new UserConfigRepo(builderMap);
    producer.setUserConfigs(testRepo);
}
Also used : UserConfigRepo(com.yahoo.config.model.producer.UserConfigRepo) MockRoot(com.yahoo.config.model.test.MockRoot) HashMap(java.util.HashMap) Before(org.junit.Before)

Example 8 with UserConfigRepo

use of com.yahoo.config.model.producer.UserConfigRepo in project vespa by vespa-engine.

the class UserConfigBuilder method build.

public static UserConfigRepo build(Element producerSpec, ConfigDefinitionStore configDefinitionStore, DeployLogger deployLogger) {
    final Map<ConfigDefinitionKey, ConfigPayloadBuilder> builderMap = new LinkedHashMap<>();
    if (producerSpec == null) {
        log.log(LogLevel.SPAM, "In getUserConfigs. producerSpec is null");
    }
    log.log(LogLevel.DEBUG, "getUserConfigs for " + producerSpec);
    for (Element configE : XML.getChildren(producerSpec, "config")) {
        buildElement(configE, builderMap, configDefinitionStore, deployLogger);
    }
    return new UserConfigRepo(builderMap);
}
Also used : UserConfigRepo(com.yahoo.config.model.producer.UserConfigRepo) Element(org.w3c.dom.Element) DomConfigPayloadBuilder(com.yahoo.vespa.model.builder.xml.dom.DomConfigPayloadBuilder)

Aggregations

UserConfigRepo (com.yahoo.config.model.producer.UserConfigRepo)8 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)5 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)4 Element (org.w3c.dom.Element)4 Test (org.junit.Test)3 FileReference (com.yahoo.config.FileReference)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 ArraytypesConfig (com.yahoo.test.ArraytypesConfig)1 SimpletypesConfig (com.yahoo.test.SimpletypesConfig)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1 ConfigPayloadBuilder (com.yahoo.vespa.config.ConfigPayloadBuilder)1 SpecialtokensConfig (com.yahoo.vespa.configdefinition.SpecialtokensConfig)1 DomConfigPayloadBuilder (com.yahoo.vespa.model.builder.xml.dom.DomConfigPayloadBuilder)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1