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

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


   
  @Test
  public void logsSuccessfulCall() throws ApplicationException {
    TestMusicBrainzClient client = getClient();

    WebserviceInvocation invocation = client.getInvocation();

    verify(client.getWebserviceHistoryService(), never()).logWebserviceInvocation(invocation);
    client.get();
    verify(client.getWebserviceHistoryService()).logWebserviceInvocation(invocation);
  }
View Full Code Here


  public void doesntLogFailedCall() throws Exception {
    TestMusicBrainzClient client = getClient();
    when(client.getHttpClient().execute(any(HttpUriRequest.class),
        any(ResponseHandler.class))).thenThrow(new IOException("Interrupted"));

    WebserviceInvocation invocation = client.getInvocation();
    try {
      client.get();
    } catch (ApplicationException e) {
      verify(client.getWebserviceHistoryService(), never()).logWebserviceInvocation(invocation);
      return;
View Full Code Here

   
    Assert.fail();
  }
 
  private TestMusicBrainzClient getClient() {
    WebserviceInvocation invocation = Mockito.mock(WebserviceInvocation.class);
    TestMusicBrainzClient client = new TestMusicBrainzClient(invocation);
    HttpClient httpClient = Mockito.mock(HttpClient.class);
    client.setHttpClient(httpClient);

    WebserviceHistoryService webserviceHistoryService =
View Full Code Here

  @Test
  public void importPageFromPersonLibraryNotPossibleTwice() {
    Calltype LIB = Calltype.GET_SCROBBLED_TRACKS;
    short page3 = 3;
    short page4 = 4;
    WebserviceInvocation libPage3 = new WebserviceInvocation(LIB, page3);
    WebserviceInvocation libPage4 = new WebserviceInvocation(LIB, page4);

    deleteWebserviceInvocations();

    assertTrue(dao.isWebserviceInvocationAllowed(libPage3));
    assertTrue(dao.isWebserviceInvocationAllowed(libPage4));
View Full Code Here

  public void importArtistTopTracksNotPossibleTwice() {
    Calltype TOP = Calltype.ARTIST_GET_TOP_TRACKS;
    Artist artist1 = new Artist("Esben And The Witch");
    Artist artist2 = new Artist("Espers");
    Artist artist3 = new Artist("Essie Jain");
    WebserviceInvocation topArtist1 = new WebserviceInvocation(TOP, artist1);
    WebserviceInvocation topArtist2 = new WebserviceInvocation(TOP, artist2);
    WebserviceInvocation topArtist3 = new WebserviceInvocation(TOP, artist3);
   
    deleteWebserviceInvocations();
   
    // possible for all of them
    assertTrue(dao.isWebserviceInvocationAllowed(topArtist1));
View Full Code Here

  @Test
  public void webserviceHistoryIsCaseInsensitive() {
    Calltype TOP = Calltype.ARTIST_GET_TOP_TRACKS;
    Artist artist1 = new Artist("Håll Det Äkta");
    Artist artist2 = new Artist("HÅLL DET ÄKTA");
    WebserviceInvocation topArtist1 = new WebserviceInvocation(TOP, artist1);
    WebserviceInvocation topArtist2 = new WebserviceInvocation(TOP, artist2);
   
    deleteWebserviceInvocations();

    assertTrue(dao.isWebserviceInvocationAllowed(topArtist1));
    assertTrue(dao.isWebserviceInvocationAllowed(topArtist2));
View Full Code Here

    Calltype TOP = Calltype.ARTIST_GET_TOP_TRACKS;
    Calltype SIMILAR = Calltype.ARTIST_GET_SIMILAR;
    Artist artist1 = new Artist("Björk");
    Artist artist2 = new Artist("Björn Olsson");

    WebserviceInvocation topArtist1 = new WebserviceInvocation(TOP, artist1);
    WebserviceInvocation topArtist2 = new WebserviceInvocation(TOP, artist2);
    WebserviceInvocation similarArtist1 = new WebserviceInvocation(SIMILAR, artist1);
    WebserviceInvocation similarArtist2 = new WebserviceInvocation(SIMILAR, artist2);

    deleteWebserviceInvocations();

    // everything's allowed
    assertTrue(dao.isWebserviceInvocationAllowed(topArtist1));
View Full Code Here

    Calltype SIMILAR = Calltype.TRACK_GET_SIMILAR;
    Artist artist = new Artist("Bill Fay");
    Track track1 = new Track(artist, "Omega");
    Track track2 = new Track(artist, "Don't let my marigolds die");
   
    WebserviceInvocation similarTrack1 = new WebserviceInvocation(SIMILAR, track1);
    WebserviceInvocation similarTrack2 = new WebserviceInvocation(SIMILAR, track2);

    deleteWebserviceInvocations();
   
    assertTrue(dao.isWebserviceInvocationAllowed(similarTrack1));
    assertTrue(dao.isWebserviceInvocationAllowed(similarTrack2));
View Full Code Here

  public void importTrackSimilaritiesIsPossibleForCovers() {
    Calltype SIMILAR = Calltype.TRACK_GET_SIMILAR;
    Track track1 = new Track("Daniel Johnston", "True Love Will Find You In The End");
    Track track2 = new Track("Headless Heroes", "True Love Will Find You In The End");

    WebserviceInvocation similarTrack1 = new WebserviceInvocation(SIMILAR, track1);
    WebserviceInvocation similarTrack2 = new WebserviceInvocation(SIMILAR, track2);
   
    deleteWebserviceInvocations();

    assertTrue(dao.isWebserviceInvocationAllowed(similarTrack1));
    assertTrue(dao.isWebserviceInvocationAllowed(similarTrack2));
View Full Code Here

  @Test
  public void oldInvocationsAreIgnored() {
    Calltype SIMILAR = Calltype.TRACK_GET_SIMILAR;
    Track track = new Track("Red Sparowes", "Finally, As That Blazing Sun Shone Down Upon Us, Did We Know That True Enemy Was the Voice of Blind Idolatry; and Only Then Did We Begin to Think for Ourselves.");
    WebserviceInvocation similarTrack = new WebserviceInvocation(SIMILAR, track);

    deleteWebserviceInvocations();

    assertTrue(dao.isWebserviceInvocationAllowed(similarTrack));
    dao.logWebserviceInvocation(similarTrack);
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.