use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype in project musiccabinet by hakko.
the class JdbcWebserviceHistoryDaoTest method differentUsersDontInterfere.
@Test
public void differentUsersDontInterfere() {
Calltype TOP_ARTISTS = Calltype.USER_GET_TOP_ARTISTS;
LastFmUser user1 = new LastFmUser("user1");
LastFmUser user2 = new LastFmUser("user2");
WebserviceInvocation topArtists1 = new WebserviceInvocation(TOP_ARTISTS, user1, OVERALL.getDays());
WebserviceInvocation topArtists2 = new WebserviceInvocation(TOP_ARTISTS, user2, OVERALL.getDays());
deleteWebserviceInvocations();
assertTrue(dao.isWebserviceInvocationAllowed(topArtists1));
assertTrue(dao.isWebserviceInvocationAllowed(topArtists2));
dao.logWebserviceInvocation(topArtists2);
assertTrue(dao.isWebserviceInvocationAllowed(topArtists1));
assertFalse(dao.isWebserviceInvocationAllowed(topArtists2));
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype 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.Calltype 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.Calltype 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.Calltype in project musiccabinet by hakko.
the class JdbcWebserviceHistoryDaoTest method importTrackSimilaritiesIsPossibleForCovers.
@Test
public void importTrackSimilaritiesIsPossibleForCovers() {
Calltype SIMILAR = Calltype.TRACK_GET_SIMILAR;
Track track1 = new Track("Daniel Johnston", "True Love Will Find You In The End");
Track track2 = new Track("Headless Heroes", "True Love Will Find You In The End");
WebserviceInvocation similarTrack1 = new WebserviceInvocation(SIMILAR, track1);
WebserviceInvocation similarTrack2 = new WebserviceInvocation(SIMILAR, track2);
deleteWebserviceInvocations();
assertTrue(dao.isWebserviceInvocationAllowed(similarTrack1));
assertTrue(dao.isWebserviceInvocationAllowed(similarTrack2));
dao.logWebserviceInvocation(similarTrack1);
assertFalse(dao.isWebserviceInvocationAllowed(similarTrack1));
assertTrue(dao.isWebserviceInvocationAllowed(similarTrack2));
dao.logWebserviceInvocation(similarTrack2);
assertFalse(dao.isWebserviceInvocationAllowed(similarTrack1));
assertFalse(dao.isWebserviceInvocationAllowed(similarTrack2));
}
Aggregations