use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcTagDaoTest method tagsWithTopArtistsAreNotPickedForUpdate.
@Test
public void tagsWithTopArtistsAreNotPickedForUpdate() {
deleteTags();
List<String> tagNames = Arrays.asList("disco", "sludge");
dao.createTags(tagNames);
dao.setTopTags(tagNames);
List<TagTopArtists> topArtists = Arrays.asList(new TagTopArtists("disco", asList(new Artist("Madonna"))));
dao.createTopArtists(topArtists);
List<Tag> tags = dao.getTagsWithoutTopArtists();
Assert.assertEquals(1, tags.size());
Assert.assertEquals("sludge", tags.get(0).getName());
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcArtistRecommendationDaoTest method createTestData.
@Before
public void createTestData() throws ApplicationException {
PostgreSQLUtil.truncateTables(artistRecommendationDao);
List<ArtistRelation> artistRelations = new ArrayList<>();
for (Artist targetArtist : asList(madonna, cyndi, celine, kylie)) {
artistRelations.add(new ArtistRelation(targetArtist, 0.33f));
}
artistRelationDao.createArtistRelations(cher, artistRelations);
tagDao.createTags(asList("disco"));
tagDao.createTopArtists(Arrays.asList(new TagTopArtists("disco", Arrays.asList(cher, madonna, cyndi, celine, kylie))));
Track track1, track2, track3;
artistTopTracksDao.createTopTracks(madonna, Arrays.asList(track1 = new Track(madonna, "Like A Prayer"), track2 = new Track(madonna, "Hung Up"), new Track(madonna, "Frozen")));
artistTopTracksDao.createTopTracks(cyndi, Arrays.asList(track3 = new Track(cyndi, "Time After Time"), new Track(cyndi, "Girls Just Wanna Have Fun")));
artistTopTracksDao.createTopTracks(celine, Arrays.asList(new Track(celine, "My Heart Will Go On")));
artistTopTracksDao.createTopTracks(kylie, Arrays.asList(new Track(kylie, "Love At First Sight")));
List<File> files = new ArrayList<>();
for (Track track : Arrays.asList(track1, track2, track3)) {
files.add(getFile(track));
}
UnittestLibraryUtil.submitFile(additionDao, files);
playlistGeneratorService.updateSearchIndex();
cherId = musicDao.getArtistId(cher);
List<ArtistInfo> artistInfos = new ArrayList<>();
for (Artist artist : Arrays.asList(madonna, cyndi, celine, kylie)) {
artistInfos.add(new ArtistInfo(artist, "/image/for/" + artist.getName()));
}
artistInfoDao.createArtistInfo(artistInfos);
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcArtistRecommendationDaoTest method validateRelatedArtistsInLibrary.
@Test
public void validateRelatedArtistsInLibrary() {
List<ArtistRecommendation> relatedArtists = artistRecommendationDao.getRelatedArtistsInLibrary(cherId, 10, true);
Assert.assertNotNull(relatedArtists);
Assert.assertEquals(2, relatedArtists.size());
List<Artist> artists = Arrays.asList(new Artist(relatedArtists.get(0).getArtistName()), new Artist(relatedArtists.get(1).getArtistName()));
Assert.assertTrue(artists.contains(madonna));
Assert.assertTrue(artists.contains(cyndi));
Assert.assertFalse(artists.contains(cher));
Assert.assertFalse(artists.contains(celine));
Assert.assertFalse(artists.contains(kylie));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcUserTopArtistsDaoTest method createArtistMetaData.
private void createArtistMetaData() {
Set<Artist> artists = new HashSet<>();
for (UserTopArtists uta : Arrays.asList(arnOverall, arn6month, sys3month)) {
for (Artist artist : uta.getArtists()) {
artists.add(artist);
}
}
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.file cascade");
UnittestLibraryUtil.submitFile(additionDao, files);
artistInfoDao.createArtistInfo(artistInfos);
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class ReleaseGroupsClient method get.
public String get(String artistName, String mbid, int offset) throws ApplicationException {
WebserviceInvocation invocation = new WebserviceInvocation(MB_RELEASE_GROUPS, new Artist(artistName));
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair(QUERY, format(PATTERN, mbid)));
params.add(new BasicNameValuePair(LIMIT, HUNDRED));
params.add(new BasicNameValuePair(OFFSET, valueOf(offset)));
return executeWSRequest(invocation, PATH, params);
}
Aggregations