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));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcStarDaoTest method prepareTestData.
@Before
public void prepareTestData() throws ApplicationException {
PostgreSQLUtil.loadFunction(starDao, ADD_TO_LIBRARY);
starDao.getJdbcTemplate().execute("truncate music.artist cascade");
starDao.getJdbcTemplate().execute("truncate library.file cascade");
submitFile(additionDao, UnittestLibraryUtil.getFile(artistName1, albumName1, trackName1));
submitFile(additionDao, UnittestLibraryUtil.getFile(artistName2, albumName2, trackName2));
List<Artist> artists = browserDao.getArtists();
Assert.assertEquals(2, artists.size());
album1 = browserDao.getAlbums((artist1 = artists.get(0)).getId(), true).get(0);
album2 = browserDao.getAlbums((artist2 = artists.get(1)).getId(), true).get(0);
track1 = browserDao.getTracks(album1.getTrackIds()).get(0);
track2 = browserDao.getTracks(album2.getTrackIds()).get(0);
lastFmUser1 = new LastFmUser(user1);
lastFmDao.createOrUpdateLastFmUser(lastFmUser1);
lastFmUser2 = new LastFmUser(user2);
lastFmDao.createOrUpdateLastFmUser(lastFmUser2);
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcTagDaoTest method retrievesCorrectedAvailableTags.
@Test
public void retrievesCorrectedAvailableTags() {
deleteTags();
for (int i = 0; i < 5; i++) {
artistTopTagsDao.createTopTags(new Artist("artist" + i), Arrays.asList(new Tag("sludge", (short) 100), new Tag("drone", (short) 90), new Tag("e-l-e-c-t-r-o", (short) 50), new Tag("disco", (short) 10)));
}
Map<String, String> tagCorrections = new HashMap<>();
tagCorrections.put("e-l-e-c-t-r-o", "electro");
dao.createTagCorrections(tagCorrections);
dao.setTopTags(Arrays.asList("sludge"));
List<TagOccurrence> tags = dao.getAvailableTags();
Assert.assertEquals(3, tags.size());
Assert.assertEquals("drone", tags.get(0).getTag());
Assert.assertEquals("e-l-e-c-t-r-o", tags.get(1).getTag());
Assert.assertEquals("electro", tags.get(1).getCorrectedTag());
Assert.assertEquals("sludge", tags.get(2).getTag());
Assert.assertFalse(tags.get(0).isUse());
Assert.assertFalse(tags.get(1).isUse());
Assert.assertTrue(tags.get(2).isUse());
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class JdbcWebserviceHistoryDaoTest method clearsLanguageSpecificWebserviceInvocations.
@Test
public void clearsLanguageSpecificWebserviceInvocations() {
Artist artist = new Artist("ABBA");
WebserviceInvocation wiInfo = new WebserviceInvocation(ARTIST_GET_INFO, artist);
WebserviceInvocation wiSimilar = new WebserviceInvocation(ARTIST_GET_SIMILAR, artist);
dao.logWebserviceInvocation(wiInfo);
dao.logWebserviceInvocation(wiSimilar);
Assert.assertFalse(dao.isWebserviceInvocationAllowed(wiInfo));
Assert.assertFalse(dao.isWebserviceInvocationAllowed(wiSimilar));
dao.clearLanguageSpecificWebserviceInvocations();
Assert.assertTrue(dao.isWebserviceInvocationAllowed(wiInfo));
Assert.assertFalse(dao.isWebserviceInvocationAllowed(wiSimilar));
}
Aggregations