use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class JdbcWebserviceHistoryDaoTest method trackNullThrowsException.
@Test(expected = IllegalArgumentException.class)
public void trackNullThrowsException() {
Calltype SIMILAR = Calltype.TRACK_GET_SIMILAR;
new WebserviceInvocation(SIMILAR, (Track) null);
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class JdbcWebserviceHistoryDaoTest method periodIsSignificantForAllowance.
@Test
public void periodIsSignificantForAllowance() {
Calltype TOP_ARTISTS = Calltype.USER_GET_TOP_ARTISTS;
LastFmUser user = new LastFmUser("arnathalon");
WebserviceInvocation topArtists1 = new WebserviceInvocation(TOP_ARTISTS, user, OVERALL.getDays());
WebserviceInvocation topArtists2 = new WebserviceInvocation(TOP_ARTISTS, user, SIX_MONTHS.getDays());
deleteWebserviceInvocations();
assertTrue(dao.isWebserviceInvocationAllowed(topArtists1));
assertTrue(dao.isWebserviceInvocationAllowed(topArtists2));
dao.logWebserviceInvocation(topArtists1);
assertFalse(dao.isWebserviceInvocationAllowed(topArtists1));
assertTrue(dao.isWebserviceInvocationAllowed(topArtists2));
dao.logWebserviceInvocation(topArtists2);
assertFalse(dao.isWebserviceInvocationAllowed(topArtists1));
assertFalse(dao.isWebserviceInvocationAllowed(topArtists2));
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class JdbcWebserviceHistoryDaoTest method importTrackSimilaritiesIsNotPossibleTwice.
@Test
public void importTrackSimilaritiesIsNotPossibleTwice() {
Calltype SIMILAR = Calltype.TRACK_GET_SIMILAR;
Artist artist = new Artist("Bill Fay");
Track track1 = new Track(artist, "Omega");
Track track2 = new Track(artist, "Don't let my marigolds die");
WebserviceInvocation similarTrack1 = new WebserviceInvocation(SIMILAR, track1);
WebserviceInvocation similarTrack2 = new WebserviceInvocation(SIMILAR, track2);
deleteWebserviceInvocations();
assertTrue(dao.isWebserviceInvocationAllowed(similarTrack1));
assertTrue(dao.isWebserviceInvocationAllowed(similarTrack2));
dao.logWebserviceInvocation(similarTrack2);
assertTrue(dao.isWebserviceInvocationAllowed(similarTrack1));
assertFalse(dao.isWebserviceInvocationAllowed(similarTrack2));
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class UserRecommendedArtistsClient method getUserRecommendedArtists.
public WSResponse getUserRecommendedArtists(String lastFmUsername) throws ApplicationException {
LastFmUser user = lastFmDao.getLastFmUser(lastFmUsername);
WebserviceInvocation webserviceInvocation = new WebserviceInvocation(USER_GET_RECOMMENDED_ARTISTS, user);
List<NameValuePair> params = getDefaultParameterList();
params.add(new BasicNameValuePair(PARAM_METHOD, METHOD));
params.add(new BasicNameValuePair(PARAM_LIMIT, "100"));
params.add(new BasicNameValuePair(PARAM_SK, user.getSessionKey()));
return executeWSRequest(webserviceInvocation, params);
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class UserTopArtistsClient method getUserTopArtists.
public WSResponse getUserTopArtists(LastFmUser user, Period period) throws ApplicationException {
WebserviceInvocation webserviceInvocation = new WebserviceInvocation(USER_GET_TOP_ARTISTS, user, period.getDays());
List<NameValuePair> params = getDefaultParameterList();
params.add(new BasicNameValuePair(PARAM_METHOD, METHOD));
params.add(new BasicNameValuePair(PARAM_USER, user.getLastFmUsername()));
params.add(new BasicNameValuePair(PARAM_PERIOD, period.getDescription()));
return executeWSRequest(webserviceInvocation, params);
}
Aggregations