use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class ApplicationRepositoryTest method setup.
@Before
public void setup() {
Curator curator = new MockCurator();
Tenants tenants = new Tenants(new TestComponentRegistry.Builder().curator(curator).build());
tenants.addTenant(tenantName);
tenant = tenants.getTenant(tenantName);
Provisioner provisioner = new SessionHandlerTest.MockProvisioner();
applicationRepository = new ApplicationRepository(tenants, provisioner, clock);
timeoutBudget = new TimeoutBudget(clock, Duration.ofSeconds(60));
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class ApplicationHandlerTest method addApplication.
private static Tenants addApplication(ApplicationId applicationId, long sessionId) throws Exception {
// This method is a good illustration of the spaghetti wiring resulting from no design
// TODO: When this setup looks sane we have refactored sufficiently that there is a design
TenantName tenantName = applicationId.tenant();
Path tenantPath = Tenants.getTenantPath(tenantName);
Path sessionPath = tenantPath.append(Tenant.SESSIONS).append(String.valueOf(sessionId));
MockCurator curator = new MockCurator();
GlobalComponentRegistry componentRegistry = new TestComponentRegistry.Builder().curator(curator).modelFactoryRegistry(new ModelFactoryRegistry(Collections.singletonList(new VespaModelFactory(new NullConfigModelRegistry())))).build();
// Creates the application path element in zk
Tenants tenants = new Tenants(componentRegistry);
tenants.addTenant(tenantName);
Tenant tenant = tenants.getTenant(tenantName);
tenant.getApplicationRepo().createPutApplicationTransaction(applicationId, sessionId).commit();
ApplicationPackage app = FilesApplicationPackage.fromFile(testApp);
SessionZooKeeperClient sessionClient = new SessionZooKeeperClient(curator, sessionPath);
SessionContext context = new SessionContext(app, sessionClient, new File("/serverDb"), tenant.getApplicationRepo(), null, new SuperModelGenerationCounter(curator));
tenant.getLocalSessionRepo().addSession(new LocalSession(tenantName, sessionId, null, context));
// TODO: Instead, use ApplicationRepository to deploy the application
sessionClient.writeApplicationId(applicationId);
tenant.getRemoteSessionRepo().addSession(new RemoteSession(tenantName, sessionId, componentRegistry, sessionClient, Clock.systemUTC()));
return tenants;
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class SessionPrepareHandlerTest method setupRepo.
@Before
public void setupRepo() throws Exception {
applicationRepo = new MemoryTenantApplications();
curator = new MockCurator();
localRepo = new LocalSessionRepo(Clock.systemUTC());
pathPrefix = "/application/v2/tenant/" + tenant + "/session/";
preparedMessage = " for tenant '" + tenant + "' prepared.\"";
tenantMessage = ",\"tenant\":\"" + tenant + "\"";
builder = new TestTenantBuilder();
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class ZooKeeperDeployerTest method require_that_deployer_is_initialized.
@Test
public void require_that_deployer_is_initialized() throws IOException, ParseException {
ConfigCurator zkfacade = ConfigCurator.create(new MockCurator());
File serverdbDir = folder.newFolder("serverdb");
File defsDir = new File(serverdbDir, "serverdefs");
try {
IOUtils.createWriter(new File(defsDir, defFile), true);
} catch (IOException e) {
e.printStackTrace();
fail();
}
deploy(FilesApplicationPackage.fromFile(new File("src/test/apps/content")), zkfacade, Path.fromString("/1"));
deploy(FilesApplicationPackage.fromFile(new File("src/test/apps/content")), zkfacade, Path.fromString("/2"));
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class InjectedGlobalComponentRegistryTest method setupRegistry.
@Before
public void setupRegistry() {
curator = new MockCurator();
ConfigCurator configCurator = ConfigCurator.create(curator);
metrics = Metrics.createTestMetrics();
modelFactoryRegistry = new ModelFactoryRegistry(Collections.singletonList(new VespaModelFactory(new NullConfigModelRegistry())));
configserverConfig = new ConfigserverConfig(new ConfigserverConfig.Builder().configServerDBDir(Files.createTempDir().getAbsolutePath()).configDefinitionsDir(Files.createTempDir().getAbsolutePath()));
serverDB = new ConfigServerDB(configserverConfig);
sessionPreparer = new SessionTest.MockSessionPreparer();
rpcServer = new RpcServer(configserverConfig, null, Metrics.createTestMetrics(), new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBPath()));
generationCounter = new SuperModelGenerationCounter(curator);
defRepo = new StaticConfigDefinitionRepo();
permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig);
hostRegistries = new HostRegistries();
HostProvisionerProvider hostProvisionerProvider = HostProvisionerProvider.withProvisioner(new SessionHandlerTest.MockProvisioner());
zone = Zone.defaultZone();
globalComponentRegistry = new InjectedGlobalComponentRegistry(curator, configCurator, metrics, modelFactoryRegistry, serverDB, sessionPreparer, rpcServer, configserverConfig, generationCounter, defRepo, permanentApplicationPackage, hostRegistries, hostProvisionerProvider, zone);
}
Aggregations