Examples of ArtistInfo


Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

    deleteArtistInfos();

    int abbaId = musicDao.getArtistId(aiAbba.getArtist());

    dao.createArtistInfo(Arrays.asList(aiAbba));
    ArtistInfo dbAbba = dao.getArtistInfo(abbaId);
   
    Assert.assertEquals(ABBA_IMAGE_URL, dbAbba.getLargeImageUrl());
    Assert.assertEquals(ABBA_BIO_SUMMARY, dbAbba.getBioSummary());
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

    String biography = "new ABBA biography";

    dao.createArtistInfo(Arrays.asList(aiAbba));
    dao.setBioSummary(abbaId, biography);
   
    ArtistInfo dbAbba = dao.getArtistInfo(abbaId);
   
    Assert.assertEquals(biography, dbAbba.getBioSummary());
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

    deleteArtistInfos();

    int tinaId = musicDao.getArtistId(aiTina.getArtist());

    dao.createArtistInfo(Arrays.asList(aiTina));
    ArtistInfo artistInfo = dao.getDetailedArtistInfo(tinaId);
   
    Assert.assertNotNull(artistInfo);
    Assert.assertNotNull(artistInfo.getArtist());
    Assert.assertNotNull(artistInfo.getBioContent());
   
    Assert.assertEquals("Tina Turner", artistInfo.getArtist().getName());
    Assert.assertEquals("http://userserve-ak.last.fm/serve/126/74998404.jpg",
        artistInfo.getLargeImageUrl());
    Assert.assertTrue(artistInfo.getBioContent().startsWith("<strong>Tina Turner</strong>"));
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

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

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

  @Test
  public void emptyFileReturnsEmptyInfo() throws ApplicationException {
    ArtistInfoParser parser = new ArtistInfoParserImpl(
        new ResourceUtil(EMPTY_ARTIST_INFO_FILE).getInputStream());
   
    ArtistInfo artistInfo = parser.getArtistInfo();
   
    Assert.assertNull(artistInfo);
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

  public void endElement(String uri, String localName, String qName)
  throws SAXException {
    if (parsing) {
      String chars = characterData.toString();
      if (TAG_NAME.equals(qName) && artistInfo == null) {
        artistInfo = new ArtistInfo();
        artistInfo.setArtist(new Artist(chars));
      } else if (TAG_IMAGE.equals(qName)) {
        if (ATTR_SMALL.equals(imageSize)) {
          artistInfo.setSmallImageUrl(chars);
        } else if (ATTR_MEDIUM.equals(imageSize)) {
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

  private static final int BATCH_SIZE = 1000;
 
  private static final Logger LOG = Logger.getLogger(ArtistInfoService.class);
 
  public ArtistInfo getArtistInfo(int artistId) {
    ArtistInfo artistInfo = artistInfoDao.getArtistInfo(artistId);
    if (artistInfo == null) {
      LOG.info("No artist info found for id " + artistId);
    }
    return artistInfo;
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

   
    List<ArtistInfo> artistInfos = jdbcTemplate.query(sql, new RowMapper<ArtistInfo>() {
      @Override
      public ArtistInfo mapRow(ResultSet rs, int rowNum)
          throws SQLException {
        ArtistInfo ai = new ArtistInfo();
        ai.setArtist(new Artist(artistId, rs.getString(1)));
        ai.setLargeImageUrl(rs.getString(2));
        ai.setBioSummary(rs.getString(3));
        ai.setInSearchIndex(rs.getBoolean(4));
        return ai;
      }
    });
   
    return artistInfos.isEmpty() ? null : artistInfos.get(0);
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

   
    List<ArtistInfo> artistInfos = jdbcTemplate.query(sql, new RowMapper<ArtistInfo>() {
      @Override
      public ArtistInfo mapRow(ResultSet rs, int rowNum)
          throws SQLException {
        ArtistInfo ai = new ArtistInfo();
        ai.setArtist(new Artist(artistId, rs.getString(1)));
        ai.setLargeImageUrl(rs.getString(2));
        ai.setBioContent(rs.getString(3));
        return ai;
      }
    });
   
    return artistInfos.isEmpty() ? null : artistInfos.get(0);
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.music.ArtistInfo

        "select ai.smallimageurl, ai.mediumimageurl, ai.largeimageurl, ai.extralargeimageurl, " +
        "ai.listeners, ai.playcount, ai.biosummary, ai.biocontent from music.artistinfo ai" +
        " inner join music.artist a on ai.artist_id = a.id" +
        " where a.artist_name = upper(?)";

    ArtistInfo artistInfo = jdbcTemplate.queryForObject(sql, new Object[]{artist.getName()},
        new RowMapper<ArtistInfo>() {
      @Override
      public ArtistInfo mapRow(ResultSet rs, int rowNum)
          throws SQLException {
        ArtistInfo ai = new ArtistInfo();
        ai.setArtist(artist);
        ai.setSmallImageUrl(rs.getString(1));
        ai.setMediumImageUrl(rs.getString(2));
        ai.setLargeImageUrl(rs.getString(3));
        ai.setExtraLargeImageUrl(rs.getString(4));
        ai.setListeners(rs.getInt(5));
        ai.setPlayCount(rs.getInt(6));
        ai.setBioSummary(rs.getString(7));
        ai.setBioContent(rs.getString(8));
        return ai;
      }
     
    });
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.