use of com.yahoo.container.core.ApplicationMetadataConfig in project vespa by vespa-engine.
the class StateHandlerTest method startTestDriver.
@Before
public void startTestDriver() {
Timer timer = this.currentTimeMillis::get;
this.driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() {
@Override
protected void configure() {
bind(Timer.class).toInstance(timer);
}
});
ContainerBuilder builder = driver.newContainerBuilder();
HealthMonitorConfig healthMonitorConfig = new HealthMonitorConfig(new HealthMonitorConfig.Builder().snapshot_interval(TimeUnit.MILLISECONDS.toSeconds(SNAPSHOT_INTERVAL)));
ThreadFactory threadFactory = ignored -> mock(Thread.class);
this.monitor = new StateMonitor(healthMonitorConfig, timer, threadFactory);
builder.guiceModules().install(new AbstractModule() {
@Override
protected void configure() {
bind(StateMonitor.class).toInstance(monitor);
bind(MetricConsumer.class).toProvider(MetricConsumerProviders.wrap(monitor));
bind(ApplicationMetadataConfig.class).toInstance(new ApplicationMetadataConfig(new ApplicationMetadataConfig.Builder().generation(META_GENERATION)));
bind(MetricsPresentationConfig.class).toInstance(new MetricsPresentationConfig(new MetricsPresentationConfig.Builder()));
}
});
builder.serverBindings().bind("http://*/*", builder.getInstance(StateHandler.class));
driver.activateContainer(builder);
metric = builder.getInstance(Metric.class);
}
use of com.yahoo.container.core.ApplicationMetadataConfig in project vespa by vespa-engine.
the class ApplicationStatusHandlerTest method application_configs_are_rendered.
@Test
public void application_configs_are_rendered() throws Exception {
ApplicationMetadataConfig metaConfig = new ApplicationMetadataConfig(new ApplicationMetadataConfig.Builder().checksum("abc").name("app").path("/a/b/c").timestamp(3000).user("donald"));
ApplicationUserdataConfig userConfig = new ApplicationUserdataConfig(new ApplicationUserdataConfig.Builder().version("v1"));
String json = ApplicationStatusHandler.renderApplicationConfigs(metaConfig, userConfig).toString();
assertThat(json, containsString("version"));
assertThat(json, containsString("meta"));
assertThat(json, containsString("abc"));
assertThat(json, containsString("app"));
assertThat(json, containsString("/a/b/c"));
assertThat(json, containsString("3000"));
assertThat(json, containsString("donald"));
assertThat(json, containsString("v1"));
}
Aggregations