Search in sources :

Example 1 with ZooKeeperClient

use of com.yahoo.vespa.config.server.deploy.ZooKeeperClient 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 2 with ZooKeeperClient

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

the class SessionActiveHandlerTest method createRemoteSession.

private RemoteSession createRemoteSession(long sessionId, Session.Status status, SessionZooKeeperClient zkClient, Clock clock) throws IOException {
    zkClient.writeStatus(status);
    ZooKeeperClient zkC = new ZooKeeperClient(configCurator, new BaseDeployLogger(), false, Tenants.getSessionsPath(tenant).append(String.valueOf(sessionId)));
    zkC.write(Collections.singletonMap(modelFactory.getVersion(), new MockFileRegistry()));
    zkC.write(AllocatedHosts.withHosts(Collections.emptySet()));
    RemoteSession session = new RemoteSession(TenantName.from("default"), sessionId, componentRegistry, zkClient, clock);
    remoteSessionRepo.addSession(session);
    return session;
}
Also used : ZooKeeperClient(com.yahoo.vespa.config.server.deploy.ZooKeeperClient) SessionZooKeeperClient(com.yahoo.vespa.config.server.session.SessionZooKeeperClient) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) RemoteSession(com.yahoo.vespa.config.server.session.RemoteSession) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry)

Aggregations

ZooKeeperClient (com.yahoo.vespa.config.server.deploy.ZooKeeperClient)2 ApplicationFile (com.yahoo.config.application.api.ApplicationFile)1 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)1 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)1 MemoryTenantApplications (com.yahoo.vespa.config.server.application.MemoryTenantApplications)1 HostRegistry (com.yahoo.vespa.config.server.host.HostRegistry)1 RemoteSession (com.yahoo.vespa.config.server.session.RemoteSession)1 SessionZooKeeperClient (com.yahoo.vespa.config.server.session.SessionZooKeeperClient)1 File (java.io.File)1