Search in sources :

Example 1 with RoutingConfig

use of com.yahoo.cloud.config.RoutingConfig in project vespa by vespa-engine.

the class SuperModelConfigProvider method getConfig.

public ConfigPayload getConfig(ConfigKey<?> configKey) {
    // TODO: Override not applied, but not really necessary here
    if (configKey.equals(new ConfigKey<>(LbServicesConfig.class, configKey.getConfigId()))) {
        LbServicesConfig.Builder builder = new LbServicesConfig.Builder();
        getConfig(builder);
        return ConfigPayload.fromInstance(new LbServicesConfig(builder));
    } else if (configKey.equals(new ConfigKey<>(RoutingConfig.class, configKey.getConfigId()))) {
        RoutingConfig.Builder builder = new RoutingConfig.Builder();
        getConfig(builder);
        return ConfigPayload.fromInstance(new RoutingConfig(builder));
    } else {
        throw new ConfigurationRuntimeException(configKey + " is not valid when asking for config from SuperModel");
    }
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) ConfigurationRuntimeException(com.yahoo.config.ConfigurationRuntimeException) LbServicesConfig(com.yahoo.cloud.config.LbServicesConfig) RoutingConfig(com.yahoo.cloud.config.RoutingConfig)

Example 2 with RoutingConfig

use of com.yahoo.cloud.config.RoutingConfig in project vespa by vespa-engine.

the class RoutingProducerTest method testNodesFromRoutingAppOnly.

@Test
public void testNodesFromRoutingAppOnly() throws Exception {
    Map<TenantName, Map<ApplicationId, ApplicationInfo>> testModel = createTestModel(new DeployState.Builder());
    RoutingProducer producer = new RoutingProducer(testModel);
    RoutingConfig.Builder builder = new RoutingConfig.Builder();
    producer.getConfig(builder);
    RoutingConfig config = new RoutingConfig(builder);
    assertThat(config.hosts().size(), is(2));
    assertThat(config.hosts(0), is("hosted-vespa.routing.yahoo.com"));
    assertThat(config.hosts(1), is("hosted-vespa.routing2.yahoo.com"));
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) TenantName(com.yahoo.config.provision.TenantName) RoutingConfig(com.yahoo.cloud.config.RoutingConfig) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

RoutingConfig (com.yahoo.cloud.config.RoutingConfig)2 LbServicesConfig (com.yahoo.cloud.config.LbServicesConfig)1 ConfigurationRuntimeException (com.yahoo.config.ConfigurationRuntimeException)1 DeployState (com.yahoo.config.model.deploy.DeployState)1 TenantName (com.yahoo.config.provision.TenantName)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Test (org.junit.Test)1