Remove dead code

This commit is contained in:
René Pfeuffer
2018-11-23 13:16:18 +01:00
parent 8b8240319b
commit aa596af880
7 changed files with 11 additions and 38 deletions

View File

@@ -153,7 +153,10 @@ public class XmlRepositoryDAO
return context
.getBaseDirectory()
.toPath()
.resolve(findExistingRepositoryPath(repository).map(RepositoryPath::getPath).orElse(initialRepositoryLocationResolver.getRelativeRepositoryPath(repository)));
.resolve(
findExistingRepositoryPath(repository)
.map(RepositoryPath::getPath)
.orElseThrow(() -> new InternalRepositoryException(repository, "could not find base directory for repository")));
}
@Override

View File

@@ -104,19 +104,6 @@ public class XmlRepositoryDAOTest {
assertThat(path.toString()).isEqualTo("/tmp/path");
}
@Test
public void shouldGetPathForNewRepository() {
when(db.getPaths()).thenReturn(emptyList());
InitialRepositoryLocationResolver initialRepositoryLocationResolver = new InitialRepositoryLocationResolver(context);
XmlRepositoryDAO dao = new XmlRepositoryDAO(storeFactory, initialRepositoryLocationResolver, context);
Repository newRepository = new Repository("id", "new", null, null);
Path path = dao.getPath(newRepository);
assertThat(path.toString()).isEqualTo(context.getBaseDirectory().getPath() + "/" + InitialRepositoryLocationResolver.DEFAULT_REPOSITORY_PATH + "/id");
}
@Test
public void shouldFindRepositoryForRelativePath() {
new File(context.getBaseDirectory(), "relative/path/data").mkdirs();