use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcWebserviceHistoryDaoTest method identifiesArtistsWithoutInvocations.
@Test
public void identifiesArtistsWithoutInvocations() {
deleteLibraryTracks();
deleteWebserviceInvocations();
File file = UnittestLibraryUtil.getFile("Madonna", null, "Jump");
UnittestLibraryUtil.submitFile(additionDao, file);
final Calltype INFO = ARTIST_GET_INFO, TOP_TRACKS = ARTIST_GET_TOP_TRACKS;
final String MADONNA = file.getMetadata().getArtist();
List<String> artistInfo, artistTopTracks;
artistInfo = dao.getArtistNamesWithNoInvocations(INFO);
artistTopTracks = dao.getArtistNamesWithNoInvocations(TOP_TRACKS);
Assert.assertNotNull(artistInfo);
Assert.assertNotNull(artistTopTracks);
Assert.assertTrue(artistInfo.contains(MADONNA));
Assert.assertTrue(artistTopTracks.contains(MADONNA));
dao.logWebserviceInvocation(new WebserviceInvocation(INFO, new Artist(MADONNA)));
artistInfo = dao.getArtistNamesWithNoInvocations(INFO);
artistTopTracks = dao.getArtistNamesWithNoInvocations(TOP_TRACKS);
Assert.assertFalse(artistInfo.contains(MADONNA));
Assert.assertTrue(artistTopTracks.contains(MADONNA));
dao.logWebserviceInvocation(new WebserviceInvocation(TOP_TRACKS, new Artist(MADONNA)));
artistInfo = dao.getArtistNamesWithNoInvocations(INFO);
artistTopTracks = dao.getArtistNamesWithNoInvocations(TOP_TRACKS);
Assert.assertFalse(artistInfo.contains(MADONNA));
Assert.assertFalse(artistTopTracks.contains(MADONNA));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method findsAlbums.
@Test
public void findsAlbums() throws Exception {
Artist theBeatles = new Artist("The Beatles");
int beatlesId = musicDao.getArtistId(theBeatles);
scannerService.add(set(media1));
assertAlbums(browserService.getAlbums(beatlesId, true), theBeatles, "1962-1966", UNKNOWN_ALBUM);
// shouldn't change anything
scannerService.add(set(media1));
assertAlbums(browserService.getAlbums(beatlesId, true), theBeatles, "1962-1966", UNKNOWN_ALBUM);
scannerService.add(set(media2));
assertAlbums(browserService.getAlbums(beatlesId, true), theBeatles, "1962-1966", "1967-1970", UNKNOWN_ALBUM);
scannerService.delete(set(media1));
assertAlbums(browserService.getAlbums(beatlesId, true), theBeatles, "1967-1970");
// shouldn't change anything
scannerService.delete(set(media1));
assertAlbums(browserService.getAlbums(beatlesId, true), theBeatles, "1967-1970");
scannerService.delete(set(media2));
assertAlbums(browserService.getAlbums(beatlesId, true), theBeatles);
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method findsVariousArtistsTracks.
@Test
public void findsVariousArtistsTracks() throws Exception {
scannerService.add(set(media5));
Artist artist = new Artist("Various Artists");
int artistId = musicDao.getArtistId(artist);
List<Album> albums = browserService.getAlbums(artistId, true);
assertAlbums(albums, artist, "Music From Searching For Wrong-Eyed Jesus");
Album album = albums.get(0);
List<Track> tracks = browserService.getTracks(album.getTrackIds());
List<Track> expectedTracks = asList(new Track("Harry Crews", "Everything Was Stories"), new Track("Jim White", "Still Waters"), new Track("The Handsome Family", "My Sister's Tiny Hands"));
assertTracks(tracks, expectedTracks);
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method findsTracks.
@Test
public void findsTracks() throws Exception {
scannerService.add(set(media1));
Artist artist = new Artist("The Beatles");
int artistId = musicDao.getArtistId(artist);
List<Album> albums = browserService.getAlbums(artistId, true);
Album redAlbum = getAlbum(albums, "1962-1966");
List<Track> tracks = browserService.getTracks(redAlbum.getTrackIds());
List<Track> expectedTracks = new ArrayList<>();
for (String title : asList("Love Me Do", "Please Please Me", "From Me To You", "She Loves You", "Help!")) {
expectedTracks.add(new Track("The Beatles", title));
}
assertTracks(tracks, expectedTracks);
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class LibraryBrowserServiceTest method addsCoverArtPathForTrack.
@Test
public void addsCoverArtPathForTrack() 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(0).getTrackIds().get(0);
List<Track> tracks = browserService.getTracks(asList(trackId));
Assert.assertNotNull(tracks);
Assert.assertEquals(1, tracks.size());
Assert.assertNull(tracks.get(0).getMetaData().getArtworkPath());
browserService.addArtwork(tracks);
String artworkPath = tracks.get(0).getMetaData().getArtworkPath();
Assert.assertNotNull(artworkPath);
Assert.assertTrue(artworkPath.endsWith("Embedded artwork" + separatorChar + "Embedded artwork.mp3"));
}
Aggregations