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());
}
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));
}
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();
}
Aggregations