use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcGroupWeeklyArtistChartDaoTest method createArtistMetaData.
private void createArtistMetaData() {
Set<Artist> artists = new HashSet<>();
for (int i = 0; i < 3; i++) {
artists.add(artistChart.getArtistPlayCounts().get(i).getArtist());
}
List<File> files = new ArrayList<>();
for (Artist artist : artists) {
files.add(getFile(artist.getName(), null, null));
}
List<ArtistInfo> artistInfos = new ArrayList<>();
for (Artist artist : artists) {
artistInfos.add(new ArtistInfo(artist, "/url/to/" + artist.getName()));
}
additionDao.getJdbcTemplate().execute("truncate library.directory cascade");
additionDao.getJdbcTemplate().execute("truncate library.artist cascade");
additionDao.getJdbcTemplate().execute("truncate music.groupweeklyartistchart cascade");
UnittestLibraryUtil.submitFile(additionDao, files);
artistInfoDao.createArtistInfo(artistInfos);
dao.createArtistCharts(Arrays.asList(artistChart));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist 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.Artist in project musiccabinet by hakko.
the class JdbcLibraryBrowserDaoAggregationTest method filterArtistsByGenre.
@Test
public void filterArtistsByGenre() {
String artist = artistName1, indieArtist = "Indie Artist", jazzArtist = "Jazz Artist";
String indie = "indie", jazz = "jazz";
submitFile(additionDao, UnittestLibraryUtil.getFile(artist, "Album", "Title"));
submitFile(additionDao, UnittestLibraryUtil.getFile(indieArtist, "Album", "Title"));
submitFile(additionDao, UnittestLibraryUtil.getFile(jazzArtist, "Album", "Title"));
topTagsDao.createTopTags(new Artist(indieArtist), Arrays.asList(new Tag("indie", (short) 100)));
topTagsDao.createTopTags(new Artist(jazzArtist), Arrays.asList(new Tag("jazz", (short) 60)));
List<Artist> allArtists = browserDao.getArtists();
Assert.assertEquals(3, allArtists.size());
List<Artist> indieArtists = browserDao.getArtists(indie, 90);
Assert.assertEquals(1, indieArtists.size());
Assert.assertEquals(indieArtist, indieArtists.get(0).getName());
List<Artist> jazzArtists = browserDao.getArtists(jazz, 70);
Assert.assertEquals(0, jazzArtists.size());
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist 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.Artist in project musiccabinet by hakko.
the class JdbcMusicBrainzAlbumDaoTest method prepareTestData.
@Before
public void prepareTestData() throws ApplicationException {
PostgreSQLUtil.loadFunction(albumDao, UPDATE_MB_ALBUM);
additionDao.getJdbcTemplate().execute("truncate music.artist cascade");
additionDao.getJdbcTemplate().execute("truncate library.file cascade");
artist = new Artist(ARTIST);
musicDao.setArtistId(artist);
album1 = new MBRelease(MBID1, null, null, TITLE1, TYPE1, YEAR1, null);
album2 = new MBRelease(MBID2, null, null, TITLE2, TYPE2, YEAR2, null);
album1.setArtistId(artist.getId());
album2.setArtistId(artist.getId());
albumDao.createAlbums(Arrays.asList(album1, album2));
}
Aggregations