use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class JdbcLibraryBrowserDaoAggregationTest method prepareTestData.
@Before
public void prepareTestData() throws ApplicationException {
PostgreSQLUtil.loadFunction(browserDao, ADD_TO_LIBRARY);
browserDao.getJdbcTemplate().execute("truncate music.artist cascade");
browserDao.getJdbcTemplate().execute("truncate library.file cascade");
submitFile(additionDao, UnittestLibraryUtil.getFile(artistName1, albumName1, trackName1));
submitFile(additionDao, UnittestLibraryUtil.getFile(artistName1, albumName2, trackName1));
List<Artist> artists = browserDao.getArtists();
Assert.assertEquals(1, artists.size());
artist1 = artists.get(0);
List<Album> albums = browserDao.getAlbums(artists.get(0).getId(), true);
Assert.assertEquals(2, albums.size());
Assert.assertEquals(1, albums.get(0).getTrackIds().size());
Assert.assertEquals(1, albums.get(1).getTrackIds().size());
Collections.sort(albums, getAlbumComparator());
album1 = albums.get(0);
album2 = albums.get(1);
track1 = browserDao.getTracks(album1.getTrackIds()).get(0);
track2 = browserDao.getTracks(album2.getTrackIds()).get(0);
user1 = new LastFmUser(userName1);
lastFmDao.createOrUpdateLastFmUser(user1);
user2 = new LastFmUser(userName2);
lastFmDao.createOrUpdateLastFmUser(user2);
artistInfoDao.createArtistInfo(asList(new ArtistInfo(new Artist(artistName1), "img")));
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class ArtistInfoParserTest method resourceFileCorrectlyParsed.
@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
ArtistInfoParser parser = new ArtistInfoParserImpl(new ResourceUtil(ARTIST_INFO_FILE).getInputStream());
ArtistInfo artistInfo = parser.getArtistInfo();
assertEquals(new Artist("ABBA"), artistInfo.getArtist());
assertEquals(SMALL_IMAGE_URL, artistInfo.getSmallImageUrl());
assertEquals(MEDIUM_IMAGE_URL, artistInfo.getMediumImageUrl());
assertEquals(LARGE_IMAGE_URL, artistInfo.getLargeImageUrl());
assertEquals(EXTRA_LARGE_IMAGE_URL, artistInfo.getExtraLargeImageUrl());
assertEquals(LISTENERS, artistInfo.getListeners());
assertEquals(PLAY_COUNT, artistInfo.getPlayCount());
assertEquals(BIO_SUMMARY, artistInfo.getBioSummary());
assertEquals(BIO_CONTENT, artistInfo.getBioContent());
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class ArtistInfoParserTest method emptyFileReturnsEmptyInfo.
@Test
public void emptyFileReturnsEmptyInfo() throws ApplicationException {
ArtistInfoParser parser = new ArtistInfoParserImpl(new ResourceUtil(EMPTY_ARTIST_INFO_FILE).getInputStream());
ArtistInfo artistInfo = parser.getArtistInfo();
Assert.assertNull(artistInfo);
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class JdbcArtistInfoDaoTest method createAndValidateArtistInfos.
@Test
public void createAndValidateArtistInfos() throws ApplicationException {
deleteArtistInfos();
List<ArtistInfo> artistInfos = new ArrayList<>();
artistInfos.add(aiAbba);
artistInfos.add(aiCher);
dao.createArtistInfo(artistInfos);
ArtistInfo dbAbba = dao.getArtistInfo(aiAbba.getArtist());
ArtistInfo dbCher = dao.getArtistInfo(aiCher.getArtist());
Assert.assertEquals(aiAbba, dbAbba);
Assert.assertEquals(aiCher, dbCher);
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class JdbcArtistInfoDaoTest method biographyAndImageUrlAreReturnedAsInfo.
@Test
public void biographyAndImageUrlAreReturnedAsInfo() throws ApplicationException {
deleteArtistInfos();
int abbaId = musicDao.getArtistId(aiAbba.getArtist());
dao.createArtistInfo(Arrays.asList(aiAbba));
ArtistInfo dbAbba = dao.getArtistInfo(abbaId);
Assert.assertEquals(ABBA_IMAGE_URL, dbAbba.getLargeImageUrl());
Assert.assertEquals(ABBA_BIO_SUMMARY, dbAbba.getBioSummary());
}
Aggregations