use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method require_url_building_and_mimetype_correct.
@Test
public void require_url_building_and_mimetype_correct() {
HttpListConfigsHandler.ListConfigsResponse resp = new ListConfigsResponse(new HashSet<ConfigKey<?>>(), null, "http://foo.com/config/v1/", true);
assertEquals(resp.toUrl(new ConfigKey<>("myconfig", "my/id", "mynamespace"), true), "http://foo.com/config/v1/mynamespace.myconfig/my/id");
assertEquals(resp.toUrl(new ConfigKey<>("myconfig", "my/id", "mynamespace"), false), "http://foo.com/config/v1/mynamespace.myconfig/my/id/");
assertEquals(resp.getContentType(), "application/json");
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method require_correct_error_response_on_no_model.
@Test
public void require_correct_error_response_on_no_model() throws IOException {
mockRequestHandler.setAllConfigs(new HashSet<ConfigKey<?>>());
HttpResponse response = namedHandler.handle(HttpRequest.createTestRequest("http://yahoo.com:8080/config/v1/foo.bar/myid/", GET));
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "Config not available, verify that an application package has been deployed and activated.");
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method setUp.
@Before
public void setUp() {
mockRequestHandler = new MockRequestHandler();
mockRequestHandler.setAllConfigs(new HashSet<ConfigKey<?>>() {
{
add(new ConfigKey<>("bar", "conf/id/", "foo"));
}
});
HttpListConfigsHandler.Context ctx = HttpListConfigsHandler.testOnlyContext();
handler = new HttpListConfigsHandler(ctx, mockRequestHandler);
namedHandler = new HttpListNamedConfigsHandler(ctx, mockRequestHandler);
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method require_correct_error_response_on_no_model.
@Test
public void require_correct_error_response_on_no_model() throws IOException {
mockRequestHandler.setAllConfigs(new HashSet<ConfigKey<?>>());
HttpResponse response = namedHandler.handle(HttpRequest.createTestRequest("http://yahoo.com:8080/config/v2/tenant/mytenant/application/myapplication/foo.bar/myid/", GET));
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "Config not available, verify that an application package has been deployed and activated.");
}
use of com.yahoo.vespa.config.ConfigKey in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method setUp.
@Before
public void setUp() throws Exception {
mockRequestHandler = new MockRequestHandler();
mockRequestHandler.setAllConfigs(new HashSet<ConfigKey<?>>() {
{
add(new ConfigKey<>("bar", "conf/id", "foo"));
}
});
TestTenantBuilder tb = new TestTenantBuilder();
tb.createTenant(TenantName.from("mytenant")).withRequestHandler(mockRequestHandler).build();
Tenants tenants = tb.createTenants();
handler = new HttpListConfigsHandler(HttpListConfigsHandler.testOnlyContext(), tenants, Zone.defaultZone());
namedHandler = new HttpListNamedConfigsHandler(HttpListConfigsHandler.testOnlyContext(), tenants, Zone.defaultZone());
}
Aggregations