use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method findsCoverArtFileForTrack.
@Test
public void findsCoverArtFileForTrack() throws Exception {
Artist artist = new Artist("Artist Name");
int artistId = musicDao.getArtistId(artist);
scannerService.add(set(media3));
List<Album> albums = browserService.getAlbums(artistId, false, true);
int trackId = albums.get(1).getTrackIds().get(0);
String coverArtPath = browserService.getCoverArtFileForTrack(trackId);
Assert.assertNotNull(coverArtPath);
Assert.assertTrue(coverArtPath.endsWith("Folder artwork" + separatorChar + "folder.png"));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method findsTrack.
@Test
public void findsTrack() throws Exception {
scannerService.add(set(aretha));
Artist artist = new Artist("Aretha Franklin");
int artistId = musicDao.getArtistId(artist);
List<Album> albums = browserService.getAlbums(artistId, true);
assertAlbums(albums, artist, UNKNOWN_ALBUM);
List<Track> tracks = browserService.getTracks(albums.get(0).getTrackIds());
assertTracks(tracks, Arrays.asList(new Track("Aretha Franklin", "Bridge Over Troubled Water")));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method findsAlbum.
@Test
public void findsAlbum() throws Exception {
Artist theBeatles = new Artist("The Beatles");
int beatlesId = musicDao.getArtistId(theBeatles);
scannerService.add(set(media2));
List<Album> albums = browserService.getAlbums(beatlesId, true);
assertAlbums(albums, theBeatles, "1967-1970");
int albumId = albums.get(0).getId();
Album album = browserService.getAlbum(albumId);
assertAlbums(Arrays.asList(album), theBeatles, "1967-1970");
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method findsArtwork.
@Test
public void findsArtwork() throws Exception {
Artist artist = new Artist("Artist Name");
int artistId = musicDao.getArtistId(artist);
scannerService.add(set(media3));
List<Album> albums = browserService.getAlbums(artistId, true);
assertAlbums(albums, artist, "Embedded artwork", "Folder artwork");
Album folderArtAlbum = getAlbum(albums, "Folder artwork");
Album embeddedArtAlbum = getAlbum(albums, "Embedded artwork");
Assert.assertTrue(embeddedArtAlbum.getCoverArtPath() != null);
Assert.assertTrue(embeddedArtAlbum.isCoverArtEmbedded());
Assert.assertTrue(embeddedArtAlbum.getCoverArtURL() == null);
Assert.assertTrue(folderArtAlbum.getCoverArtPath() != null);
Assert.assertFalse(folderArtAlbum.isCoverArtEmbedded());
Assert.assertTrue(folderArtAlbum.getCoverArtURL() == null);
Assert.assertTrue(embeddedArtAlbum.getCoverArtPath().endsWith("Embedded artwork.mp3"));
Assert.assertTrue(folderArtAlbum.getCoverArtPath().endsWith("folder.png"));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class ArtistRelationServiceTest method artistRelationUpdateUpdatesAllArtists.
@Test
public void artistRelationUpdateUpdatesAllArtists() throws ApplicationException, IOException {
clearLibraryAndAddCherTrack();
WebserviceInvocation wi = new WebserviceInvocation(ARTIST_GET_SIMILAR, new Artist(artistName));
Assert.assertTrue(webserviceHistoryService.isWebserviceInvocationAllowed(wi));
Set<String> artistNames = webserviceHistoryService.getArtistNamesScheduledForUpdate(ARTIST_GET_SIMILAR);
Assert.assertNotNull(artistNames);
Assert.assertEquals(1, artistNames.size());
Assert.assertTrue(artistNames.contains(artistName));
ArtistRelationService artistRelationService = new ArtistRelationService();
artistRelationService.setArtistSimilarityClient(getArtistSimilarityClient(webserviceHistoryService));
artistRelationService.setArtistRelationDao(artistRelationDao);
artistRelationService.setWebserviceHistoryService(webserviceHistoryService);
artistRelationService.updateSearchIndex();
Assert.assertFalse(webserviceHistoryService.isWebserviceInvocationAllowed(wi));
}
Aggregations