Search in sources :

Example 6 with Calltype

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));
}
Also used : Calltype(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype) LastFmUser(com.github.hakko.musiccabinet.domain.model.library.LastFmUser) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation) Test(org.junit.Test)

Example 7 with Calltype

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);
}
Also used : Calltype(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation) Test(org.junit.Test)

Example 8 with Calltype

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));
}
Also used : Calltype(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype) LastFmUser(com.github.hakko.musiccabinet.domain.model.library.LastFmUser) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation) Test(org.junit.Test)

Example 9 with Calltype

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));
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) Calltype(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation) Track(com.github.hakko.musiccabinet.domain.model.music.Track) Test(org.junit.Test)

Example 10 with Calltype

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));
}
Also used : Calltype(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation) Track(com.github.hakko.musiccabinet.domain.model.music.Track) Test(org.junit.Test)

Aggregations

WebserviceInvocation (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)19 Calltype (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype)19 Test (org.junit.Test)19 Artist (com.github.hakko.musiccabinet.domain.model.music.Artist)7 LastFmUser (com.github.hakko.musiccabinet.domain.model.library.LastFmUser)3 Track (com.github.hakko.musiccabinet.domain.model.music.Track)3 LastFmGroup (com.github.hakko.musiccabinet.domain.model.library.LastFmGroup)2 Tag (com.github.hakko.musiccabinet.domain.model.music.Tag)2 File (com.github.hakko.musiccabinet.domain.model.library.File)1 Date (java.util.Date)1 DateTime (org.joda.time.DateTime)1 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)1