aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2017-11-01 12:14:03 +0100
committerGitHub <noreply@github.com>2017-11-01 12:14:03 +0100
commit451f936c4d19ae8dc08332682d06c6caa3a39000 (patch)
tree43cfbc066851fdbc781b223f28fcda71e6a1bb42
parent1e099baf24eca738a3f4754e628f11f3c12fd8a9 (diff)
parent75b9870f5ea6056ee2b7effc72010fed3c71bef2 (diff)
Merge pull request #3960 from vespa-engine/hmusum/minor-cleanup
Remove unused method and rename another to clarify
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/deploy/TenantFileSystemDirs.java10
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java4
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionRepoTest.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionTest.java6
5 files changed, 13 insertions, 15 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/TenantFileSystemDirs.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/TenantFileSystemDirs.java
index 93a6d8c7ca3..93cd68f6dd6 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/TenantFileSystemDirs.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/TenantFileSystemDirs.java
@@ -22,23 +22,19 @@ public class TenantFileSystemDirs {
public TenantFileSystemDirs(File dir, TenantName tenant) {
this.serverDB = dir;
this.tenant = tenant;
- ConfigServerDB.createDirectory(path());
+ ConfigServerDB.createDirectory(sessionsPath());
}
public static TenantFileSystemDirs createTestDirs(TenantName tenantName) {
return new TenantFileSystemDirs(Files.createTempDir(), tenantName);
}
- public File path() {
+ public File sessionsPath() {
return new File(serverDB, Path.fromString("tenants").append(tenant.value()).append("sessions").getRelative());
}
public File getUserApplicationDir(long generation) {
- return new File(path(), String.valueOf(generation));
- }
-
- public String getPath() {
- return serverDB.getPath();
+ return new File(sessionsPath(), String.valueOf(generation));
}
public void delete() {
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 8356077c5a2..bbb9aa58e05 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
@@ -29,7 +29,7 @@ public class LocalSessionRepo extends SessionRepo<LocalSession> {
public LocalSessionRepo(TenantFileSystemDirs tenantFileSystemDirs, LocalSessionLoader loader,
Clock clock, long sessionLifeTime) {
this(clock, sessionLifeTime);
- loadSessions(tenantFileSystemDirs.path(), loader);
+ loadSessions(tenantFileSystemDirs.sessionsPath(), loader);
}
// Constructor public only for testing
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 a52fd82b44b..6b25772f85d 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
@@ -231,7 +231,9 @@ public class SessionActiveHandlerTest extends SessionHandlerTest {
writeApplicationId(zkc, deployData.getApplicationName());
TenantFileSystemDirs tenantFileSystemDirs = TenantFileSystemDirs.createTestDirs(tenant);
ApplicationPackage app = FilesApplicationPackage.fromFileWithDeployData(testApp, deployData);
- localRepo.addSession(new LocalSession(tenant, sessionId, new SessionTest.MockSessionPreparer(), new SessionContext(app, zkc, new File(tenantFileSystemDirs.path(), String.valueOf(sessionId)), applicationRepo, new HostRegistry<>(), new SuperModelGenerationCounter(curator))));
+ localRepo.addSession(new LocalSession(tenant, sessionId, new SessionTest.MockSessionPreparer(),
+ new SessionContext(app, zkc, new File(tenantFileSystemDirs.sessionsPath(), String.valueOf(sessionId)),
+ applicationRepo, new HostRegistry<>(), new SuperModelGenerationCounter(curator))));
return localRepo;
}
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 ac89de2c6a6..5753b2959f7 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
@@ -45,9 +45,9 @@ public class LocalSessionRepoTest extends TestWithCurator {
GlobalComponentRegistry globalComponentRegistry = new TestComponentRegistry.Builder().curator(curator).build();
TenantFileSystemDirs tenantFileSystemDirs = TenantFileSystemDirs.createTestDirs(tenantName);
if (createInitialSessions) {
- IOUtils.copyDirectory(testApp, new File(tenantFileSystemDirs.path(), "1"));
- IOUtils.copyDirectory(testApp, new File(tenantFileSystemDirs.path(), "2"));
- IOUtils.copyDirectory(testApp, new File(tenantFileSystemDirs.path(), "3"));
+ 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,
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionTest.java
index df011dd9307..c6099e724bc 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/LocalSessionTest.java
@@ -110,12 +110,12 @@ public class LocalSessionTest {
public void require_that_session_can_be_deleted() throws Exception {
LocalSession session = createSession(TenantName.defaultName(), 3);
assertTrue(configCurator.exists("/3"));
- assertTrue(new File(tenantFileSystemDirs.path(), "3").exists());
+ assertTrue(new File(tenantFileSystemDirs.sessionsPath(), "3").exists());
long gen = superModelGenerationCounter.get();
session.delete();
assertThat(superModelGenerationCounter.get(), is(gen + 1));
assertFalse(configCurator.exists("/3"));
- assertFalse(new File(tenantFileSystemDirs.path(), "3").exists());
+ assertFalse(new File(tenantFileSystemDirs.sessionsPath(), "3").exists());
}
@Test(expected = IllegalStateException.class)
@@ -163,7 +163,7 @@ public class LocalSessionTest {
zkClient.write(allocatedHosts.get());
}
zkClient.write(Collections.singletonMap(Version.fromIntValues(0, 0, 0), new MockFileRegistry()));
- File sessionDir = new File(tenantFileSystemDirs.path(), String.valueOf(sessionId));
+ 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));
}