use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class JdbcArtistInfoDaoTest method bioSummaryCanBeUpdated.
@Test
public void bioSummaryCanBeUpdated() {
deleteArtistInfos();
int abbaId = musicDao.getArtistId(aiAbba.getArtist());
String biography = "new ABBA biography";
dao.createArtistInfo(Arrays.asList(aiAbba));
dao.setBioSummary(abbaId, biography);
ArtistInfo dbAbba = dao.getArtistInfo(abbaId);
Assert.assertEquals(biography, dbAbba.getBioSummary());
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class JdbcArtistInfoDaoTest method loadFunctionDependency.
@Before
public void loadFunctionDependency() throws ApplicationException {
PostgreSQLUtil.loadFunction(dao, UPDATE_ARTISTINFO);
aiAbba = new ArtistInfoParserImpl(new ResourceUtil(AI_ABBA_FILE).getInputStream()).getArtistInfo();
aiCher = new ArtistInfoParserImpl(new ResourceUtil(AI_CHER_FILE).getInputStream()).getArtistInfo();
aiTina = new ArtistInfoParserImpl(new ResourceUtil(AI_TINA_FILE).getInputStream()).getArtistInfo();
deleteArtists();
// re-create artists
for (ArtistInfo ai : new ArtistInfo[] { aiAbba, aiCher, aiTina }) {
musicDao.getArtistId(ai.getArtist());
}
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class UserTopArtistsServiceTest method createArtistInfosAndLocalFiles.
private void createArtistInfosAndLocalFiles() throws ApplicationException {
Map<Artist, ArtistInfo> artistInfos = new HashMap<>();
List<File> files = new ArrayList<>();
for (Period period : Period.values()) {
String fileName = format(TOP_ARTISTS_FILE, period.getDescription());
for (Artist artist : new UserTopArtistsParserImpl(new ResourceUtil(fileName, UTF8).getInputStream()).getArtists()) {
artistInfos.put(artist, new ArtistInfo(artist));
files.add(UnittestLibraryUtil.getFile(artist.getName(), "A", "T"));
}
}
artistInfoDao.createArtistInfo(new ArrayList<ArtistInfo>(artistInfos.values()));
submitFile(additionDao, files);
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class ArtistInfoServiceTest method canInvokeService.
@Test
public void canInvokeService() throws ApplicationException {
String artistName = "A Previously Unknown Artist";
int artistId = musicDao.getArtistId(artistName);
ArtistInfo artistInfo = aiService.getArtistInfo(artistId);
Assert.assertNotNull(artistInfo);
Assert.assertEquals(artistName, artistInfo.getArtist().getName());
}
use of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo in project musiccabinet by hakko.
the class ArtistInfoHandler method endElement.
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (parsing) {
String chars = characterData.toString();
if (TAG_NAME.equals(qName) && artistInfo == null) {
artistInfo = new ArtistInfo();
artistInfo.setArtist(new Artist(chars));
} else if (TAG_IMAGE.equals(qName)) {
if (ATTR_SMALL.equals(imageSize)) {
artistInfo.setSmallImageUrl(chars);
} else if (ATTR_MEDIUM.equals(imageSize)) {
artistInfo.setMediumImageUrl(chars);
} else if (ATTR_LARGE.equals(imageSize)) {
artistInfo.setLargeImageUrl(chars);
} else if (ATTR_EXTRA_LARGE.equals(imageSize)) {
artistInfo.setExtraLargeImageUrl(chars);
}
} else if (TAG_LISTENERS.equals(qName)) {
artistInfo.setListeners(toInt(chars));
} else if (TAG_PLAY_COUNT.equals(qName)) {
artistInfo.setPlayCount(toInt(chars));
parsing = false;
}
}
if (TAG_BIO_SUMMARY.equals(qName)) {
artistInfo.setBioSummary(stripLicenseAndReadMoreLink(characterData.toString(), artistInfo.getArtist().getName()));
} else if (TAG_BIO_CONTENT.equals(qName)) {
artistInfo.setBioContent(stripLicenseAndReadMoreLink(characterData.toString(), artistInfo.getArtist().getName()));
}
}
Aggregations