Package com.github.hakko.musiccabinet.domain.model.music

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


    artist2 = artists.get(1);
  }

  @Test
  public void createsArtists() {
    artistDao.createArtists(Arrays.asList(new MBArtist(artist1.getName(),
        MBID, COUNTRY_CODE, START_YEAR, ACTIVE)));
   
    MBArtist artist = artistDao.getArtist(artist1.getId());
   
    assertEquals(artist1.getName(), artist.getName());
    assertEquals(MBID, artist.getMbid());
    assertEquals(COUNTRY_CODE, artist.getCountryCode());
    assertEquals(START_YEAR, artist.getStartYear());
    assertEquals(ACTIVE, artist.isActive());
  }
View Full Code Here


    List<Artist> missingArtists = artistDao.getMissingArtists();
    assertEquals(2, missingArtists.size());
    assertEquals(artist1, missingArtists.get(0));
    assertEquals(artist2, missingArtists.get(1));
   
    artistDao.createArtists(Arrays.asList(new MBArtist(artist1.getName(),
        MBID, COUNTRY_CODE, START_YEAR, ACTIVE)));
   
    missingArtists = artistDao.getMissingArtists();
    assertEquals(1, missingArtists.size());
    assertEquals(artist2, missingArtists.get(0));
View Full Code Here

  @Test
  public void findsOutdatedArtists() {
    assertEquals(0, artistDao.getOutdatedArtists().size());

    artistDao.createArtists(Arrays.asList(
        new MBArtist(artist1.getName(), MBID, COUNTRY_CODE, START_YEAR, ACTIVE)));

    artistDao.getJdbcTemplate().execute(String.format(
        "insert into library.webservice_history (artist_id, invocation_time, calltype_id)"
        + " values (%d, to_timestamp(0), %d)",
        artist1.getId(), MB_RELEASE_GROUPS.getDatabaseId()));
View Full Code Here

  @Test
  public void calculatesMissingAndOutdatedArtists() {
    assertEquals(2, artistDao.getMissingAndOutdatedArtistsCount()); // 2 missing artists

    artistDao.createArtists(Arrays.asList(
        new MBArtist(artist1.getName(), MBID, COUNTRY_CODE, START_YEAR, ACTIVE),
        new MBArtist(artist2.getName(), MBID, COUNTRY_CODE, START_YEAR, ACTIVE)));
   
    assertEquals(2, artistDao.getMissingAndOutdatedArtistsCount()); // 2 missing albums
   
    artistDao.getJdbcTemplate().execute(String.format(
        "insert into library.webservice_history (artist_id, invocation_time, calltype_id)"
View Full Code Here

  @Test
  public void emptyResourceFileCorrectlyParsed() throws ApplicationException {
    ArtistQueryParser parser = new ArtistQueryParserImpl(
        new ResourceUtil(ARTIST_QUERY_EMPTY_FILE).getInputStream());
   
    MBArtist artist = parser.getArtist();
   
    assertNull(artist);
  }
View Full Code Here

  @Test
  public void resourceFileCorrectlyParsed() throws ApplicationException {
    ArtistQueryParser parser = new ArtistQueryParserImpl(
        new ResourceUtil(ARTIST_QUERY_FILE).getInputStream());
   
    MBArtist artist = parser.getArtist();
   
    assertEquals(MBID, artist.getMbid());
    assertEquals(NAME, artist.getName());
    assertEquals(COUNTRY_CODE, artist.getCountryCode());
    assertEquals(START_YEAR, artist.getStartYear());
    assertEquals(ACTIVE, artist.isActive());
  }
View Full Code Here

  @Test
  public void dateGetsStoredAsYearOnly() throws ApplicationException {
    ArtistQueryParser parser = new ArtistQueryParserImpl(
        new ResourceUtil(ARTIST_QUERY_DATE_FILE).getInputStream());
   
    MBArtist artist = parser.getArtist();
   
    assertEquals(YEAR_PART, artist.getStartYear());
  }
View Full Code Here

 
  @Override
  public void startElement(String uri, String localName, String qName, Attributes attributes)
  throws SAXException {
    if (TAG_ARTIST.equals(qName)) {
      artist = new MBArtist();
      artist.setMbid(attributes.getValue(ATTR_ID));
    } else if (TAG_TAGLIST.equals(qName)) {
      tagList = true;
    }
    characterData = new StringBuilder();
View Full Code Here

public class MBArtistRowMapper implements RowMapper<MBArtist> {

  @Override
  public MBArtist mapRow(ResultSet rs, int rowNum) throws SQLException {
    return new MBArtist(rs.getInt(1), rs.getString(2), rs.getString(3),
        rs.getString(4), rs.getShort(5), rs.getBoolean(6));
  }
View Full Code Here

TOP

Related Classes of com.github.hakko.musiccabinet.domain.model.music.MBArtist

Copyright © 2018 www.massapicom. 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.