mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 17:56:17 +01:00
Remove dead code
This commit is contained in:
@@ -185,7 +185,7 @@ public class XmlRepositoryDAO
|
||||
|
||||
@Override
|
||||
public Repository getRepositoryForDirectory(File path) {
|
||||
for (RepositoryPath p : db.getPaths()) {
|
||||
for (RepositoryPath p : db.values()) {
|
||||
if (toRealPath(path.toPath()).startsWith(toRealPath(context.getBaseDirectory().toPath().resolve(p.getPath())))) {
|
||||
return p.getRepository();
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public class XmlRepositoryDAO
|
||||
}
|
||||
|
||||
private Optional<RepositoryPath> findExistingRepositoryPath(Repository repository) {
|
||||
return db.getPaths().stream()
|
||||
return db.values().stream()
|
||||
.filter(repoPath -> repoPath.getId().equals(repository.getId()))
|
||||
.findAny();
|
||||
}
|
||||
|
||||
@@ -98,16 +98,6 @@ public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
||||
return get(id) != null;
|
||||
}
|
||||
|
||||
public boolean contains(Repository repository)
|
||||
{
|
||||
return repositoryPathMap.containsKey(createKey(repository));
|
||||
}
|
||||
|
||||
public void remove(Repository repository)
|
||||
{
|
||||
repositoryPathMap.remove(createKey(repository));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepositoryPath remove(String id)
|
||||
{
|
||||
@@ -129,11 +119,6 @@ public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
||||
return repositoryPathMap.values();
|
||||
}
|
||||
|
||||
public Collection<RepositoryPath> getPaths() {
|
||||
return repositoryPathMap.values();
|
||||
}
|
||||
|
||||
|
||||
public Repository get(NamespaceAndName namespaceAndName) {
|
||||
RepositoryPath repositoryPath = repositoryPathMap.get(createKey(namespaceAndName));
|
||||
if (repositoryPath != null) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class XmlRepositoryMapAdapter extends XmlAdapter<XmlRepositoryList, Map<S
|
||||
}
|
||||
}
|
||||
} catch (JAXBException ex) {
|
||||
throw new StoreException("failed to marshall repository database", ex);
|
||||
throw new StoreException("failed to marshal repository database", ex);
|
||||
}
|
||||
|
||||
return repositoryPaths;
|
||||
@@ -105,7 +105,7 @@ public class XmlRepositoryMapAdapter extends XmlAdapter<XmlRepositoryList, Map<S
|
||||
repositoryPathMap.put(XmlRepositoryDatabase.createKey(repository), repositoryPath);
|
||||
}
|
||||
} catch (JAXBException ex) {
|
||||
throw new StoreException("failed to unmarshall object", ex);
|
||||
throw new StoreException("failed to unmarshal object", ex);
|
||||
}
|
||||
return repositoryPathMap;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class XmlRepositoryDAOTest {
|
||||
public void modifyShouldStoreChangedRepository() {
|
||||
Repository oldRepository = new Repository("id", "old", null, null);
|
||||
RepositoryPath repositoryPath = new RepositoryPath("/path", "id", oldRepository);
|
||||
when(db.getPaths()).thenReturn(asList(repositoryPath));
|
||||
when(db.values()).thenReturn(asList(repositoryPath));
|
||||
|
||||
XmlRepositoryDAO dao = new XmlRepositoryDAO(storeFactory, new InitialRepositoryLocationResolver(context), fileSystem, context);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class XmlRepositoryDAOTest {
|
||||
public void shouldGetPathInBaseDirectoryForRelativePath() {
|
||||
Repository existingRepository = new Repository("id", "old", null, null);
|
||||
RepositoryPath repositoryPath = new RepositoryPath("path", "id", existingRepository);
|
||||
when(db.getPaths()).thenReturn(asList(repositoryPath));
|
||||
when(db.values()).thenReturn(asList(repositoryPath));
|
||||
|
||||
XmlRepositoryDAO dao = new XmlRepositoryDAO(storeFactory, new InitialRepositoryLocationResolver(context), fileSystem, context);
|
||||
|
||||
@@ -98,7 +98,7 @@ public class XmlRepositoryDAOTest {
|
||||
public void shouldGetPathInBaseDirectoryForAbsolutePath() {
|
||||
Repository existingRepository = new Repository("id", "old", null, null);
|
||||
RepositoryPath repositoryPath = new RepositoryPath("/tmp/path", "id", existingRepository);
|
||||
when(db.getPaths()).thenReturn(asList(repositoryPath));
|
||||
when(db.values()).thenReturn(asList(repositoryPath));
|
||||
|
||||
XmlRepositoryDAO dao = new XmlRepositoryDAO(storeFactory, new InitialRepositoryLocationResolver(context), fileSystem, context);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class XmlRepositoryDAOTest {
|
||||
new File(context.getBaseDirectory(), "relative/path/data").mkdirs();
|
||||
Repository existingRepository = new Repository("id", "old", null, null);
|
||||
RepositoryPath repositoryPath = new RepositoryPath("relative/path", "id", existingRepository);
|
||||
when(db.getPaths()).thenReturn(asList(repositoryPath));
|
||||
when(db.values()).thenReturn(asList(repositoryPath));
|
||||
|
||||
XmlRepositoryDAO dao = new XmlRepositoryDAO(storeFactory, new InitialRepositoryLocationResolver(context), fileSystem, context);
|
||||
|
||||
@@ -126,7 +126,7 @@ public class XmlRepositoryDAOTest {
|
||||
Repository existingRepository = new Repository("id", "old", null, null);
|
||||
File folder = temporaryFolder.newFolder("somewhere", "data");
|
||||
RepositoryPath repositoryPath = new RepositoryPath(folder.getParent(), "id", existingRepository);
|
||||
when(db.getPaths()).thenReturn(asList(repositoryPath));
|
||||
when(db.values()).thenReturn(asList(repositoryPath));
|
||||
|
||||
XmlRepositoryDAO dao = new XmlRepositoryDAO(storeFactory, new InitialRepositoryLocationResolver(context), fileSystem, context);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class XmlRepositoryDAOTest {
|
||||
File link = new File(folder.getParentFile().getParentFile(), "link");
|
||||
Files.createSymbolicLink(link.toPath(), folder.getParentFile().toPath());
|
||||
RepositoryPath repositoryPath = new RepositoryPath(new File(link, "data").getPath(), "id", existingRepository);
|
||||
when(db.getPaths()).thenReturn(asList(repositoryPath));
|
||||
when(db.values()).thenReturn(asList(repositoryPath));
|
||||
|
||||
XmlRepositoryDAO dao = new XmlRepositoryDAO(storeFactory, new InitialRepositoryLocationResolver(context), fileSystem, context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user