use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class TenantRequestHandlerTest method testListConfigs.
@Test
public void testListConfigs() throws IOException, SAXException {
assertdefaultAppNotFound();
/*assertTrue(server.allConfigIds(ApplicationId.defaultId()).isEmpty());
assertTrue(server.allConfigsProduced(ApplicationId.defaultId()).isEmpty());
assertTrue(server.listConfigs(ApplicationId.defaultId(), false).isEmpty());
assertTrue(server.listConfigs(ApplicationId.defaultId(), true).isEmpty());*/
VespaModel model = new VespaModel(FilesApplicationPackage.fromFile(new File("src/test/apps/app")));
server.reloadConfig(ApplicationSet.fromSingle(new Application(model, new ServerCache(), 1, vespaVersion, MetricUpdater.createTestUpdater(), ApplicationId.defaultId())));
Set<ConfigKey<?>> configNames = server.listConfigs(ApplicationId.defaultId(), Optional.of(vespaVersion), false);
assertTrue(configNames.contains(new ConfigKey<>("sentinel", "hosts", "cloud.config")));
// for (ConfigKey<?> ck : configNames) {
// assertTrue(!"".equals(ck.getConfigId()));
// }
configNames = server.listConfigs(ApplicationId.defaultId(), Optional.of(vespaVersion), true);
System.out.println(configNames);
assertTrue(configNames.contains(new ConfigKey<>("feeder", "jdisc", "vespaclient.config")));
assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "jdisc", "document.config")));
assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "", "document.config")));
assertTrue(configNames.contains(new ConfigKey<>("documenttypes", "", "document")));
assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "jdisc", "document.config")));
assertTrue(configNames.contains(new ConfigKey<>("health-monitor", "jdisc", "container.jdisc.config")));
assertTrue(configNames.contains(new ConfigKey<>("specific", "jdisc", "project")));
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class ConfiguredApplication method watchPortChange.
private void watchPortChange() {
Subscriber subscriber = subscriberFactory.getSubscriber(Collections.singleton(new ConfigKey<>(QrConfig.class, configId)));
try {
while (true) {
subscriber.waitNextGeneration();
QrConfig newConfig = QrConfig.class.cast(first(subscriber.config().values()));
if (qrConfig.rpc().port() != newConfig.rpc().port()) {
com.yahoo.protect.Process.logAndDie("Rpc port config has changed from " + qrConfig.rpc().port() + " to " + newConfig.rpc().port() + ". This we can not handle without a restart so we will just bail out.");
}
log.fine("Received new QrConfig :" + newConfig);
}
} finally {
subscriber.close();
}
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class FileConfigSubscriptionTest method require_that_dir_config_id_reference_is_not_changed.
@Test
public void require_that_dir_config_id_reference_is_not_changed() {
final String cfgDir = "src/test/resources/configs/foo";
final String cfgId = "dir:" + cfgDir;
final ConfigKey<TestReferenceConfig> key = new ConfigKey<>(TestReferenceConfig.class, cfgId);
ConfigSubscriber subscriber = new ConfigSubscriber();
ConfigSubscription<TestReferenceConfig> sub = ConfigSubscription.get(key, subscriber, new DirSource(new File(cfgDir)), new TimingValues());
assertTrue(sub.nextConfig(1000));
assertThat(sub.getConfigState().getConfig().configId(), is(cfgId));
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class ComponentClassTestCase method testCreateComponent.
@SuppressWarnings("unchecked")
@Test
public void testCreateComponent() throws NoSuchMethodException {
Map<ConfigKey, ConfigInstance> availableConfigs = new HashMap<>();
String configId = "testConfigId";
availableConfigs.put(new ConfigKey(StringConfig.class, configId), new StringConfig(new StringConfig.Builder()));
availableConfigs.put(new ConfigKey(IntConfig.class, configId), new IntConfig(new IntConfig.Builder()));
ComponentClass<TestComponent> testClass = new ComponentClass<>(TestComponent.class);
TestComponent component = testClass.createComponent(new ComponentId("test", new Version(1)), availableConfigs, configId);
assertEquals("test", component.getId().getName());
assertEquals(1, component.getId().getVersion().getMajor());
assertEquals(1, component.intVal);
assertEquals("_default_", component.stringVal);
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class ComponentClassTestCase method testNullIdComponent.
/**
* Verifies that ComponentClass sets the ComponentId when a component that takes a ComponentId as
* constructor argument fails to call super(id).
*/
@Test
public void testNullIdComponent() throws NoSuchMethodException {
ComponentClass<NullIdComponent> testClass = new ComponentClass<>(NullIdComponent.class);
NullIdComponent component = testClass.createComponent(new ComponentId("null-test", new Version(1)), new HashMap<ConfigKey, ConfigInstance>(), null);
assertEquals("null-test", component.getId().getName());
assertEquals(1, component.getId().getVersion().getMajor());
}
Aggregations