Examples of ResourceUtil


Examples of com.github.hakko.musiccabinet.util.ResourceUtil

  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;
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

    UserTopArtistsClient userTopArtistsClient = mock(UserTopArtistsClient.class);
    for (Period period : Period.values()) {
      String fileName = format(TOP_ARTISTS_FILE, period.getDescription());
      when(userTopArtistsClient.getUserTopArtists(user1, period)).thenReturn(
          new WSResponse(new ResourceUtil(fileName, UTF8).getContent()));
      when(userTopArtistsClient.getUserTopArtists(user2, period)).thenReturn(
          new WSResponse(false, 403, "Forbidden"));
    }

    UserTopArtistsService userTopArtistsService = new UserTopArtistsService();
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

    Map<Artist, ArtistInfo> artistInfos = new HashMap<>();
    List<File> files = new ArrayList<>();
    for (Period period : Period.values()) {
      String fileName = format(TOP_ARTISTS_FILE, period.getDescription());
      for (Artist artist : new UserTopArtistsParserImpl(
          new ResourceUtil(fileName, UTF8).getInputStream()).getArtists()) {
        artistInfos.put(artist, new ArtistInfo(artist));
        files.add(UnittestLibraryUtil.getFile(artist.getName(), "A", "T"));
      }
    }
    artistInfoDao.createArtistInfo(new ArrayList<ArtistInfo>(artistInfos.values()));
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

 
  @Before
  public void loadFunctionDependency() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_TAGINFO);
   
    tiDisco = new TagInfoParserImpl(new ResourceUtil(
        TI_DISCO_FILE).getInputStream()).getTagInfo();
    tiPop = new TagInfoParserImpl(new ResourceUtil(
        TI_POP_FILE).getInputStream()).getTagInfo();
    tiSludge = new TagInfoParserImpl(new ResourceUtil(
        TI_SLUDGE_FILE).getInputStream()).getTagInfo();

    deleteTags();
   
    tagDao.createTags(Arrays.asList(tiDisco.getTagName(),
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

  private ArtistTopTracksClient getArtistTopTracksClient(WebserviceHistoryService historyService) throws IOException {
    // create a HTTP client that always returns Cher top tracks
    HttpClient httpClient = mock(HttpClient.class);
    ClientConnectionManager connectionManager = mock(ClientConnectionManager.class);
    when(httpClient.getConnectionManager()).thenReturn(connectionManager);
    String httpResponse = new ResourceUtil(CHER_TOP_TRACKS).getContent();
    when(httpClient.execute(Mockito.any(HttpUriRequest.class),
        Mockito.any(ResponseHandler.class))).thenReturn(httpResponse);
   
    // create a throttling service that allows calls at any rate
    ThrottleService throttleService = mock(ThrottleService.class);
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

  @Before
  public void loadFunctionDependency() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_USER_TOP_ARTISTS);

    arnOverall = new UserTopArtists(arn, Period.OVERALL,
        new UserTopArtistsParserImpl(new ResourceUtil(
            ARN_OVERALL_FILE).getInputStream()).getArtists());
    arn6month = new UserTopArtists(arn, Period.SIX_MONTHS,
        new UserTopArtistsParserImpl(new ResourceUtil(
            ARN_6MONTH_FILE).getInputStream()).getArtists());
    sys3month = new UserTopArtists(sys, Period.THREE_MONTHS,
        new UserTopArtistsParserImpl(new ResourceUtil(
            SYS_3MONTH_FILE).getInputStream()).getArtists());

    createArtistMetaData();
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

  @Before
  public void loadFunctionDependency() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_USER_RECOMMENDED_ARTISTS);

    joanRec = new UserRecommendedArtists(joan,
        new UserRecommendedArtistsParserImpl(new ResourceUtil(
            JOAN_FILE).getInputStream()).getArtists());

    rjRec = new UserRecommendedArtists(rj,
        new UserRecommendedArtistsParserImpl(new ResourceUtil(
            RJ_FILE).getInputStream()).getArtists());

    String body = new WSResponse(new ResourceUtil(FTPAREA_FILE).getContent()).getResponseBody();
    ftpareaRec = new UserRecommendedArtists(ftparea,
        new UserRecommendedArtistsParserImpl(new StringUtil(
            body).getInputStream()).getArtists());

    createArtistMetaData();
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

  @Before
  public void loadFunctionDependencyAndTestdata() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_ARTISTTOPTRACK);

    ArtistTopTracksParser cherParser = new ArtistTopTracksParserImpl(
        new ResourceUtil(CHER_TOP_TRACKS).getInputStream());
    ArtistTopTracksParser rihannaParser = new ArtistTopTracksParserImpl(
        new ResourceUtil(RIHANNA_TOP_TRACKS).getInputStream());
    cherArtist = cherParser.getArtist();
    rihannaArtist = rihannaParser.getArtist();
    cherTopTracks = cherParser.getTopTracks();
    rihannaTopTracks = rihannaParser.getTopTracks();
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

  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();
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.ResourceUtil

  @Before
  public void loadFunctionDependency() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_ARTISTINFO);
   
    aiAbba = new ArtistInfoParserImpl(new ResourceUtil(
        AI_ABBA_FILE).getInputStream()).getArtistInfo();
    aiCher = new ArtistInfoParserImpl(new ResourceUtil(
        AI_CHER_FILE).getInputStream()).getArtistInfo();
    aiTina = new ArtistInfoParserImpl(new ResourceUtil(
        AI_TINA_FILE).getInputStream()).getArtistInfo();
   
    deleteArtists();

    // re-create artists
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.