use of com.github.hakko.musiccabinet.domain.model.music.Track 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.Track 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"));
}
use of com.github.hakko.musiccabinet.domain.model.music.Track in project musiccabinet by hakko.
the class PlaylistGeneratorServiceTest method prepareTestData.
@Before
public void prepareTestData() throws ApplicationException {
PostgreSQLUtil.truncateTables(playlistGeneratorDao);
Track track = new Track(artistName, trackName);
UnittestLibraryUtil.submitFile(additionDao, getFile(track));
artistId = musicDao.getArtistId(artist);
artistTopPlaylistItemsDao.createTopTracks(artist, Arrays.asList(track));
playlistGeneratorService.updateSearchIndex();
}
use of com.github.hakko.musiccabinet.domain.model.music.Track in project musiccabinet by hakko.
the class JdbcArtistTopTracksDaoTest method storeUpdateAndValidateTopTracks.
@Test
public void storeUpdateAndValidateTopTracks() throws ApplicationException {
deleteArtistTopTracks();
dao.createTopTracks(cherArtist, cherTopTracks);
dao.createTopTracks(rihannaArtist, rihannaTopTracks);
rihannaTopTracks = new ArrayList<>();
rihannaTopTracks.add(new Track("Rihanna", "Umbrella"));
rihannaTopTracks.add(new Track("Rihanna", "Don't Stop The Music"));
dao.createTopTracks(rihannaArtist, rihannaTopTracks);
List<Track> cherStoredTopTracks = dao.getTopTracks(cherArtist);
List<Track> rihannaStoredTopTracks = dao.getTopTracks(rihannaArtist);
assertEquals(50, cherStoredTopTracks.size());
assertEquals(2, rihannaStoredTopTracks.size());
for (int i = 0; i < cherTopTracks.size(); i++) {
assertEquals(cherTopTracks.get(i), cherStoredTopTracks.get(i));
}
for (int i = 0; i < rihannaTopTracks.size(); i++) {
assertEquals(rihannaTopTracks.get(i), rihannaStoredTopTracks.get(i));
}
}
use of com.github.hakko.musiccabinet.domain.model.music.Track in project musiccabinet by hakko.
the class JdbcLibraryBrowserDaoAggregationTest method findsArtistAndTrackNameByLibraryTrackId.
@Test
public void findsArtistAndTrackNameByLibraryTrackId() {
Track t1 = browserDao.getTracks(album1.getTrackIds()).get(0);
Track t2 = browserDao.getTrack(album1.getTrackIds().get(0));
assertEquals(t1.getArtist().getName(), t2.getArtist().getName());
assertEquals(t1.getName(), t2.getName());
}
Aggregations