Search in sources :

Example 1 with MBAlbum

use of com.github.hakko.musiccabinet.domain.model.music.MBAlbum in project musiccabinet by hakko.

the class MusicBrainzServiceTest method handlesArtistFailureDuringUpdate.

@Test
public void handlesArtistFailureDuringUpdate() throws ApplicationException {
    final String revName = reverse(artistName);
    submitFile(additionDao, getFile(revName, albumName, trackName));
    Mockito.when(service.artistQueryClient.get(revName)).thenThrow(new ApplicationException("Fail", new HttpResponseException(503, "Overloaded")));
    service.updateDiscography();
    List<MBAlbum> albums = service.getMissingAlbums(artistName, asList(TYPE_EP), null, -1, 0);
    Assert.assertEquals(2, albums.size());
    assertEquals("Switchblade / Cult of Luna", albums.get(0).getTitle());
    assertEquals("Bodies / Recluse", albums.get(1).getTitle());
}
Also used : ApplicationException(com.github.hakko.musiccabinet.exception.ApplicationException) HttpResponseException(org.apache.http.client.HttpResponseException) MBAlbum(com.github.hakko.musiccabinet.domain.model.music.MBAlbum) Test(org.junit.Test)

Example 2 with MBAlbum

use of com.github.hakko.musiccabinet.domain.model.music.MBAlbum in project musiccabinet by hakko.

the class JdbcMusicBrainzAlbumDaoTest method findsAlbumsMissingFromLibraryWithRecentlyPlayedFilter.

@Test
public void findsAlbumsMissingFromLibraryWithRecentlyPlayedFilter() {
    List<MBAlbum> albums = albumDao.getMissingAlbums(null, null, USER, 10, 0);
    assertEquals(0, albums.size());
    LastFmUser lastFmUser = new LastFmUser(USER);
    lastFmDao.createOrUpdateLastFmUser(lastFmUser);
    submitFile(additionDao, getFile(artist.getName(), UNKNOWN, UNKNOWN));
    Track track = browserDao.getTracks(browserDao.getRandomTrackIds(1)).get(0);
    playCountDao.addPlayCount(lastFmUser, track);
    albums = albumDao.getMissingAlbums(null, null, USER, 10, 0);
    assertEquals(2, albums.size());
}
Also used : LastFmUser(com.github.hakko.musiccabinet.domain.model.library.LastFmUser) MBAlbum(com.github.hakko.musiccabinet.domain.model.music.MBAlbum) Track(com.github.hakko.musiccabinet.domain.model.music.Track) Test(org.junit.Test)

Aggregations

MBAlbum (com.github.hakko.musiccabinet.domain.model.music.MBAlbum)2 Test (org.junit.Test)2 LastFmUser (com.github.hakko.musiccabinet.domain.model.library.LastFmUser)1 Track (com.github.hakko.musiccabinet.domain.model.music.Track)1 ApplicationException (com.github.hakko.musiccabinet.exception.ApplicationException)1 HttpResponseException (org.apache.http.client.HttpResponseException)1