diff options
author | Harald Musum <musum@oath.com> | 2017-10-23 14:26:00 +0200 |
---|---|---|
committer | Harald Musum <musum@oath.com> | 2017-10-23 14:26:00 +0200 |
commit | 25fb057f46c890134be6e9606439286150e78590 (patch) | |
tree | 7a317093f4aa31c94827c3ead40721fe3bf6c596 /configserver | |
parent | 666def891db93d46530df6f6eb0cff3e3d7065b1 (diff) |
Move tenant application repo out of local session repo
* Cleanup by moving getActiveSession() to ApplicationRepository,
untangles dependencies a bit and simplifies code
Diffstat (limited to 'configserver')
12 files changed, 63 insertions, 74 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java index f49c32b061a..e20f8ede534 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java @@ -127,7 +127,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye @Override public Optional<com.yahoo.config.provision.Deployment> deployFromLocalActive(ApplicationId application, Duration timeout) { Tenant tenant = tenants.getTenant(application.tenant()); - LocalSession activeSession = tenant.getLocalSessionRepo().getActiveSession(application); + LocalSession activeSession = getActiveSession(tenant, application); if (activeSession == null) return Optional.empty(); TimeoutBudget timeoutBudget = new TimeoutBudget(clock, timeout); LocalSession newSession = tenant.getSessionFactory().createSessionFromExisting(activeSession, logger, timeoutBudget); @@ -137,7 +137,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye Version version = environment.isManuallyDeployed() ? Vtag.currentVersion : newSession.getVespaVersion(); return Optional.of(Deployment.unprepared(newSession, - tenant.getLocalSessionRepo(), + this, tenant.getPath(), hostProvisioner, new ActivateLock(curator, tenant.getPath()), @@ -147,9 +147,9 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye version)); } - public Deployment deployFromPreparedSession(LocalSession session, ActivateLock lock, LocalSessionRepo localSessionRepo, Duration timeout) { + private Deployment deployFromPreparedSession(LocalSession session, ActivateLock lock, Duration timeout) { return Deployment.prepared(session, - localSessionRepo, + this, hostProvisioner, lock, timeout, @@ -274,12 +274,10 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye boolean ignoreLockFailure, boolean ignoreSessionStaleFailure) { LocalSession localSession = getLocalSession(tenant, sessionId); - LocalSessionRepo localSessionRepo = tenant.getLocalSessionRepo(); ActivateLock activateLock = tenant.getActivateLock(); - // TODO: Get rid of the activateLock and localSessionRepo arguments in deployFromPreparedSession + // TODO: Get rid of the activateLock argument in deployFromPreparedSession Deployment deployment = deployFromPreparedSession(localSession, activateLock, - localSessionRepo, timeoutBudget.timeLeft()); deployment.setIgnoreLockFailure(ignoreLockFailure); deployment.setIgnoreSessionStaleFailure(ignoreSessionStaleFailure); @@ -385,4 +383,22 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye TenantApplications applicationRepo = tenant.getApplicationRepo(); return getLocalSession(tenant, applicationRepo.getSessionIdForApplication(applicationId)); } + + /** + * Gets the active Session for the given application id. + * + * @return the active session, or null if there is no active session for the given application id. + */ + public LocalSession getActiveSession(ApplicationId applicationId) { + return getActiveSession(tenants.getTenant(applicationId.tenant()), applicationId); + } + + private LocalSession getActiveSession(Tenant tenant, ApplicationId applicationId) { + TenantApplications applicationRepo = tenant.getApplicationRepo(); + if (applicationRepo.listApplications().contains(applicationId)) { + return tenant.getLocalSessionRepo().getSession(applicationRepo.getSessionIdForApplication(applicationId)); + } + return null; + } + } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java index e38be55290f..7abea3393ff 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java @@ -15,7 +15,6 @@ import com.yahoo.vespa.config.server.ApplicationRepository; import com.yahoo.vespa.config.server.TimeoutBudget; import com.yahoo.vespa.config.server.http.InternalServerException; import com.yahoo.vespa.config.server.session.LocalSession; -import com.yahoo.vespa.config.server.session.LocalSessionRepo; import com.yahoo.vespa.config.server.session.PrepareParams; import com.yahoo.vespa.config.server.session.Session; import com.yahoo.vespa.config.server.session.SilentDeployLogger; @@ -39,7 +38,7 @@ public class Deployment implements com.yahoo.config.provision.Deployment { /** The session containing the application instance to activate */ private final LocalSession session; - private final LocalSessionRepo localSessionRepo; + private final ApplicationRepository applicationRepository; /** The path to the tenant, or null if not available (only used during prepare) */ private final Path tenantPath; private final Optional<Provisioner> hostProvisioner; @@ -59,11 +58,11 @@ public class Deployment implements com.yahoo.config.provision.Deployment { private boolean ignoreLockFailure = false; private boolean ignoreSessionStaleFailure = false; - private Deployment(LocalSession session, LocalSessionRepo localSessionRepo, Path tenantPath, + private Deployment(LocalSession session, ApplicationRepository applicationRepository, Path tenantPath, Optional<Provisioner> hostProvisioner, ActivateLock activateLock, Duration timeout, Clock clock, boolean prepared, boolean validate, Version version) { this.session = session; - this.localSessionRepo = localSessionRepo; + this.applicationRepository = applicationRepository; this.tenantPath = tenantPath; this.hostProvisioner = hostProvisioner; this.activateLock = activateLock; @@ -74,17 +73,17 @@ public class Deployment implements com.yahoo.config.provision.Deployment { this.version = version; } - public static Deployment unprepared(LocalSession session, LocalSessionRepo localSessionRepo, Path tenantPath, + public static Deployment unprepared(LocalSession session, ApplicationRepository applicationRepository, Path tenantPath, Optional<Provisioner> hostProvisioner, ActivateLock activateLock, Duration timeout, Clock clock, boolean validate, Version version) { - return new Deployment(session, localSessionRepo, tenantPath, hostProvisioner, activateLock, + return new Deployment(session, applicationRepository, tenantPath, hostProvisioner, activateLock, timeout, clock, false, validate, version); } - public static Deployment prepared(LocalSession session, LocalSessionRepo localSessionRepo, + public static Deployment prepared(LocalSession session, ApplicationRepository applicationRepository, Optional<Provisioner> hostProvisioner, ActivateLock activateLock, Duration timeout, Clock clock) { - return new Deployment(session, localSessionRepo, null, hostProvisioner, activateLock, + return new Deployment(session, applicationRepository, null, hostProvisioner, activateLock, timeout, clock, true, true, session.getVespaVersion()); } @@ -134,7 +133,7 @@ public class Deployment implements com.yahoo.config.provision.Deployment { log.log(LogLevel.DEBUG, "Lock acquired " + activateLock + " for session " + sessionId); NestedTransaction transaction = new NestedTransaction(); - transaction.add(deactivateCurrentActivateNew(localSessionRepo.getActiveSession(session.getApplicationId()), session, ignoreSessionStaleFailure)); + transaction.add(deactivateCurrentActivateNew(applicationRepository.getActiveSession(session.getApplicationId()), session, ignoreSessionStaleFailure)); if (hostProvisioner.isPresent()) { hostProvisioner.get().activate(transaction, session.getApplicationId(), session.getAllocatedHosts().getHosts()); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java index d2270ddddfd..8356077c5a2 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java @@ -2,8 +2,6 @@ package com.yahoo.vespa.config.server.session; import com.yahoo.log.LogLevel; -import com.yahoo.config.provision.ApplicationId; -import com.yahoo.vespa.config.server.application.TenantApplications; import com.yahoo.vespa.config.server.deploy.TenantFileSystemDirs; import java.io.File; @@ -26,23 +24,21 @@ public class LocalSessionRepo extends SessionRepo<LocalSession> { private final static FilenameFilter sessionApplicationsFilter = (dir, name) -> name.matches("\\d+"); private final long sessionLifetime; // in seconds - private final TenantApplications applicationRepo; private final Clock clock; public LocalSessionRepo(TenantFileSystemDirs tenantFileSystemDirs, LocalSessionLoader loader, - TenantApplications applicationRepo, Clock clock, long sessionLifeTime) { - this(applicationRepo, clock, sessionLifeTime); + Clock clock, long sessionLifeTime) { + this(clock, sessionLifeTime); loadSessions(tenantFileSystemDirs.path(), loader); } // Constructor public only for testing - public LocalSessionRepo(TenantApplications applicationRepo, Clock clock) { - this(applicationRepo, clock, TimeUnit.DAYS.toMillis(1)); + public LocalSessionRepo(Clock clock) { + this(clock, TimeUnit.DAYS.toMillis(1)); } // Constructor public only for testing - public LocalSessionRepo(TenantApplications applicationRepo, Clock clock, long sessionLifetime) { - this.applicationRepo = applicationRepo; + private LocalSessionRepo(Clock clock, long sessionLifetime) { this.sessionLifetime = sessionLifetime; this.clock = clock; } @@ -62,19 +58,6 @@ public class LocalSessionRepo extends SessionRepo<LocalSession> { } } - /** - * Gets the active Session for the given application id. - * - * @return the active session, or null if there is no active session for the given application id. - */ - public LocalSession getActiveSession(ApplicationId applicationId) { - List<ApplicationId> applicationIds = applicationRepo.listApplications(); - if (applicationIds.contains(applicationId)) { - return getSession(applicationRepo.getSessionIdForApplication(applicationId)); - } - return null; - } - @Override public synchronized void addSession(LocalSession session) { purgeOldSessions(); @@ -82,10 +65,9 @@ public class LocalSessionRepo extends SessionRepo<LocalSession> { } private void purgeOldSessions() { - final List<ApplicationId> applicationIds = applicationRepo.listApplications(); List<LocalSession> sessions = new ArrayList<>(listSessions()); for (LocalSession candidate : sessions) { - if (hasExpired(candidate) && !isActiveSession(candidate, applicationIds)) { + if (hasExpired(candidate) && !isActiveSession(candidate)) { deleteSession(candidate); } } @@ -95,13 +77,8 @@ public class LocalSessionRepo extends SessionRepo<LocalSession> { return (candidate.getCreateTime() + sessionLifetime) <= TimeUnit.MILLISECONDS.toSeconds(clock.millis()); } - private boolean isActiveSession(LocalSession candidate, List<ApplicationId> activeIds) { - if (candidate.getStatus() == Session.Status.ACTIVATE && activeIds.contains(candidate.getApplicationId())) { - long sessionId = applicationRepo.getSessionIdForApplication(candidate.getApplicationId()); - return (candidate.getSessionId() == sessionId); - } else { - return false; - } + private boolean isActiveSession(LocalSession candidate) { + return candidate.getStatus() == Session.Status.ACTIVATE; } private void deleteSession(LocalSession candidate) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java index a9f756bcb57..83cdfdadf81 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java @@ -1,10 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.tenant; -import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.Deployer; import com.yahoo.config.provision.TenantName; -import com.yahoo.log.LogLevel; import com.yahoo.path.Path; import com.yahoo.vespa.config.server.ReloadHandler; import com.yahoo.vespa.config.server.RequestHandler; @@ -15,9 +12,6 @@ import com.yahoo.vespa.config.server.session.RemoteSessionRepo; import com.yahoo.vespa.config.server.session.SessionFactory; import com.yahoo.vespa.curator.Curator; -import java.time.Duration; -import java.util.logging.Logger; - /** * Contains all tenant-level components for a single tenant, dealing with editing sessions and * applications for a single tenant. @@ -28,7 +22,6 @@ import java.util.logging.Logger; */ public class Tenant implements TenantHandlerProvider { - private static final Logger log = Logger.getLogger(Tenant.class.getName()); public static final String SESSIONS = "sessions"; public static final String APPLICATIONS = "applications"; diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java index ed4339e9914..084d35a42d4 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java @@ -117,8 +117,7 @@ public class TenantBuilder { private void createLocalSessionRepo() { if (localSessionRepo == null) { - localSessionRepo = new LocalSessionRepo(tenantFileSystemDirs, localSessionLoader, applicationRepo, - componentRegistry.getClock(), componentRegistry.getConfigserverConfig().sessionLifetime()); + localSessionRepo = new LocalSessionRepo(tenantFileSystemDirs, localSessionLoader, componentRegistry.getClock(), componentRegistry.getConfigserverConfig().sessionLifetime()); } } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java index b3c76178259..7a9bbade986 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java @@ -57,10 +57,10 @@ import java.util.Optional; */ public class DeployTester { - private final Curator curator; private final Clock clock; private final Tenants tenants; private final File testApp; + private final ApplicationRepository applicationRepository; private ApplicationId id; @@ -97,7 +97,7 @@ public class DeployTester { public DeployTester(String appPath, List<ModelFactory> modelFactories, ConfigserverConfig configserverConfig, Clock clock) { Metrics metrics = Metrics.createTestMetrics(); - this.curator = new MockCurator(); + Curator curator = new MockCurator(); this.clock = clock; TestComponentRegistry componentRegistry = createComponentRegistry(curator, metrics, modelFactories, configserverConfig, clock); @@ -108,6 +108,10 @@ public class DeployTester { catch (Exception e) { throw new IllegalArgumentException(e); } + applicationRepository = new ApplicationRepository(tenants, + createHostProvisioner(), + curator, + clock); } public Tenant tenant() { return tenants.defaultTenant(); } @@ -137,7 +141,7 @@ public class DeployTester { */ public ApplicationId deployApp(String appName, String vespaVersion, Instant now) { Tenant tenant = tenant(); - LocalSession session = tenant.getSessionFactory().createSession(testApp, appName, new TimeoutBudget(Clock.systemUTC(), Duration.ofSeconds(60))); + LocalSession session = tenant.getSessionFactory().createSession(testApp, appName, new TimeoutBudget(clock, Duration.ofSeconds(60))); ApplicationId id = ApplicationId.from(tenant.getName(), ApplicationName.from(appName), InstanceName.defaultName()); PrepareParams.Builder paramsBuilder = new PrepareParams.Builder().applicationId(id); if (vespaVersion != null) @@ -167,13 +171,13 @@ public class DeployTester { } public Optional<com.yahoo.config.provision.Deployment> redeployFromLocalActive(ApplicationId id) { - ApplicationRepository applicationRepository = new ApplicationRepository(tenants, - createHostProvisioner(), - curator, - clock); return applicationRepository.deployFromLocalActive(id, Duration.ofSeconds(60)); } + public ApplicationRepository applicationRepository() { + return applicationRepository; + } + private Provisioner createHostProvisioner() { return new ProvisionerAdapter(new InMemoryProvisioner(true, "host0", "host1", "host2", "host3", "host4", "host5")); } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/RedeployTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/RedeployTest.java index 21d8fcb5569..76734aadae7 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/RedeployTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/RedeployTest.java @@ -44,11 +44,11 @@ public class RedeployTest { Optional<com.yahoo.config.provision.Deployment> deployment = tester.redeployFromLocalActive(); assertTrue(deployment.isPresent()); - long activeSessionIdBefore = tester.tenant().getLocalSessionRepo().getActiveSession(tester.applicationId()).getSessionId(); + long activeSessionIdBefore = tester.applicationRepository().getActiveSession(tester.applicationId()).getSessionId(); assertEquals(tester.applicationId(), tester.tenant().getLocalSessionRepo().getSession(activeSessionIdBefore).getApplicationId()); deployment.get().prepare(); deployment.get().activate(); - long activeSessionIdAfter = tester.tenant().getLocalSessionRepo().getActiveSession(tester.applicationId()).getSessionId(); + long activeSessionIdAfter = tester.applicationRepository().getActiveSession(tester.applicationId()).getSessionId(); assertEquals(activeSessionIdAfter, activeSessionIdBefore + 1); assertEquals(tester.applicationId(), tester.tenant().getLocalSessionRepo().getSession(activeSessionIdAfter).getApplicationId()); } @@ -83,7 +83,7 @@ public class RedeployTest { assertTrue(deployment2.isPresent()); deployment2.get().activate(); // session 3 - long activeSessionId = tester.tenant().getLocalSessionRepo().getActiveSession(tester.applicationId()).getSessionId(); + long activeSessionId = tester.tenant().getApplicationRepo().getSessionIdForApplication(tester.applicationId()); clock.advance(Duration.ofSeconds(10)); Optional<com.yahoo.config.provision.Deployment> deployment3 = tester.redeployFromLocalActive(); @@ -93,7 +93,7 @@ public class RedeployTest { LocalSession deployment3session = ((Deployment) deployment3.get()).session(); assertNotEquals(activeSessionId, deployment3session); // No change to active session id - assertEquals(activeSessionId, tester.tenant().getLocalSessionRepo().getActiveSession(tester.applicationId()).getSessionId()); + assertEquals(activeSessionId, tester.tenant().getApplicationRepo().getSessionIdForApplication(tester.applicationId())); assertEquals(3, tester.tenant().getLocalSessionRepo().listSessions().size()); clock.advance(Duration.ofHours(1)); // longer than session lifetime @@ -105,6 +105,7 @@ public class RedeployTest { // Both session 2 (deactivated) and session 4 (never activated) should have been removed final Collection<LocalSession> sessions = tester.tenant().getLocalSessionRepo().listSessions(); + System.out.println(sessions); assertEquals(2, sessions.size()); final Set<Long> sessionIds = sessions.stream().map(Session::getSessionId).collect(Collectors.toSet()); assertTrue(sessionIds.contains(3L)); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java index 34ef29b443f..9ea5debe355 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java @@ -93,7 +93,7 @@ public class SessionActiveHandlerTest extends SessionHandlerTest { applicationRepo = new MemoryTenantApplications(); curator = new MockCurator(); configCurator = ConfigCurator.create(curator); - localRepo = new LocalSessionRepo(applicationRepo, Clock.systemUTC()); + localRepo = new LocalSessionRepo(Clock.systemUTC()); pathPrefix = "/application/v2/tenant/" + tenant + "/session/"; pathProvider = new PathProvider(Path.createRoot()); hostProvisioner = new MockProvisioner(); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java index 7914b4e0ddb..08c4d8c5c55 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java @@ -59,7 +59,7 @@ public class SessionCreateHandlerTest extends SessionHandlerTest { @Before public void setupRepo() throws Exception { applicationRepo = new MemoryTenantApplications(); - localSessionRepo = new LocalSessionRepo(applicationRepo, Clock.systemUTC()); + localSessionRepo = new LocalSessionRepo(Clock.systemUTC()); pathPrefix = "/application/v2/tenant/" + tenant + "/session/"; createdMessage = " for tenant '" + tenant + "' created.\""; tenantMessage = ",\"tenant\":\"test\""; diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java index a03940ca95c..58cbe6942bb 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java @@ -77,7 +77,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest { public void setupRepo() throws Exception { applicationRepo = new MemoryTenantApplications(); curator = new MockCurator(); - localRepo = new LocalSessionRepo(applicationRepo, Clock.systemUTC()); + localRepo = new LocalSessionRepo(Clock.systemUTC()); pathPrefix = "/application/v2/tenant/" + tenant + "/session/"; preparedMessage = " for tenant '" + tenant + "' prepared.\""; tenantMessage = ",\"tenant\":\"" + tenant + "\""; @@ -238,8 +238,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest { @Test public void require_that_preparing_with_multiple_tenants_work() throws Exception { // Need different repos for 'default' tenant as opposed to the 'test' tenant - TenantApplications applicationRepoDefault = new MemoryTenantApplications(); - LocalSessionRepo localRepoDefault = new LocalSessionRepo(applicationRepoDefault, Clock.systemUTC()); + LocalSessionRepo localRepoDefault = new LocalSessionRepo(Clock.systemUTC()); final TenantName tenantName = TenantName.defaultName(); addTenant(tenantName, localRepoDefault, new RemoteSessionRepo(), new MockSessionFactory()); addTestTenant(); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TestTenantBuilder.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TestTenantBuilder.java index 4f7fc6d271d..2b1000c2211 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TestTenantBuilder.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TestTenantBuilder.java @@ -35,7 +35,7 @@ public class TestTenantBuilder { MemoryTenantApplications applicationRepo = new MemoryTenantApplications(); TenantBuilder builder = TenantBuilder.create(componentRegistry, tenantName, Path.createRoot().append(tenantName.value())) .withSessionFactory(new SessionCreateHandlerTest.MockSessionFactory()) - .withLocalSessionRepo(new LocalSessionRepo(applicationRepo, componentRegistry.getClock())) + .withLocalSessionRepo(new LocalSessionRepo(componentRegistry.getClock())) .withRemoteSessionRepo(new RemoteSessionRepo()) .withApplicationRepo(applicationRepo); tenantMap.put(tenantName, builder); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionRepoTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionRepoTest.java index 8a54885ac6d..ac89de2c6a6 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionRepoTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionRepoTest.java @@ -20,6 +20,7 @@ import java.io.File; import java.time.Duration; import java.time.Instant; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; @@ -57,7 +58,7 @@ public class LocalSessionRepoTest extends TestWithCurator { new MemoryTenantApplications(), tenantFileSystemDirs, new HostRegistry<>(), tenantName); - repo = new LocalSessionRepo(tenantFileSystemDirs, loader, new MemoryTenantApplications(), clock, 5); + repo = new LocalSessionRepo(tenantFileSystemDirs, loader, clock, 5); } @Test |