Search in sources :

Example 6 with Directory

use of com.github.hakko.musiccabinet.domain.model.library.Directory in project musiccabinet by hakko.

the class DirectoryBrowserServiceTest method addsDirectory.

@Test
public void addsDirectory() throws ApplicationException {
    scannerService.add(set(cd1));
    Directory root = getFirstRootDirectory();
    browserService.addDirectory(cd1 + separatorChar + "subdir", root.getId());
    Set<Directory> subDirs = browserService.getSubDirectories(root.getId());
    Assert.assertFalse(subDirs.isEmpty());
    Assert.assertEquals(1, subDirs.size());
    Assert.assertEquals(cd1 + separatorChar + "subdir", subDirs.iterator().next().getPath());
}
Also used : Directory(com.github.hakko.musiccabinet.domain.model.library.Directory) Test(org.junit.Test)

Example 7 with Directory

use of com.github.hakko.musiccabinet.domain.model.library.Directory in project musiccabinet by hakko.

the class DirectoryBrowserService method getDirectoryDiff.

public DirectoryContent getDirectoryDiff(int directoryId) {
    Directory dir = dao.getDirectory(directoryId);
    Set<String> dbSubDirs = presenceDao.getSubdirectories(dir.getPath());
    Set<File> dbFiles = presenceDao.getFiles(dir.getPath());
    DirectoryContent found = getContent(dir);
    removeIntersection(dbSubDirs, found.getSubDirectories());
    removeIntersection(dbFiles, found.getFiles());
    return found;
}
Also used : DirectoryContent(com.github.hakko.musiccabinet.domain.model.aggr.DirectoryContent) File(com.github.hakko.musiccabinet.domain.model.library.File) Directory(com.github.hakko.musiccabinet.domain.model.library.Directory)

Aggregations

Directory (com.github.hakko.musiccabinet.domain.model.library.Directory)7 Test (org.junit.Test)6 DirectoryContent (com.github.hakko.musiccabinet.domain.model.aggr.DirectoryContent)4 File (java.io.File)2 File (com.github.hakko.musiccabinet.domain.model.library.File)1