Search in sources :

Example 11 with ResourceUtil

use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.

the class MusicBrainzServiceTest method getReleaseClient.

private ReleaseClient getReleaseClient() throws ApplicationException {
    ReleaseClient client = Mockito.mock(ReleaseClient.class);
    Mockito.when(client.get(artistName, mbid, 0)).thenReturn(new ResourceUtil("musicbrainz/xml/release-col.xml").getContent());
    return client;
}
Also used : ResourceUtil(com.github.hakko.musiccabinet.util.ResourceUtil) ReleaseClient(com.github.hakko.musiccabinet.ws.musicbrainz.ReleaseClient)

Example 12 with ResourceUtil

use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.

the class MusicBrainzServiceTest method getArtistQueryClient.

private ArtistQueryClient getArtistQueryClient() throws ApplicationException {
    ArtistQueryClient client = Mockito.mock(ArtistQueryClient.class);
    Mockito.when(client.get(artistName)).thenReturn(new ResourceUtil("musicbrainz/xml/artistQuery.xml").getContent());
    return client;
}
Also used : ResourceUtil(com.github.hakko.musiccabinet.util.ResourceUtil) ArtistQueryClient(com.github.hakko.musiccabinet.ws.musicbrainz.ArtistQueryClient)

Example 13 with ResourceUtil

use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.

the class JdbcArtistTopTagsDaoTest method loadFunctionDependencyAndTestdata.

@Before
public void loadFunctionDependencyAndTestdata() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_ARTISTTOPTAG);
    ArtistTopTagsParser cherParser = new ArtistTopTagsParserImpl(new ResourceUtil(CHER_TOP_TAGS).getInputStream());
    ArtistTopTagsParser rihannaParser = new ArtistTopTagsParserImpl(new ResourceUtil(RIHANNA_TOP_TAGS).getInputStream());
    cherArtist = cherParser.getArtist();
    cherTopTags = cherParser.getTopTags();
    rihannaArtist = rihannaParser.getArtist();
    rihannaTopTags = rihannaParser.getTopTags();
    PostgreSQLUtil.truncateTables(dao);
    musicDao.setArtistId(cherArtist);
    musicDao.setArtistId(rihannaArtist);
}
Also used : ArtistTopTagsParser(com.github.hakko.musiccabinet.parser.lastfm.ArtistTopTagsParser) ResourceUtil(com.github.hakko.musiccabinet.util.ResourceUtil) ArtistTopTagsParserImpl(com.github.hakko.musiccabinet.parser.lastfm.ArtistTopTagsParserImpl) Before(org.junit.Before)

Example 14 with ResourceUtil

use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.

the class JdbcGroupWeeklyArtistChartDaoTest method loadFunctionDependency.

@Before
public void loadFunctionDependency() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_GROUP_WEEKLY_ARTIST_CHART);
    PostgreSQLUtil.loadFunction(dao, UPDATE_LASTFMGROUP);
    artistChart = new GroupWeeklyArtistChart(brainwashed.getName(), new GroupWeeklyArtistChartParserImpl(new ResourceUtil(BRAINWASHED_FILE).getInputStream()).getArtistPlayCount());
    Collections.sort(artistChart.getArtistPlayCounts());
    createArtistMetaData();
}
Also used : ResourceUtil(com.github.hakko.musiccabinet.util.ResourceUtil) GroupWeeklyArtistChart(com.github.hakko.musiccabinet.domain.model.aggr.GroupWeeklyArtistChart) GroupWeeklyArtistChartParserImpl(com.github.hakko.musiccabinet.parser.lastfm.GroupWeeklyArtistChartParserImpl) Before(org.junit.Before)

Example 15 with ResourceUtil

use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.

the class ArtistInfoParserTest method resourceFileCorrectlyParsed.

@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
    ArtistInfoParser parser = new ArtistInfoParserImpl(new ResourceUtil(ARTIST_INFO_FILE).getInputStream());
    ArtistInfo artistInfo = parser.getArtistInfo();
    assertEquals(new Artist("ABBA"), artistInfo.getArtist());
    assertEquals(SMALL_IMAGE_URL, artistInfo.getSmallImageUrl());
    assertEquals(MEDIUM_IMAGE_URL, artistInfo.getMediumImageUrl());
    assertEquals(LARGE_IMAGE_URL, artistInfo.getLargeImageUrl());
    assertEquals(EXTRA_LARGE_IMAGE_URL, artistInfo.getExtraLargeImageUrl());
    assertEquals(LISTENERS, artistInfo.getListeners());
    assertEquals(PLAY_COUNT, artistInfo.getPlayCount());
    assertEquals(BIO_SUMMARY, artistInfo.getBioSummary());
    assertEquals(BIO_CONTENT, artistInfo.getBioContent());
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) ResourceUtil(com.github.hakko.musiccabinet.util.ResourceUtil) ArtistInfo(com.github.hakko.musiccabinet.domain.model.music.ArtistInfo) Test(org.junit.Test)

Aggregations

ResourceUtil (com.github.hakko.musiccabinet.util.ResourceUtil)45 Test (org.junit.Test)25 Before (org.junit.Before)7 HttpClient (org.apache.http.client.HttpClient)6 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)6 Track (com.github.hakko.musiccabinet.domain.model.music.Track)5 ResponseHandler (org.apache.http.client.ResponseHandler)5 File (com.github.hakko.musiccabinet.domain.model.library.File)4 Artist (com.github.hakko.musiccabinet.domain.model.music.Artist)4 ArtistInfo (com.github.hakko.musiccabinet.domain.model.music.ArtistInfo)4 StringUtil (com.github.hakko.musiccabinet.util.StringUtil)4 WSResponse (com.github.hakko.musiccabinet.ws.lastfm.WSResponse)4 ClientConnectionManager (org.apache.http.conn.ClientConnectionManager)4 LastFmUser (com.github.hakko.musiccabinet.domain.model.library.LastFmUser)3 MBArtist (com.github.hakko.musiccabinet.domain.model.music.MBArtist)3 ArtistTopTracksParserImpl (com.github.hakko.musiccabinet.parser.lastfm.ArtistTopTracksParserImpl)3 UnittestLibraryUtil.getFile (com.github.hakko.musiccabinet.util.UnittestLibraryUtil.getFile)3 ArrayList (java.util.ArrayList)3 UserLovedTracks (com.github.hakko.musiccabinet.domain.model.aggr.UserLovedTracks)2 UserStarredTrack (com.github.hakko.musiccabinet.domain.model.aggr.UserStarredTrack)2