Search in sources :

Example 1 with MemoryTenantApplications

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();
}
Also used : MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Before(org.junit.Before)

Example 2 with MemoryTenantApplications

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);
}
Also used : ManualClock(com.yahoo.test.ManualClock) MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) SessionCounter(com.yahoo.vespa.config.server.zookeeper.SessionCounter) TenantFileSystemDirs(com.yahoo.vespa.config.server.deploy.TenantFileSystemDirs) GlobalComponentRegistry(com.yahoo.vespa.config.server.GlobalComponentRegistry) File(java.io.File)

Example 3 with MemoryTenantApplications

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\"";
}
Also used : MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) LocalSessionRepo(com.yahoo.vespa.config.server.session.LocalSessionRepo) Before(org.junit.Before)

Example 4 with MemoryTenantApplications

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));
}
Also used : MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) HostRegistry(com.yahoo.vespa.config.server.host.HostRegistry) ZooKeeperClient(com.yahoo.vespa.config.server.deploy.ZooKeeperClient) ApplicationFile(com.yahoo.config.application.api.ApplicationFile) File(java.io.File)

Example 5 with MemoryTenantApplications

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;
}
Also used : RemoteSessionRepo(com.yahoo.vespa.config.server.session.RemoteSessionRepo) MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) LocalSessionRepo(com.yahoo.vespa.config.server.session.LocalSessionRepo) TenantBuilder(com.yahoo.vespa.config.server.tenant.TenantBuilder)

Aggregations

MemoryTenantApplications (com.yahoo.vespa.config.server.application.MemoryTenantApplications)7 LocalSessionRepo (com.yahoo.vespa.config.server.session.LocalSessionRepo)3 Before (org.junit.Before)3 RemoteSessionRepo (com.yahoo.vespa.config.server.session.RemoteSessionRepo)2 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)2 File (java.io.File)2 ApplicationFile (com.yahoo.config.application.api.ApplicationFile)1 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)1 ManualClock (com.yahoo.test.ManualClock)1 GlobalComponentRegistry (com.yahoo.vespa.config.server.GlobalComponentRegistry)1 TestComponentRegistry (com.yahoo.vespa.config.server.TestComponentRegistry)1 TenantFileSystemDirs (com.yahoo.vespa.config.server.deploy.TenantFileSystemDirs)1 ZooKeeperClient (com.yahoo.vespa.config.server.deploy.ZooKeeperClient)1 HostRegistry (com.yahoo.vespa.config.server.host.HostRegistry)1 ModelFactoryRegistry (com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)1 TenantBuilder (com.yahoo.vespa.config.server.tenant.TenantBuilder)1 SessionCounter (com.yahoo.vespa.config.server.zookeeper.SessionCounter)1 VespaModelFactory (com.yahoo.vespa.model.VespaModelFactory)1 Test (org.junit.Test)1