Package com.jitcaforwin.extended.api.playlist

Examples of com.jitcaforwin.extended.api.playlist.Playlist


   *            Reference to iTunes COM interface for a collection of playlists.
   */
  protected void loadPlaylists(IITPlaylistCollection itPlaylists) {
    try {
      for (int i = 1; i < itPlaylists.getCount() + 1; i++) {
        Playlist playlist = this.source.getPlaylistFactory().getPlaylist(itPlaylists.item(i));
        this.playlists.put(playlist.getName(), playlist);
      }
    } catch (SourceDeletedException e) {
      throw new JitcaUnexpectedError();
    } catch (ObjectDeletedException e) {
      throw new JitcaUnexpectedError();
View Full Code Here


public class PlaylistUtilitiesTest {

  @Test
  public void testGetAllGenres() {
    Playlist playlistMock = EasyMock.createMock(Playlist.class);
    TrackCollection tracksMock = EasyMock.createMock(TrackCollection.class);
    Set<Track> tracks = new HashSet<Track>();
    Track trackMock1 = EasyMock.createMock(Track.class);
    Track trackMock2 = EasyMock.createMock(Track.class);
    Track trackMock3 = EasyMock.createMock(Track.class);
    Genre genreMockA = EasyMock.createMock(Genre.class);
    Genre genreMockB = EasyMock.createMock(Genre.class);

    tracks.add(trackMock1);
    tracks.add(trackMock2);
    tracks.add(trackMock3);
    EasyMock.expect(playlistMock.getTracks()).andReturn(tracksMock);
    EasyMock.expect(tracksMock.iterator()).andReturn(tracks.iterator());
    EasyMock.expect(trackMock1.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock2.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock3.getGenre()).andReturn(genreMockB).anyTimes();
   
View Full Code Here

    EasyMock.verify(playlistMock, tracksMock, trackMock1, trackMock2, trackMock3, genreMockA, genreMockB);
  }

  @Test
  public void testGetNoneId3Genres() {
    Playlist playlistMock = EasyMock.createMock(Playlist.class);
    TrackCollection tracksMock = EasyMock.createMock(TrackCollection.class);
    Set<Track> tracks = new HashSet<Track>();
    Track trackMock1 = EasyMock.createMock(Track.class);
    Track trackMock2 = EasyMock.createMock(Track.class);
    Track trackMock3 = EasyMock.createMock(Track.class);
    Genre genreMockA = EasyMock.createMock(Genre.class);
    Genre genreMockB = EasyMock.createMock(Genre.class);

    tracks.add(trackMock1);
    tracks.add(trackMock2);
    tracks.add(trackMock3);
    EasyMock.expect(playlistMock.getTracks()).andReturn(tracksMock);
    EasyMock.expect(tracksMock.iterator()).andReturn(tracks.iterator());
    EasyMock.expect(trackMock1.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock2.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock3.getGenre()).andReturn(genreMockB).anyTimes();
    EasyMock.expect(genreMockA.isId3TagGenre()).andReturn(true).anyTimes();
View Full Code Here

    EasyMock.verify(playlistMock, tracksMock, trackMock1, trackMock2, trackMock3, genreMockA, genreMockB);
  }
 
  @Test
  public void testGetId3Genres() {
    Playlist playlistMock = EasyMock.createMock(Playlist.class);
    TrackCollection tracksMock = EasyMock.createMock(TrackCollection.class);
    Set<Track> tracks = new HashSet<Track>();
    Track trackMock1 = EasyMock.createMock(Track.class);
    Track trackMock2 = EasyMock.createMock(Track.class);
    Track trackMock3 = EasyMock.createMock(Track.class);
    Genre genreMockA = EasyMock.createMock(Genre.class);
    Genre genreMockB = EasyMock.createMock(Genre.class);

    tracks.add(trackMock1);
    tracks.add(trackMock2);
    tracks.add(trackMock3);
    EasyMock.expect(playlistMock.getTracks()).andReturn(tracksMock);
    EasyMock.expect(tracksMock.iterator()).andReturn(tracks.iterator());
    EasyMock.expect(trackMock1.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock2.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock3.getGenre()).andReturn(genreMockB).anyTimes();
    EasyMock.expect(genreMockA.isId3TagGenre()).andReturn(true).anyTimes();
View Full Code Here

    EasyMock.verify(playlistMock, tracksMock, trackMock1, trackMock2, trackMock3, genreMockA, genreMockB);
  }
 
  @Test
  public void testGetNoneBasicId3Genres() {
    Playlist playlistMock = EasyMock.createMock(Playlist.class);
    TrackCollection tracksMock = EasyMock.createMock(TrackCollection.class);
    Set<Track> tracks = new HashSet<Track>();
    Track trackMock1 = EasyMock.createMock(Track.class);
    Track trackMock2 = EasyMock.createMock(Track.class);
    Track trackMock3 = EasyMock.createMock(Track.class);
    Genre genreMockA = EasyMock.createMock(Genre.class);
    Genre genreMockB = EasyMock.createMock(Genre.class);

    tracks.add(trackMock1);
    tracks.add(trackMock2);
    tracks.add(trackMock3);
    EasyMock.expect(playlistMock.getTracks()).andReturn(tracksMock);
    EasyMock.expect(tracksMock.iterator()).andReturn(tracks.iterator());
    EasyMock.expect(trackMock1.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock2.getGenre()).andReturn(genreMockA).anyTimes();
    EasyMock.expect(trackMock3.getGenre()).andReturn(genreMockB).anyTimes();
    EasyMock.expect(genreMockA.isBasicId3TagGenre()).andReturn(true).anyTimes();
View Full Code Here

   *            Reference to iTunes COM interface for a collection of playlists.
   */
  protected void loadPlaylists(IITPlaylistCollection itPlaylists) {
    try {
      for (int i = 1; i < itPlaylists.getCount() + 1; i++) {
        Playlist playlist = this.source.getPlaylistFactory().getPlaylist(itPlaylists.item(i));
        this.playlists.put(playlist.getName(), playlist);
      }
    } catch (SourceDeletedException e) {
      throw new JitcaUnexpectedError();
    } catch (ObjectDeletedException e) {
      throw new JitcaUnexpectedError();
View Full Code Here

   * Returns the extended playlist object based on the basic iTunes playlist object.
   * @param itPlaylist The basic iTunes playlist object.
   * @return The extended playlist object based on the basic iTunes playlist object.
   */
  public Playlist getPlaylist(IITPlaylist itPlaylist) {
    Playlist playlist = this.playlists.get(itPlaylist);
    if (playlist == null) {
      playlist = this.createPlaylist(itPlaylist);
    }
    return playlist;
  }
View Full Code Here

   * Creates a new extended playlist object based on the basic iTunes playlist object.
   * @param itPlaylist The basic iTunes playlist object.
   * @return The extended playlist object based on the basic iTunes playlist object.
   */
  private Playlist createPlaylist(IITPlaylist itPlaylist) {
    Playlist playlist = PlaylistImpl.createPlaylist(this.lazy, this.source, itPlaylist);
    this.playlists.put(playlist);
    return playlist;
  }
View Full Code Here

   * @param folder Basic iTunes folder object corresponding to the new folder.
   * @return The new folder.
   * @throws JitcaException if an error occurs.
   */
  private PlaylistFolder createFolder(IITPlaylist folder) throws JitcaException {
    Playlist newFolder = this.createPlaylist(folder);
    if (!newFolder.isPlaylistFolder()) {
      throw new PlaylistException("Problem occured during creation of new folder \"" + folder.getName() + "\" ");
    }
    return (PlaylistFolderImpl) newFolder;
  }
View Full Code Here

   * @param playlist Basic iTunes playlist object corresponding to the new playlist.
   * @return The new playlist
   * @throws JitcaException if an error occurs.
   */
  private UserPlaylist createUserPlaylist(IITPlaylist playlist) throws JitcaException {
    Playlist newPlaylist = this.createPlaylist(playlist);
    if (!newPlaylist.isUserPlaylist()) {
      throw new PlaylistException("Problem occured during creation of new playlist \"" + playlist.getName() + "\" ");
    }
    return (UserPlaylistImpl) newPlaylist;
  }
View Full Code Here

TOP

Related Classes of com.jitcaforwin.extended.api.playlist.Playlist

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.