Search in sources :

Example 1 with TagUpdateClient

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

the class TagUpdateServiceTest method updatesWithinThresholdsAreIgnored.

@Test
public void updatesWithinThresholdsAreIgnored() throws ApplicationException {
    ArtistTopTagsDao artistTopTagsDao = mock(ArtistTopTagsDao.class);
    tagUpdateService.setArtistTopTagsDao(artistTopTagsDao);
    setClientResponse(responseOK);
    TagUpdateClient tagUpdateClient = tagUpdateService.tagUpdateClient;
    WebserviceHistoryService historyService = mock(WebserviceHistoryService.class);
    tagUpdateService.setWebserviceHistoryService(historyService);
    tagUpdateService.register(artist1Addition);
    tagUpdateService.register(artist2Removal);
    tagUpdateService.register(artist3Addition);
    tagUpdateService.updateTags();
    verify(tagUpdateClient, times(1)).updateTag(artist1Addition);
    verify(tagUpdateClient, times(1)).updateTag(artist2Removal);
    verify(tagUpdateClient, times(0)).updateTag(artist3Addition);
}
Also used : TagUpdateClient(com.github.hakko.musiccabinet.ws.lastfm.TagUpdateClient) WebserviceHistoryService(com.github.hakko.musiccabinet.service.lastfm.WebserviceHistoryService) ArtistTopTagsDao(com.github.hakko.musiccabinet.dao.ArtistTopTagsDao) Test(org.junit.Test)

Example 2 with TagUpdateClient

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

the class TagUpdateServiceTest method setClientResponse.

private void setClientResponse(WSResponse response) throws ApplicationException {
    TagUpdateClient tagUpdateClient = mock(TagUpdateClient.class);
    when(tagUpdateClient.updateTag(any(ArtistUserTag.class))).thenReturn(response);
    tagUpdateService.setTagUpdateClient(tagUpdateClient);
}
Also used : ArtistUserTag(com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag) TagUpdateClient(com.github.hakko.musiccabinet.ws.lastfm.TagUpdateClient)

Aggregations

TagUpdateClient (com.github.hakko.musiccabinet.ws.lastfm.TagUpdateClient)2 ArtistTopTagsDao (com.github.hakko.musiccabinet.dao.ArtistTopTagsDao)1 ArtistUserTag (com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag)1 WebserviceHistoryService (com.github.hakko.musiccabinet.service.lastfm.WebserviceHistoryService)1 Test (org.junit.Test)1