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

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


  @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));
    dao.logWebserviceInvocation(topArtists);
View Full Code Here


  @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();

    assertTrue(dao.isWebserviceInvocationAllowed(topArtists1));
    assertTrue(dao.isWebserviceInvocationAllowed(topArtists2));
View Full Code Here

  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();
   
    assertTrue(dao.isWebserviceInvocationAllowed(topArtists1));
    assertTrue(dao.isWebserviceInvocationAllowed(topArtists2));
View Full Code Here

  @Test
  public void importGroupRelatedDataNotPossibleTwice() {
    Calltype GROUP_ARTISTS = Calltype.GROUP_WEEKLY_ARTIST_CHART;
    LastFmGroup group = new LastFmGroup("Brainwashed");
    WebserviceInvocation groupArtists = new WebserviceInvocation(GROUP_ARTISTS, group);
   
    deleteWebserviceInvocations();
   
    assertTrue(dao.isWebserviceInvocationAllowed(groupArtists));
    dao.logWebserviceInvocation(groupArtists);
View Full Code Here

  public void differentGroupsDontInterfere() {
    Calltype GROUP_ARTISTS = Calltype.GROUP_WEEKLY_ARTIST_CHART;
    LastFmGroup group1 = new LastFmGroup("Brainwashed");
    LastFmGroup group2 = new LastFmGroup("Dark Ambient");

    WebserviceInvocation groupArtists1 = new WebserviceInvocation(GROUP_ARTISTS, group1);
    WebserviceInvocation groupArtists2 = new WebserviceInvocation(GROUP_ARTISTS, group2);
   
    deleteWebserviceInvocations();
   
    assertTrue(dao.isWebserviceInvocationAllowed(groupArtists1));
    assertTrue(dao.isWebserviceInvocationAllowed(groupArtists2));
View Full Code Here

   
    tagDao.createTags(Arrays.asList("disco"));
    Tag tag = tagDao.getTags().get(0);
   
    Calltype TOP_ARTISTS = Calltype.TAG_GET_TOP_ARTISTS;
    WebserviceInvocation topArtists = new WebserviceInvocation(TOP_ARTISTS, tag);
   
    deleteWebserviceInvocations();
   
    assertTrue(dao.isWebserviceInvocationAllowed(topArtists));
    dao.logWebserviceInvocation(topArtists);
View Full Code Here

    tagDao.createTags(Arrays.asList("disco", "sludge"));
    Tag tag1 = tagDao.getTags().get(0);
    Tag tag2 = tagDao.getTags().get(1);
    Calltype TOP_ARTISTS = Calltype.TAG_GET_TOP_ARTISTS;

    WebserviceInvocation topArtists1 = new WebserviceInvocation(TOP_ARTISTS, tag1);
    WebserviceInvocation topArtists2 = new WebserviceInvocation(TOP_ARTISTS, tag2);
   
    deleteWebserviceInvocations();
   
    assertTrue(dao.isWebserviceInvocationAllowed(topArtists1));
    assertTrue(dao.isWebserviceInvocationAllowed(topArtists2));
View Full Code Here

    Assert.assertNotNull(artistInfo);
    Assert.assertNotNull(artistTopTracks);
    Assert.assertTrue(artistInfo.contains(MADONNA));
    Assert.assertTrue(artistTopTracks.contains(MADONNA));
   
    dao.logWebserviceInvocation(new WebserviceInvocation(INFO, new Artist(MADONNA)));

    artistInfo = dao.getArtistNamesWithNoInvocations(INFO);
    artistTopTracks = dao.getArtistNamesWithNoInvocations(TOP_TRACKS);
    Assert.assertFalse(artistInfo.contains(MADONNA));
    Assert.assertTrue(artistTopTracks.contains(MADONNA));

    dao.logWebserviceInvocation(new WebserviceInvocation(TOP_TRACKS, new Artist(MADONNA)));

    artistInfo = dao.getArtistNamesWithNoInvocations(INFO);
    artistTopTracks = dao.getArtistNamesWithNoInvocations(TOP_TRACKS);
    Assert.assertFalse(artistInfo.contains(MADONNA));
    Assert.assertFalse(artistTopTracks.contains(MADONNA));
View Full Code Here

  @Test
  public void quarantineLogsInvocationTimeInTheFuture() {
    Calltype TOP = Calltype.ARTIST_GET_TOP_TRACKS;
    Artist artist = new Artist("The Notorious B.I.G feat. G. Dep & Missy Elliott");
    WebserviceInvocation wi = new WebserviceInvocation(TOP, artist);
    assertTrue(dao.isWebserviceInvocationAllowed(wi));
    dao.quarantineWebserviceInvocation(wi);
    assertFalse(dao.isWebserviceInvocationAllowed(wi));

    Date date = dao.getJdbcTemplate().queryForObject(
View Full Code Here

  public void blockLogsInvocationTimeInAnInfiniteFuture() {
    Calltype TOP = Calltype.ARTIST_GET_TOP_TRACKS;
    Artist artist = new Artist("Björn Olsson");
    int artistId = musicDao.getArtistId(artist);

    WebserviceInvocation wi = new WebserviceInvocation(TOP, artist);
    assertTrue(dao.isWebserviceInvocationAllowed(wi));

    dao.blockWebserviceInvocation(artistId, TOP);
    assertFalse(dao.isWebserviceInvocationAllowed(wi));
View Full Code Here

TOP

Related Classes of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation

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.