use of com.yahoo.vespa.config.server.application.MemoryTenantApplications 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.config.server.application.MemoryTenantApplications in project vespa by vespa-engine.
the class LocalSessionRepoTest method setupSessions.
private void setupSessions(TenantName tenantName, boolean createInitialSessions) throws Exception {
GlobalComponentRegistry globalComponentRegistry = new TestComponentRegistry.Builder().curator(curator).build();
TenantFileSystemDirs tenantFileSystemDirs = TenantFileSystemDirs.createTestDirs(tenantName);
if (createInitialSessions) {
IOUtils.copyDirectory(testApp, new File(tenantFileSystemDirs.sessionsPath(), "1"));
IOUtils.copyDirectory(testApp, new File(tenantFileSystemDirs.sessionsPath(), "2"));
IOUtils.copyDirectory(testApp, new File(tenantFileSystemDirs.sessionsPath(), "3"));
}
clock = new ManualClock(Instant.ofEpochSecond(1));
LocalSessionLoader loader = new SessionFactoryImpl(globalComponentRegistry, new SessionCounter(globalComponentRegistry.getConfigCurator(), tenantName), new MemoryTenantApplications(), tenantFileSystemDirs, new HostRegistry<>(), tenantName);
repo = new LocalSessionRepo(tenantFileSystemDirs, loader, clock, 5);
}
use of com.yahoo.vespa.config.server.application.MemoryTenantApplications in project vespa by vespa-engine.
the class SessionCreateHandlerTest method setupRepo.
@Before
public void setupRepo() throws Exception {
applicationRepo = new MemoryTenantApplications();
localSessionRepo = new LocalSessionRepo(Clock.systemUTC());
pathPrefix = "/application/v2/tenant/" + tenant + "/session/";
createdMessage = " for tenant '" + tenant + "' created.\"";
tenantMessage = ",\"tenant\":\"test\"";
}
use of com.yahoo.vespa.config.server.application.MemoryTenantApplications in project vespa by vespa-engine.
the class LocalSessionTest method createSession.
private LocalSession createSession(TenantName tenant, long sessionId, SessionTest.MockSessionPreparer preparer, Optional<AllocatedHosts> allocatedHosts) throws Exception {
SessionZooKeeperClient zkc = new MockSessionZKClient(curator, tenant, sessionId, allocatedHosts);
zkc.createWriteStatusTransaction(Session.Status.NEW).commit();
ZooKeeperClient zkClient = new ZooKeeperClient(configCurator, new BaseDeployLogger(), false, Tenants.getSessionsPath(tenant).append(String.valueOf(sessionId)));
if (allocatedHosts.isPresent()) {
zkClient.write(allocatedHosts.get());
}
zkClient.write(Collections.singletonMap(Version.fromIntValues(0, 0, 0), new MockFileRegistry()));
File sessionDir = new File(tenantFileSystemDirs.sessionsPath(), String.valueOf(sessionId));
sessionDir.createNewFile();
return new LocalSession(tenant, sessionId, preparer, new SessionContext(FilesApplicationPackage.fromFile(testApp), zkc, sessionDir, new MemoryTenantApplications(), new HostRegistry<>(), superModelGenerationCounter));
}
use of com.yahoo.vespa.config.server.application.MemoryTenantApplications in project vespa by vespa-engine.
the class TestTenantBuilder method createTenant.
public TenantBuilder createTenant(TenantName tenantName) {
MemoryTenantApplications applicationRepo = new MemoryTenantApplications();
TenantBuilder builder = TenantBuilder.create(componentRegistry, tenantName).withSessionFactory(new SessionCreateHandlerTest.MockSessionFactory()).withLocalSessionRepo(new LocalSessionRepo(componentRegistry.getClock())).withRemoteSessionRepo(new RemoteSessionRepo(tenantName)).withApplicationRepo(applicationRepo);
tenantMap.put(tenantName, builder);
return builder;
}
Aggregations