Search in sources :

Example 1 with LogdConfig

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));
}
Also used : LogdConfig(com.yahoo.cloud.config.log.LogdConfig) Test(org.junit.Test)

Example 2 with LogdConfig

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"));
}
Also used : LogdConfig(com.yahoo.cloud.config.log.LogdConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 3 with LogdConfig

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"));
}
Also used : SlobroksConfig(com.yahoo.cloud.config.SlobroksConfig) LogdConfig(com.yahoo.cloud.config.log.LogdConfig) ApplicationConfigProducerRoot(com.yahoo.config.model.ApplicationConfigProducerRoot) SentinelConfig(com.yahoo.cloud.config.SentinelConfig) VespaModel(com.yahoo.vespa.model.VespaModel) Slobrok(com.yahoo.cloud.config.SlobroksConfig.Slobrok) Test(org.junit.Test)

Example 4 with LogdConfig

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());
}
Also used : SlobroksConfig(com.yahoo.cloud.config.SlobroksConfig) ApplicationIdConfig(com.yahoo.cloud.config.ApplicationIdConfig) LogdConfig(com.yahoo.cloud.config.log.LogdConfig) VespaModel(com.yahoo.vespa.model.VespaModel) ZookeepersConfig(com.yahoo.cloud.config.ZookeepersConfig) Test(org.junit.Test)

Example 5 with LogdConfig

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());
}
Also used : LogdConfig(com.yahoo.cloud.config.log.LogdConfig) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Aggregations

LogdConfig (com.yahoo.cloud.config.log.LogdConfig)8 Test (org.junit.Test)8 VespaModel (com.yahoo.vespa.model.VespaModel)5 SlobroksConfig (com.yahoo.cloud.config.SlobroksConfig)2 ApplicationIdConfig (com.yahoo.cloud.config.ApplicationIdConfig)1 SentinelConfig (com.yahoo.cloud.config.SentinelConfig)1 Slobrok (com.yahoo.cloud.config.SlobroksConfig.Slobrok)1 ZookeepersConfig (com.yahoo.cloud.config.ZookeepersConfig)1 ApplicationConfigProducerRoot (com.yahoo.config.model.ApplicationConfigProducerRoot)1 HostInfo (com.yahoo.config.model.api.HostInfo)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 Admin (com.yahoo.vespa.model.admin.Admin)1 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)1