use of com.yahoo.cloud.config.log.LogdConfig in project vespa by vespa-engine.
the class AbstractConfigProducerTest method require_that_interface_is_found_if_directly_implemented.
@Test
public void require_that_interface_is_found_if_directly_implemented() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
MockLogdProducer producer = new MockLogdProducer("mocky");
ClassLoader loader = producer.getConfigClassLoader(LogdConfig.Producer.class.getName());
assertNotNull(loader);
Class clazz = loader.loadClass(LogdConfig.Builder.class.getName());
LogdConfig.Builder builder = (LogdConfig.Builder) clazz.newInstance();
producer.getConfig(builder);
LogdConfig config = new LogdConfig(builder);
assertThat(config.logserver().host(), is("bar"));
assertThat(config.logserver().port(), is(1338));
}
use of com.yahoo.cloud.config.log.LogdConfig in project vespa by vespa-engine.
the class DomAdminV2BuilderTest method configOverridesCanBeUsedInAdmin.
@Test
public void configOverridesCanBeUsedInAdmin() {
Admin admin = buildAdmin(servicesOverride());
assertThat(admin.getUserConfigs().size(), is(1));
LogdConfig.Builder logdBuilder = new LogdConfig.Builder();
admin.addUserConfig(logdBuilder);
LogdConfig config = new LogdConfig(logdBuilder);
assertThat(config.logserver().host(), is("foobar"));
}
use of com.yahoo.cloud.config.log.LogdConfig in project vespa by vespa-engine.
the class AdminTestCase method testAdmin20.
/**
* Test that version 2.0 of adminconfig works as expected.
*/
@Test
public void testAdmin20() throws Exception {
VespaModel vespaModel = getVespaModel(TESTDIR + "adminconfig20");
// Verify that the admin plugin has been loaded (always loads routing).
assertThat(vespaModel.configModelRepo().asMap().size(), is(2));
ApplicationConfigProducerRoot root = vespaModel.getVespa();
assertNotNull(root);
// Verify configIds
Set<String> configIds = vespaModel.getConfigIds();
String localhost = HostName.getLocalhost();
String localhostConfigId = "hosts/" + localhost;
assertTrue(configIds.contains(localhostConfigId));
assertTrue(configIds.contains("admin/logserver"));
assertTrue(configIds.contains("admin/configservers/configserver.0"));
assertTrue(configIds.contains("admin/slobrok.0"));
assertTrue(configIds.contains("admin/slobrok.1"));
assertFalse(configIds.contains("admin/slobrok.2"));
assertTrue(configIds.contains("admin"));
// Confirm 2 slobroks in config
SlobroksConfig.Builder sb = new SlobroksConfig.Builder();
vespaModel.getConfig(sb, "admin/slobrok.0");
SlobroksConfig sc = new SlobroksConfig(sb);
assertEquals(sc.slobrok().size(), 2);
boolean localHostOK = false;
for (Slobrok s : sc.slobrok()) {
if (s.connectionspec().matches(".*" + localhost + ".*"))
localHostOK = true;
}
assertTrue(localHostOK);
LogdConfig.Builder lb = new LogdConfig.Builder();
vespaModel.getConfig(lb, "admin/slobrok.0");
LogdConfig lc = new LogdConfig(lb);
assertEquals(lc.logserver().host(), localhost);
// Verify services in the sentinel config
SentinelConfig.Builder b = new SentinelConfig.Builder();
vespaModel.getConfig(b, localhostConfigId);
SentinelConfig sentinelConfig = new SentinelConfig(b);
assertThat(sentinelConfig.service().size(), is(4));
assertThat(sentinelConfig.service(0).name(), is("logserver"));
assertThat(sentinelConfig.service(1).name(), is("slobrok"));
assertThat(sentinelConfig.service(2).name(), is("slobrok2"));
assertThat(sentinelConfig.service(3).name(), is("logd"));
}
use of com.yahoo.cloud.config.log.LogdConfig in project vespa by vespa-engine.
the class VespaModelTestCase method testCommonConfig.
// Verify that common config from plugins is delivered from the root node for any configId, using the Builder based API
@Test
public void testCommonConfig() throws Exception {
VespaModel model = getVespaModel(TESTDIR + "app_nohosts/");
LogdConfig.Builder b = new LogdConfig.Builder();
b = (LogdConfig.Builder) model.getConfig(b, "");
LogdConfig c = new LogdConfig(b);
assertEquals(HostName.getLocalhost(), c.logserver().host());
SlobroksConfig.Builder sb = new SlobroksConfig.Builder();
sb = (com.yahoo.cloud.config.SlobroksConfig.Builder) model.getConfig(sb, "");
SlobroksConfig sbc = new SlobroksConfig(sb);
assertEquals(sbc.slobrok().size(), 1);
ZookeepersConfig.Builder zb = new ZookeepersConfig.Builder();
zb = (ZookeepersConfig.Builder) model.getConfig(zb, "");
ZookeepersConfig zc = new ZookeepersConfig(zb);
assertEquals(zc.zookeeperserverlist().split(",").length, 2);
assertTrue(zc.zookeeperserverlist().startsWith(HostName.getLocalhost()));
ApplicationIdConfig.Builder appIdBuilder = new ApplicationIdConfig.Builder();
appIdBuilder = (ApplicationIdConfig.Builder) model.getConfig(appIdBuilder, "");
ApplicationIdConfig applicationIdConfig = new ApplicationIdConfig(appIdBuilder);
assertEquals(ApplicationId.defaultId().tenant().value(), applicationIdConfig.tenant());
assertEquals(ApplicationId.defaultId().application().value(), applicationIdConfig.application());
assertEquals(ApplicationId.defaultId().instance().value(), applicationIdConfig.instance());
}
use of com.yahoo.cloud.config.log.LogdConfig in project vespa by vespa-engine.
the class VespaModelTestCase method testHostsConfig.
@Test
public void testHostsConfig() {
VespaModel model = getVespaModel(TESTDIR + "app_qrserverandgw");
LogdConfig config = getLogdConfig(model, "");
assertEquals(config.logserver().host(), HostName.getLocalhost());
assertNotNull(config);
config = getLogdConfig(model, "hosts");
assertNotNull(config);
assertEquals(config.logserver().host(), HostName.getLocalhost());
}
Aggregations