Package se.despotify.domain

Examples of se.despotify.domain.MemoryStore


//          "    artist");
//    }
//    System.out.flush();
   

    MemoryStore store = new MemoryStore();

    Artist artist;

    // generated tests

    artist = store.getArtist("d00d9e7b82894fb8851a109c82568eb5");
    new LoadArtist(store, artist).send(connection.getProtocol());
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("d00d9e7b82894fb8851a109c82568eb5", artist.getHexUUID());
        assertEquals("spotify:artist:6kACVPfCOnqzgfEF5ryl0x", artist.getSpotifyURL());
        assertEquals("http://open.spotify.com/artist/6kACVPfCOnqzgfEF5ryl0x", artist.getHttpURL());
        assertEquals("Johnny Cash", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("4f9873e19e5a4b4096c216c98bcdb010");
    new LoadArtist(store, artist).send(connection.getProtocol());
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("4f9873e19e5a4b4096c216c98bcdb010", artist.getHexUUID());
        assertEquals("spotify:artist:2qc41rNTtdLK0tV3mJn2Pm", artist.getSpotifyURL());
        assertEquals("http://open.spotify.com/artist/2qc41rNTtdLK0tV3mJn2Pm", artist.getHttpURL());
        assertEquals("Ryan Adams", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("db614c7060fc47baa7be732d88ae446d");
    new LoadArtist(store, artist).send(connection.getProtocol());
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("db614c7060fc47baa7be732d88ae446d", artist.getHexUUID());
        assertEquals("spotify:artist:6FXMGgJwohJLUSr5nVlf9X", artist.getSpotifyURL());
        assertEquals("http://open.spotify.com/artist/6FXMGgJwohJLUSr5nVlf9X", artist.getHttpURL());
        assertEquals("Massive Attack", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("f4d5d82d09124feda0633a2671f8c81a");
    new LoadArtist(store, artist).send(connection.getProtocol());
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("f4d5d82d09124feda0633a2671f8c81a", artist.getHexUUID());
        assertEquals("spotify:artist:7rZR0ugcLEhNrFYOrUtZii", artist.getSpotifyURL());
        assertEquals("http://open.spotify.com/artist/7rZR0ugcLEhNrFYOrUtZii", artist.getHttpURL());
        assertEquals("Miles Davis", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("f6150726a8e94c89a7cf336d3f72be9c");
    new LoadArtist(store, artist).send(connection.getProtocol());
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("f6150726a8e94c89a7cf336d3f72be9c", artist.getHexUUID());
View Full Code Here


    String playlistName = randomPlaylistName();
   
    log.info("\n\n\n\n\n\n\n           create playlist named "+playlistName+"\n\n\n\n\n\n\n\n\n");

    Playlist originalPlaylist = new CreatePlaylist(new MemoryStore(), user, playlistName, false).send(connection.getProtocol());


    log.info("\n\n\n\n\n\n\n           load playlist with UUID "+Hex.toHex(originalPlaylist.getUUID())+"\n\n             spotify:user:"+ username + ":playlist:" + SpotifyURI.toURI(Hex.toHex(originalPlaylist.getUUID())) +"\n\n\n\n\n\n\n\n\n");

    // brand new store to make sure we dont pick something up from the cache.
    MemoryStore store = new MemoryStore();
    Playlist loadedPlaylist = store.getPlaylist(originalPlaylist.getUUID());
    new LoadPlaylist(store, loadedPlaylist).send(connection.getProtocol());

    assertTrue("different stores means different instances", loadedPlaylist != originalPlaylist);  
    assertEquals(loadedPlaylist.getChecksum().longValue(), loadedPlaylist.calculateChecksum());
    assertEquals(originalPlaylist.getHexUUID(), loadedPlaylist.getHexUUID());
View Full Code Here

      connectionThread.start();
    }
    user = new User();
    user.setName(username);

    store = new MemoryStore();

    defaultPlaylist = store.getPlaylist(Hex.toBytes(SpotifyURI.toHex("6wvPFkLGKOVl1v3qRJD6HX")));

    defaultArtists = new Artist[]{
        store.getArtist(Hex.toBytes(SpotifyURI.toHex("6kACVPfCOnqzgfEF5ryl0x"))),
View Full Code Here

  }

  @Test
  public void testBrowseTrack() {
    SpotifyURL.browse("spotify:track:7lF0U328NdKSIPXEOWEpea"new MemoryStore(), connection).accept(new VisitorAdapter() {
      @Override
      public void visit(Track track) {
      }
    });
  }
View Full Code Here

    });
  }

  @Test
  public void testBrowseArtist() {
    SpotifyURL.browse("spotify:artist:0WjkBDqno4HbjwNDqyMgVa", new MemoryStore(), connection).accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
      }
    });
  }
View Full Code Here

    });
  }

  @Test
  public void testBrowseAlbum() {
    SpotifyURL.browse("spotify:album:6XOpVcNWQD7kXDjtrWM968", new MemoryStore(), connection).accept(new VisitorAdapter() {
      @Override
      public void visit(Album album) {
      }
    });
  }
