use of com.yahoo.config.SimpletypesConfig in project vespa by vespa-engine.
the class HttpGetConfigHandlerTest method require_that_handler_can_be_created.
@Test
public void require_that_handler_can_be_created() throws IOException {
// Define config response for mock handler
final long generation = 1L;
ConfigPayload payload = ConfigPayload.fromInstance(new SimpletypesConfig(new SimpletypesConfig.Builder()));
InnerCNode targetDef = getInnerCNode();
mockRequestHandler.responses.put(new ApplicationId.Builder().tenant(tenant).applicationName("myapplication").build(), SlimeConfigResponse.fromConfigPayload(payload, targetDef, generation, "mymd5"));
HttpResponse response = handler.handle(HttpRequest.createTestRequest(configUri, GET));
assertThat(SessionHandlerTest.getRenderedString(response), is(EXPECTED_RENDERED_STRING));
}
use of com.yahoo.config.SimpletypesConfig in project vespa by vespa-engine.
the class HttpGetConfigHandlerTest method require_that_handler_can_be_created.
@Test
public void require_that_handler_can_be_created() throws IOException {
// Define config response for mock handler
final long generation = 1L;
ConfigPayload payload = ConfigPayload.fromInstance(new SimpletypesConfig(new SimpletypesConfig.Builder()));
InnerCNode targetDef = getInnerCNode();
mockRequestHandler.responses.put(ApplicationId.defaultId(), SlimeConfigResponse.fromConfigPayload(payload, targetDef, generation, "mymd5"));
HttpResponse response = handler.handle(HttpRequest.createTestRequest(configUri, GET));
assertThat(SessionHandlerTest.getRenderedString(response), is("{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}"));
}
use of com.yahoo.config.SimpletypesConfig in project vespa by vespa-engine.
the class HttpGetConfigHandlerTest method require_that_nocache_property_works.
@Test
public void require_that_nocache_property_works() throws IOException {
long generation = 1L;
ConfigPayload payload = ConfigPayload.fromInstance(new SimpletypesConfig(new SimpletypesConfig.Builder()));
InnerCNode targetDef = getInnerCNode();
mockRequestHandler.responses.put(ApplicationId.defaultId(), SlimeConfigResponse.fromConfigPayload(payload, targetDef, generation, "mymd5"));
final HttpRequest request = HttpRequest.createTestRequest(configUri, GET, null, Collections.singletonMap("nocache", "true"));
HttpResponse response = handler.handle(request);
assertThat(SessionHandlerTest.getRenderedString(response), is("{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}"));
}
use of com.yahoo.config.SimpletypesConfig in project vespa by vespa-engine.
the class TenantRequestHandlerTest method testReloadConfig.
@Test
public void testReloadConfig() throws IOException, SAXException {
Clock clock = Clock.systemUTC();
ApplicationId applicationId = new ApplicationId.Builder().applicationName(ApplicationName.defaultName()).tenant(tenant).build();
server.reloadConfig(reloadConfig(1, clock));
assertThat(listener.reloaded.get(), is(1));
// Using only payload list for this simple test
SimpletypesConfig config = resolve(SimpletypesConfig.class, server, "");
assertThat(config.intval(), is(1337));
assertThat(server.getApplicationGeneration(applicationId, Optional.of(vespaVersion)), is(1l));
server.reloadConfig(reloadConfig(1l, clock));
config = resolve(SimpletypesConfig.class, server, "");
assertThat(config.intval(), is(1337));
assertThat(listener.reloaded.get(), is(2));
assertThat(server.getApplicationGeneration(applicationId, Optional.of(vespaVersion)), is(1l));
assertThat(listener.tenantHosts.size(), is(1));
assertThat(server.resolveApplicationId("mytesthost"), is(applicationId));
listener.reloaded.set(0);
feedApp(app2, 2);
server.reloadConfig(reloadConfig(2l, clock));
config = resolve(SimpletypesConfig.class, server, "");
assertThat(config.intval(), is(1330));
assertThat(listener.reloaded.get(), is(1));
assertThat(server.getApplicationGeneration(applicationId, Optional.of(vespaVersion)), is(2l));
}
use of com.yahoo.config.SimpletypesConfig in project vespa by vespa-engine.
the class TenantRequestHandlerTest method testResolveMultipleVersions.
@Test
public void testResolveMultipleVersions() throws IOException {
ApplicationId appId = new ApplicationId.Builder().tenant(tenant).applicationName("myapp1").instanceName("myinst1").build();
feedAndReloadApp(app1, 1, appId);
SimpletypesConfig config = resolve(SimpletypesConfig.class, server, appId, vespaVersion, "");
assertThat(config.intval(), is(1337));
config = resolve(SimpletypesConfig.class, server, appId, Version.fromIntValues(3, 2, 1), "");
assertThat(config.intval(), is(1337));
}
Aggregations