Search in sources :

Example 1 with TestComponentRegistry

use of com.yahoo.vespa.config.server.TestComponentRegistry in project vespa by vespa-engine.

the class StatusHandlerTest method require_that_handler_works.

@Test
public void require_that_handler_works() throws IOException {
    TestComponentRegistry componentRegistry = new TestComponentRegistry.Builder().build();
    StatusHandler handler = new StatusHandler(StatusHandler.testOnlyContext(), componentRegistry);
    HttpResponse response = handler.handle(HttpRequest.createTestRequest("/status", GET));
    JsonNode jsonNode = mapper.readTree(SessionHandlerTest.getRenderedString(response));
    ConfigserverConfig expectedConfig = componentRegistry.getConfigserverConfig();
    assertEquals(expectedConfig.rpcport(), jsonNode.get("configserverConfig").get("rpcport").asInt());
    assertEquals(expectedConfig.applicationDirectory(), jsonNode.get("configserverConfig").get("applicationDirectory").asText());
    assertEquals(1, jsonNode.get("modelVersions").size());
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) HttpResponse(com.yahoo.container.jdisc.HttpResponse) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest)

Example 2 with TestComponentRegistry

use of com.yahoo.vespa.config.server.TestComponentRegistry in project vespa by vespa-engine.

the class ApplicationHandlerTest method addMockApplication.

static void addMockApplication(Tenant tenant, ApplicationId applicationId, long sessionId, Clock clock) {
    tenant.getApplicationRepo().createPutApplicationTransaction(applicationId, sessionId).commit();
    ApplicationPackage app = FilesApplicationPackage.fromFile(testApp);
    tenant.getLocalSessionRepo().addSession(new SessionHandlerTest.MockSession(sessionId, app, applicationId));
    TestComponentRegistry componentRegistry = new TestComponentRegistry.Builder().modelFactoryRegistry(new ModelFactoryRegistry(Collections.singletonList(new VespaModelFactory(new NullConfigModelRegistry())))).build();
    tenant.getRemoteSessionRepo().addSession(new RemoteSession(tenant.getName(), sessionId, componentRegistry, new MockSessionZKClient(app), clock));
}
Also used : VespaModelFactory(com.yahoo.vespa.model.VespaModelFactory) MockSessionZKClient(com.yahoo.vespa.config.server.session.MockSessionZKClient) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest) TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) RemoteSession(com.yahoo.vespa.config.server.session.RemoteSession) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage)

Example 3 with TestComponentRegistry

use of com.yahoo.vespa.config.server.TestComponentRegistry in project vespa by vespa-engine.

the class DeployTester method createComponentRegistry.

private TestComponentRegistry createComponentRegistry(Curator curator, Metrics metrics, List<ModelFactory> modelFactories, ConfigserverConfig configserverConfig, Clock clock) {
    TestComponentRegistry.Builder builder = new TestComponentRegistry.Builder();
    if (configserverConfig.hostedVespa()) {
        builder.provisioner(createHostProvisioner());
    }
    builder.configServerConfig(configserverConfig).curator(curator).modelFactoryRegistry(new ModelFactoryRegistry(modelFactories)).metrics(metrics).clock(clock);
    return builder.build();
}
Also used : TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)

Aggregations

TestComponentRegistry (com.yahoo.vespa.config.server.TestComponentRegistry)3 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2 ModelFactoryRegistry (com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)1 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)1 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)1 HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 MockSessionZKClient (com.yahoo.vespa.config.server.session.MockSessionZKClient)1 RemoteSession (com.yahoo.vespa.config.server.session.RemoteSession)1 VespaModelFactory (com.yahoo.vespa.model.VespaModelFactory)1 Test (org.junit.Test)1