Examples of TrackCollection


Examples of com.jitcaforwin.extended.api.collections.TrackCollection

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();
   
    EasyMock.replay(playlistMock, tracksMock, trackMock1, trackMock2, trackMock3, genreMockA, genreMockB);
View Full Code Here

Examples of com.jitcaforwin.extended.api.collections.TrackCollection

  }

  @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();
    EasyMock.expect(genreMockB.isId3TagGenre()).andReturn(false).anyTimes();
View Full Code Here

Examples of com.jitcaforwin.extended.api.collections.TrackCollection

  }
 
  @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();
    EasyMock.expect(genreMockB.isId3TagGenre()).andReturn(false).anyTimes();
View Full Code Here

Examples of com.jitcaforwin.extended.api.collections.TrackCollection

  }
 
  @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();
    EasyMock.expect(genreMockB.isBasicId3TagGenre()).andReturn(false).anyTimes();
View Full Code Here

Examples of com.jitcaforwin.extended.collections.TrackCollection

   *
   * @throws JitcaException
   */
  protected void loadTracks() {
    try {
      this.tracks = new TrackCollection(this.source, this.itPlaylist.getTracks());
    } catch (PlaylistDeletedException e) {
      throw new ITObjectDeletedError(this);
    }
  }
View Full Code Here

Examples of com.jitcaforwin.extended.collections.TrackCollection

   * @throws JitcaException
   *             if an error occurs.
   */
  public TrackCollection getTracksOfGenre(String genre){
    try{JLogger.debug(SearchService.class, "loadTracksOfGenre() for \"" + genre + "\"");
    TrackCollection tracks = this.createTrackCollection(this.itPlaylist.search(genre, ITPlaylistSearchField.All()));
    TrackCollection tracksCleaned = new TrackCollection(this.source);
    for (Track track : tracks) {
      if (track.getGenre().equals(genre)) {
        tracksCleaned.add(track);
      }
    }
    return tracksCleaned;
  } catch (PlaylistDeletedException e) {
    throw new ITObjectDeletedError(this.source);
View Full Code Here

Examples of com.jitcaforwin.extended.collections.TrackCollection

      throw new ITObjectDeletedError(this.source);
    }
  }

  private TrackCollection createTrackCollection(IITTrackCollection tracks) {
    return new TrackCollection(this.source, tracks);
  }
View Full Code Here

Examples of com.jitcaforwin.extended.collections.TrackCollection

   */
  public Track addFile(File file) throws JitcaException {
    try {
      IITOperationStatus addOperationStatus = this.itLibrary.addFile(file);
      addOperationStatus.waitForCompletion();
      TrackCollection tracks = new TrackCollection(this, addOperationStatus.getTracks());
      Track newTrack = tracks.getFirst();
      this.addTrack(newTrack);
      return newTrack;
    } catch (PlaylistDeletedException e) {
      throw new ITObjectDeletedError(this);
    } catch (PlaylistReadOnlyException e) {
View Full Code Here

Examples of com.jitcaforwin.extended.collections.TrackCollection

   */
  public TrackCollection addFiles(File files[]) throws JitcaException {
    try {
      IITOperationStatus addOperationStatus = this.itLibrary.addFiles(files);
      addOperationStatus.waitForCompletion();
      TrackCollection newTracks = new TrackCollection(this, addOperationStatus.getTracks());
      this.addTracks(newTracks);
      return newTracks;
    } catch (PlaylistReadOnlyException e) {
      throw new UserLibraryReadOnly(this);
    } catch (PlaylistDeletedException e) {
View Full Code Here

Examples of com.jitcaforwin.extended.collections.TrackCollection

      if (searchResult.getCount() > 1) {
        throw new LibrarySearchException("There are multiple tracks with the specified name \"" + name + "\"");
      } else if (searchResult.getCount() == 0) {
        return null; // no track found
      }
      return new TrackCollection(this, searchResult).getFirst();
    } catch (ObjectDeletedException e) {
      throw new ITObjectDeletedError(this);
    }
  }
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.