Search in sources :

Example 6 with ConfigKey

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");
}
Also used : ListConfigsResponse(com.yahoo.vespa.config.server.http.HttpListConfigsHandler.ListConfigsResponse) ConfigKey(com.yahoo.vespa.config.ConfigKey) ListConfigsResponse(com.yahoo.vespa.config.server.http.HttpListConfigsHandler.ListConfigsResponse) Test(org.junit.Test)

Example 7 with ConfigKey

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.");
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) HttpResponse(com.yahoo.container.jdisc.HttpResponse) Test(org.junit.Test)

Example 8 with ConfigKey

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);
}
Also used : MockRequestHandler(com.yahoo.vespa.config.server.rpc.MockRequestHandler) ConfigKey(com.yahoo.vespa.config.ConfigKey) Before(org.junit.Before)

Example 9 with ConfigKey

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.");
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) HttpResponse(com.yahoo.container.jdisc.HttpResponse) HandlerTest(com.yahoo.vespa.config.server.http.HandlerTest) Test(org.junit.Test) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest)

Example 10 with ConfigKey

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());
}
Also used : MockRequestHandler(com.yahoo.vespa.config.server.rpc.MockRequestHandler) ConfigKey(com.yahoo.vespa.config.ConfigKey) Tenants(com.yahoo.vespa.config.server.tenant.Tenants) Before(org.junit.Before)

Aggregations

ConfigKey (com.yahoo.vespa.config.ConfigKey)23 Test (org.junit.Test)9 ApplicationId (com.yahoo.config.provision.ApplicationId)4 MockRequestHandler (com.yahoo.vespa.config.server.rpc.MockRequestHandler)4 Before (org.junit.Before)4 ConfigInstance (com.yahoo.config.ConfigInstance)3 ComponentId (com.yahoo.component.ComponentId)2 Version (com.yahoo.component.Version)2 ComponentClass (com.yahoo.component.provider.ComponentClass)2 TenantName (com.yahoo.config.provision.TenantName)2 HttpResponse (com.yahoo.container.jdisc.HttpResponse)2 RequestHandler (com.yahoo.vespa.config.server.RequestHandler)2 HandlerTest (com.yahoo.vespa.config.server.http.HandlerTest)2 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2 Tenants (com.yahoo.vespa.config.server.tenant.Tenants)2 File (java.io.File)2 LbServicesConfig (com.yahoo.cloud.config.LbServicesConfig)1 RoutingConfig (com.yahoo.cloud.config.RoutingConfig)1 ConfigurationRuntimeException (com.yahoo.config.ConfigurationRuntimeException)1 IntConfig (com.yahoo.config.core.IntConfig)1