Examples of LastFmUser


Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

  public void prepareTestData() throws ApplicationException {
    dao.getJdbcTemplate().execute("truncate music.lastfmuser cascade");
    dao.getJdbcTemplate().execute("truncate library.file cascade");
    dao.getJdbcTemplate().execute("truncate music.artist cascade");
   
    user1 = new LastFmUser(username1 = "user1");
    user2 = new LastFmUser(username2 = "user2");
    lastFmDao.createOrUpdateLastFmUser(user1);
    lastFmDao.createOrUpdateLastFmUser(user2);

    File file1 = UnittestLibraryUtil.getFile("artist1", "album1", "title1");
    File file2 = UnittestLibraryUtil.getFile("artist1", "album1", "title2");
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

        assertHasParameter(params, PARAM_SK, sessionKey);

        return null;
      }

    }.love(new Track(artist, track), new LastFmUser(lastFmUser, sessionKey));

  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

  @Test
  public void validateParameters() throws ApplicationException {

    final Track track = browserDao.getTracks(browserDao.getRandomTrackIds(1)).get(0);
    final LastFmUser user = new LastFmUser("lastFmUser", "sessionKey");
    final Scrobble scrobble = new Scrobble(user, track, false);

    final String method = UpdateNowPlayingClient.METHOD;

    new UpdateNowPlayingClient() {
      @Override
      protected WSResponse executeWSRequest(List<NameValuePair> params) throws ApplicationException {

        assertHasParameter(params, PARAM_METHOD, method);
        assertHasParameter(params, PARAM_ARTIST, track.getArtist().getName());
        assertHasParameter(params, PARAM_ALBUM, track.getMetaData().getAlbum());
        assertHasParameter(params, PARAM_TRACK, track.getName());
        assertHasParameter(params, PARAM_DURATION, "" + track.getMetaData().getDuration());
        assertHasParameter(params, PARAM_SK, user.getSessionKey());

        return null;
      }

    }.updateNowPlaying(scrobble);
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

  }

  @Test
  public void importUserRelatedDataNotPossibleTwice() {
    Calltype TOP_ARTISTS = Calltype.USER_GET_TOP_ARTISTS;
    LastFmUser user = new LastFmUser("arnathalon");
    WebserviceInvocation topArtists = new WebserviceInvocation(TOP_ARTISTS, user, OVERALL.getDays());
   
    deleteWebserviceInvocations();
   
    assertTrue(dao.isWebserviceInvocationAllowed(topArtists));
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

  }

  @Test
  public void periodIsSignificantForAllowance() {
    Calltype TOP_ARTISTS = Calltype.USER_GET_TOP_ARTISTS;
    LastFmUser user = new LastFmUser("arnathalon");
    WebserviceInvocation topArtists1 = new WebserviceInvocation(TOP_ARTISTS, user, OVERALL.getDays());
    WebserviceInvocation topArtists2 = new WebserviceInvocation(TOP_ARTISTS, user, SIX_MONTHS.getDays());

    deleteWebserviceInvocations();
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

  }
 
  @Test
  public void differentUsersDontInterfere() {
    Calltype TOP_ARTISTS = Calltype.USER_GET_TOP_ARTISTS;
    LastFmUser user1 = new LastFmUser("user1");
    LastFmUser user2 = new LastFmUser("user2");

    WebserviceInvocation topArtists1 = new WebserviceInvocation(TOP_ARTISTS, user1, OVERALL.getDays());
    WebserviceInvocation topArtists2 = new WebserviceInvocation(TOP_ARTISTS, user2, OVERALL.getDays());
   
    deleteWebserviceInvocations();
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

        assertHasParameter(params, PARAM_SK, sessionKey);

        return null;
      }

    }.unlove(new Track(artist, track), new LastFmUser(lastFmUser, sessionKey));

  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

   * When importing loved tracks, user2 is unavailable and user1 has loved track1.
   * Expected outcome: afterwards, user1 has starred track1 & 2 and user2 track3 & 4.
   */
  @Test
  public void updatesStarredTracksWhenImportIsOnlyAllowedForOneUser() throws ApplicationException {
    lastFmDao.createOrUpdateLastFmUser(new LastFmUser(USER1));
    lastFmDao.createOrUpdateLastFmUser(new LastFmUser(USER2));
    LastFmUser user1 = lastFmDao.getLastFmUser(USER1),
        user2 = lastFmDao.getLastFmUser(USER2);
    Track track1 = new Track("Frank Ocean", "Lost"),
        track2 = new Track("Kate Bush", "Cloudbusting"),
        track3 = new Track("Adele", "Skyfall"),
        track4 = new Track("Kath Bloom", "Fall Again");
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

   
    client.setWebserviceHistoryService(Mockito.mock(WebserviceHistoryService.class));
   
    LastFmDao dao = Mockito.mock(LastFmDao.class);
    Mockito.when(dao.getLastFmUser(Mockito.anyString())).thenReturn(
        new LastFmUser(lastFmUser, sessionKey));
    client.setLastFmDao(dao);
   
    client.getUserRecommendedArtists(lastFmUser);
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.library.LastFmUser

  @Test
  public void validateParameters() throws ApplicationException {

    final String method = UserLovedTracksClient.METHOD;
    final String limit = UserLovedTracksClient.LIMIT;
    final LastFmUser lastFmUser = new LastFmUser("rj");
    final short page = 4;
   
    new UserLovedTracksClient() {
      @Override
      protected WSResponse executeWSRequest(WebserviceInvocation wi,
          List<NameValuePair> params) throws ApplicationException {
       
        Assert.assertEquals(Calltype.USER_GET_LOVED_TRACKS, wi.getCallType());
        Assert.assertEquals(lastFmUser, wi.getUser());
       
        assertHasParameter(params, PARAM_METHOD, method);
        assertHasParameter(params, PARAM_LIMIT, limit);
        assertHasParameter(params, PARAM_USER, lastFmUser.getLastFmUsername());
        assertHasParameter(params, PARAM_PAGE, Short.toString(page));
       
        return null;
      }
     
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.