use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class TagTopArtistsHandler method endElement.
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (ARTIST_NAME.equals(qName)) {
String chars = characterData.toString();
artists.add(new Artist(chars));
}
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist 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.Artist in project musiccabinet by hakko.
the class ArtistSimilarityClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = ArtistSimilarityClient.METHOD;
final String artistName = "madonna";
new ArtistSimilarityClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
Assert.assertEquals(Calltype.ARTIST_GET_SIMILAR, wi.getCallType());
Assert.assertTrue(artistName.equals(wi.getArtist().getName()));
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_ARTIST, artistName);
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getArtistSimilarity(new Artist(artistName));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class ArtistTopTracksClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = ArtistTopTracksClient.METHOD;
final String artistName = "madonna";
new ArtistTopTracksClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
Assert.assertEquals(Calltype.ARTIST_GET_TOP_TRACKS, wi.getCallType());
Assert.assertTrue(artistName.equals(wi.getArtist().getName()));
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_ARTIST, artistName);
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getTopTracks(new Artist(artistName));
}
use of com.github.hakko.musiccabinet.domain.model.music.Artist in project musiccabinet by hakko.
the class TrackSimilarityClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = TrackSimilarityClient.METHOD;
final String artistName = "madonna";
final String trackName = "ray of light";
new TrackSimilarityClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
assertEquals(Calltype.TRACK_GET_SIMILAR, wi.getCallType());
assertTrue(trackName.equals(wi.getTrack().getName()));
assertTrue(artistName.equals(wi.getTrack().getArtist().getName()));
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_ARTIST, artistName);
assertHasParameter(params, PARAM_TRACK, trackName);
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getTrackSimilarity(new Track(new Artist(artistName), trackName));
}
Aggregations