Search in sources :

Example 1 with UpdateNowPlayingClient

use of com.github.hakko.musiccabinet.ws.lastfm.UpdateNowPlayingClient in project musiccabinet by hakko.

the class ScrobbleServiceTest method createTestData.

@Before
public void createTestData() throws ApplicationException {
    scrobbleService = new ScrobbleService();
    UpdateNowPlayingClient nowPlayinglient = mock(UpdateNowPlayingClient.class);
    when(nowPlayinglient.updateNowPlaying(Mockito.any(Scrobble.class))).thenReturn(new WSResponse(false, 404, "Not found"));
    scrobbleService.setUpdateNowPlayingClient(nowPlayinglient);
    ScrobbleClient scrobbleClient = mock(ScrobbleClient.class);
    when(scrobbleClient.scrobble(Mockito.any(Scrobble.class))).thenReturn(new WSResponse("<lfm status=\"ok\"></lfm>"));
    scrobbleService.setScrobbleClient(scrobbleClient);
    PlayCountDao playCountDao = mock(PlayCountDao.class);
    scrobbleService.setPlayCountDao(playCountDao);
    MetaData metaData1 = new MetaData();
    metaData1.setArtist("artist 1");
    metaData1.setArtistId(artist1Id);
    metaData1.setAlbum("album 1");
    metaData1.setAlbumId(album1Id);
    track1 = new Track(track1Id, "track 1", metaData1);
    track2 = new Track(track2Id, "track 2", metaData1);
    user1 = new LastFmUser(username1, sessionKey1);
    user2 = new LastFmUser(username2, sessionKey2);
}
Also used : ScrobbleClient(com.github.hakko.musiccabinet.ws.lastfm.ScrobbleClient) MetaData(com.github.hakko.musiccabinet.domain.model.library.MetaData) UpdateNowPlayingClient(com.github.hakko.musiccabinet.ws.lastfm.UpdateNowPlayingClient) LastFmUser(com.github.hakko.musiccabinet.domain.model.library.LastFmUser) Scrobble(com.github.hakko.musiccabinet.domain.model.aggr.Scrobble) WSResponse(com.github.hakko.musiccabinet.ws.lastfm.WSResponse) Track(com.github.hakko.musiccabinet.domain.model.music.Track) PlayCountDao(com.github.hakko.musiccabinet.dao.PlayCountDao) Before(org.junit.Before)

Aggregations

PlayCountDao (com.github.hakko.musiccabinet.dao.PlayCountDao)1 Scrobble (com.github.hakko.musiccabinet.domain.model.aggr.Scrobble)1 LastFmUser (com.github.hakko.musiccabinet.domain.model.library.LastFmUser)1 MetaData (com.github.hakko.musiccabinet.domain.model.library.MetaData)1 Track (com.github.hakko.musiccabinet.domain.model.music.Track)1 ScrobbleClient (com.github.hakko.musiccabinet.ws.lastfm.ScrobbleClient)1 UpdateNowPlayingClient (com.github.hakko.musiccabinet.ws.lastfm.UpdateNowPlayingClient)1 WSResponse (com.github.hakko.musiccabinet.ws.lastfm.WSResponse)1 Before (org.junit.Before)1