View Full Code Here

    });
  }

  @Test
  public void testBrowsePlaylist() {
    SpotifyURL.browse("spotify:user:kent.finell:playlist:6wvPFkLGKOVl1v3qRJD6HX", new MemoryStore(), connection).accept(new VisitorAdapter() {
      @Override
      public void visit(Playlist playlist) {
      }
    });
  }
View Full Code Here

//          "    artist");
//    }
//    System.out.flush();
   

    MemoryStore store = new MemoryStore();

    Artist artist;

    // generated tests


    artist = store.getArtist("d00d9e7b82894fb8851a109c82568eb5");
    manager.send(new LoadArtist(store, artist));
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("d00d9e7b82894fb8851a109c82568eb5", artist.getId());
        assertEquals("spotify:artist:6kACVPfCOnqzgfEF5ryl0x", artist.getSpotifyURI());
        assertEquals("http://open.spotify.com/artist/6kACVPfCOnqzgfEF5ryl0x", artist.getHttpURL());
        assertEquals("Johnny Cash", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("4f9873e19e5a4b4096c216c98bcdb010");
    manager.send(new LoadArtist(store, artist));
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("4f9873e19e5a4b4096c216c98bcdb010", artist.getId());
        assertEquals("spotify:artist:2qc41rNTtdLK0tV3mJn2Pm", artist.getSpotifyURI());
        assertEquals("http://open.spotify.com/artist/2qc41rNTtdLK0tV3mJn2Pm", artist.getHttpURL());
        assertEquals("Ryan Adams", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("db614c7060fc47baa7be732d88ae446d");
    manager.send(new LoadArtist(store, artist));
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("db614c7060fc47baa7be732d88ae446d", artist.getId());
        assertEquals("spotify:artist:6FXMGgJwohJLUSr5nVlf9X", artist.getSpotifyURI());
        assertEquals("http://open.spotify.com/artist/6FXMGgJwohJLUSr5nVlf9X", artist.getHttpURL());
        assertEquals("Massive Attack", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("f4d5d82d09124feda0633a2671f8c81a");
    manager.send(new LoadArtist(store, artist));
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("f4d5d82d09124feda0633a2671f8c81a", artist.getId());
        assertEquals("spotify:artist:7rZR0ugcLEhNrFYOrUtZii", artist.getSpotifyURI());
        assertEquals("http://open.spotify.com/artist/7rZR0ugcLEhNrFYOrUtZii", artist.getHttpURL());
        assertEquals("Miles Davis", artist.getName());
//        assertNull(artist.getPopularity());
//        assertNull(artist.getPortrait());
        // TODO: artist.getSimilarArtists();
      }
    });
    artist = store.getArtist("f6150726a8e94c89a7cf336d3f72be9c");
    manager.send(new LoadArtist(store, artist));
    artist.accept(new VisitorAdapter() {
      @Override
      public void visit(Artist artist) {
        assertEquals("f6150726a8e94c89a7cf336d3f72be9c", artist.getId());
View Full Code Here

    String playlistName = randomPlaylistName();

    log.info("\n\n\n\n\n\n\n           create playlist named "+playlistName+"\n\n\n\n\n\n\n\n\n");

    Playlist originalPlaylist = (Playlist)manager.send(new CreatePlaylist(new MemoryStore(), user, playlistName, false));

    log.info("\n\n\n\n\n\n\n           load playlist with UUID "+Hex.toHex(originalPlaylist.getByteUUID())+"\n\n             spotify:user:"+ username + ":playlist:" + SpotifyURI.toURI(Hex.toHex(originalPlaylist.getByteUUID())) +"\n\n\n\n\n\n\n\n\n");

    // brand new store to make sure we dont pick something up from the cache.
    MemoryStore store = new MemoryStore();
    Playlist loadedPlaylist = store.getPlaylist(originalPlaylist.getByteUUID());
    manager.send(new LoadPlaylist(store, loadedPlaylist));

    assertTrue("different stores means different instances", loadedPlaylist != originalPlaylist);
    assertEquals(loadedPlaylist.getChecksum().longValue(), loadedPlaylist.calculateChecksum());
    assertEquals(originalPlaylist.getId(), loadedPlaylist.getId());
View Full Code Here

    loadAlbum();
    loadTracks();
  }

  public static void loadArtist() throws Exception {
    Store store = new MemoryStore();
    XMLStreamReader xmlr = createReader(new InputStreamReader(new FileInputStream(new java.io.File("src/main/resources/response/xml/load_artist_4f9873e19e5a4b4096c216c98bcdb010.xml")), "UTF8"));
    ResponseUnmarshaller unmarshaller = new ResponseUnmarshaller(store, xmlr);
    unmarshaller.skip();
    Artist artist = unmarshaller.unmarshallArtist(new Date());
    System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of se.despotify.domain.MemoryStore

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.