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

Examples of com.github.hakko.musiccabinet.domain.model.aggr.UserLovedTracks


 
  @Test
  public void createAndRetrievesUserLovedTracks() throws ApplicationException {
    List<Track> lovedTracks = new UserLovedTracksParserImpl(new ResourceUtil(
        LOVED_TRACKS_FILE).getInputStream()).getLovedTracks();
    dao.createLovedTracks(asList(new UserLovedTracks(USERNAME1, lovedTracks)));
    List<Track> dbLovedTracks = dao.getLovedTracks(USERNAME1);
   
    Collections.sort(lovedTracks);
    Collections.sort(dbLovedTracks);
   
View Full Code Here


  @Test
  public void deletesUnlovedTracksIdentifiedInImport() throws ApplicationException {
    List<Track> lovedTracks = new UserLovedTracksParserImpl(new ResourceUtil(
        LOVED_TRACKS_FILE).getInputStream()).getLovedTracks();
    dao.createLovedTracks(asList(new UserLovedTracks(USERNAME1, lovedTracks)));

    lovedTracks.remove(0);
    dao.createLovedTracks(asList(new UserLovedTracks(USERNAME1, lovedTracks)));
   
    List<Track> dbLovedTracks = dao.getLovedTracks(USERNAME1);
    Collections.sort(lovedTracks);
    Collections.sort(dbLovedTracks);
   
View Full Code Here

  }
 
  @Test
  public void addsAndDeletesLovedTracksSeparatelyPerUsers() {
    dao.createLovedTracks(asList(
        new UserLovedTracks(USERNAME1, asList(track1)),
        new UserLovedTracks(USERNAME2, asList(track2))));
   
    assertEquals(asList(track1), dao.getLovedTracks(USERNAME1));
    assertEquals(asList(track2), dao.getLovedTracks(USERNAME2));

    dao.createLovedTracks(asList(
        new UserLovedTracks(USERNAME1, asList(track1)),
        new UserLovedTracks(USERNAME2, asList(track1, track2))));
   
    assertEquals(asList(track1), dao.getLovedTracks(USERNAME1));
    assertEquals(asList(track1, track2), sort(dao.getLovedTracks(USERNAME2)));
  }
View Full Code Here

  @Test
  public void addsStarredTrackWhenImportingNewLovedTracks() {
    starDao.starTrack(user1, track1.getId());
    starDao.starTrack(user2, track2.getId());
   
    dao.createLovedTracks(asList(new UserLovedTracks(USERNAME1, asList(track2))));
   
    List<Integer> starred1 = starDao.getStarredTrackIds(user1, 0, 10, null);
    List<Integer> starred2 = starDao.getStarredTrackIds(user2, 0, 10, null);
   
    assertEquals(Arrays.asList(track2.getId(), track1.getId()), starred1);
View Full Code Here

  public void removesStarredTracksWhenPreviouslyLovedTrackIsMissingInImport() {
    starDao.starTrack(user1, track1.getId());
    starDao.starTrack(user2, track2.getId());

    dao.createLovedTracks(asList(
        new UserLovedTracks(USERNAME1, asList(track1, track2)),
        new UserLovedTracks(USERNAME2, asList(track2))));
    dao.createLovedTracks(asList(
        new UserLovedTracks(USERNAME1, asList(track2)),
        new UserLovedTracks(USERNAME2, asList(track2))));

    List<Integer> starred1 = starDao.getStarredTrackIds(user1, 0, 10, null);
    List<Integer> starred2 = starDao.getStarredTrackIds(user2, 0, 10, null);

    assertEquals(Arrays.asList(track2.getId()), starred1);
View Full Code Here

  public void starredTracksAreOnlyRemovedIfPreviouslyDefinedAsLovedTrack() {
    starDao.starTrack(user1, track1.getId());
    starDao.starTrack(user1, track2.getId());

    dao.createLovedTracks(asList(
        new UserLovedTracks(USERNAME1, asList(track2)),
        new UserLovedTracks(USERNAME2, asList(track2))));
   
    List<Integer> starred1 = starDao.getStarredTrackIds(user1, 0, 10, null);
    List<Integer> starred2 = starDao.getStarredTrackIds(user2, 0, 10, null);

    assertEquals(asList(track2.getId(), track1.getId()), starred1);
    assertEquals(asList(track2.getId()), starred2);

    dao.createLovedTracks(asList(
        new UserLovedTracks(USERNAME1, asList(track1)),
        new UserLovedTracks(USERNAME2, asList(track2))));

    starred1 = starDao.getStarredTrackIds(user1, 0, 10, null);
    starred2 = starDao.getStarredTrackIds(user2, 0, 10, null);

    assertEquals(asList(track1.getId()), starred1);
View Full Code Here

  @Test
  public void identifiesStarredButNotLovedTracks() {
    starDao.starTrack(user1, track1.getId());
    starDao.starTrack(user2, track1.getId());

    dao.createLovedTracks(asList(new UserLovedTracks(USERNAME1, asList(track1, track2))));

    List<UserStarredTrack> userStarredTracks = dao.getStarredButNotLovedTracks();
    assertEquals(1, userStarredTracks.size());
    assertEquals(user2, userStarredTracks.get(0).getLastFmUser());
    assertEquals(track1, userStarredTracks.get(0).getStarredTrack());
View Full Code Here

        f3 = getFile(artistName2, albumName1, trackName2, (short) 2010),
        f4 = getFile(artistName2, albumName2, trackName2, (short) 2011),
        f5 = getFile(artistName2, albumName3, trackName2, (short) 2012)));

    dao.createLovedTracks(asList(
        new UserLovedTracks(USERNAME1, asList(new Track(artistName1, trackName1))),
        new UserLovedTracks(USERNAME2, asList(new Track(artistName2, trackName2)))));

    assertFalse(browserDao.getTrackId(f1) == browserDao.getTrackId(f2));
    assertFalse(browserDao.getTrackId(f3) == browserDao.getTrackId(f4));
    assertFalse(browserDao.getTrackId(f3) == browserDao.getTrackId(f5));
View Full Code Here

          lovedTracks.addAll(parser.getLovedTracks());
        }
      } while (++page < totalPages);
      addFinishedOperation();

      userLovedTracks.add(new UserLovedTracks(user.getLastFmUsername(), lovedTracks));
    }
   
    userLovedTracksDao.createLovedTracks(userLovedTracks);

    for (UserStarredTrack ust : userLovedTracksDao.getStarredButNotLovedTracks()) {
View Full Code Here

TOP

Related Classes of com.github.hakko.musiccabinet.domain.model.aggr.UserLovedTracks

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.