use of com.yahoo.cloud.config.SlobroksConfig.Slobrok 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"));
}
Aggregations