Package com.jitcaforwin.extended.impl.collections

Examples of com.jitcaforwin.extended.impl.collections.TrackCollectionImpl


  @BeforeClass
  public static void setup() throws JitcaException{
    libraryMock = EasyMock.createMock(UserLibraryImpl.class);

    TrackCollectionImpl trackCollectionMock = EasyMock.createMock(TrackCollectionImpl.class);
    TrackFactory trackFactoryMock = EasyMock.createMock(TrackFactory.class);

    EasyMock.expect(trackFactoryMock.isLazy()).andReturn(false).anyTimes();
    EasyMock.expect(libraryMock.isLazy()).andReturn(false).anyTimes();
    EasyMock.expect(trackFactoryMock.getTracksOfAlbum("Test-Album-Name")).andReturn(trackCollectionMock);
    EasyMock.expect(libraryMock.getTracksOfAlbum("Test-Album-Name")).andReturn(trackCollectionMock);
    EasyMock.expect(trackFactoryMock.getTracksOfArtist("Test-Artist-Name")).andReturn(trackCollectionMock);
    EasyMock.expect(trackFactoryMock.getTracksOfComposer("Test-Artist-Name")).andReturn(trackCollectionMock);
    EasyMock.expect(trackFactoryMock.getTracksOfArtist("Test-Composer-Name")).andReturn(trackCollectionMock);
    EasyMock.expect(trackFactoryMock.getTracksOfComposer("Test-Composer-Name")).andReturn(trackCollectionMock);
    EasyMock.expect(libraryMock.getTrackFactory()).andReturn(trackFactoryMock).anyTimes();
    EasyMock.expect(trackCollectionMock.iterator()).andReturn(new LinkedList<Track>().iterator()).anyTimes();

    EasyMock.replay(libraryMock);
    EasyMock.replay(trackFactoryMock);
    EasyMock.replay(trackCollectionMock);
View Full Code Here


  public AlbumImpl(String title, Artist artist, Source source) {
    super(source.isLazy());
    this.source = source;
    this.title = title;
    this.artist = artist;
    this.tracks = new TrackCollectionImpl(this.source.isLazy(), this.source, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);
    if (!this.lazy){
      this.loadAllTracks();
    }
  }
View Full Code Here

  private boolean loadedFromITunes;
 
  public GenreImpl(String name, Source source){
    this.source = source;
    this.name = name;
    tracks = new TrackCollectionImpl(this.source, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);
    this.loadedFromITunes = false; // All tracks of a genre are loaded from iTunes, when they are needed.
    this.id3Genre = ID3TagFactory.getId3GenreFactory().getGenre(name);
  }
View Full Code Here

  @Test
  public void testCreateAlbum() throws JitcaException {
    UserLibraryImpl libraryMock = EasyMock.createMock(UserLibraryImpl.class);
   
    TrackFactory trackFactoryMock = EasyMock.createMock(TrackFactory.class);
    TrackCollectionImpl trackCollectionMock = EasyMock.createMock(TrackCollectionImpl.class);
   
    EasyMock.expect(libraryMock.isLazy()).andReturn(true).anyTimes();
    EasyMock.expect(libraryMock.getTracksOfArtist("Nelly Furtado")).andReturn(trackCollectionMock);
    EasyMock.expect(trackFactoryMock.getTracksOfArtist("Nelly Furtado")).andReturn(trackCollectionMock);
    EasyMock.expect(libraryMock.getTracksOfComposer("Nelly Furtado")).andReturn(trackCollectionMock);
    EasyMock.expect(trackFactoryMock.getTracksOfComposer("Nelly Furtado")).andReturn(trackCollectionMock)
    EasyMock.expect(libraryMock.getTracksOfAlbum("Loose")).andReturn(trackCollectionMock).anyTimes();
    EasyMock.expect(libraryMock.getTracksOfAlbum("Folklore")).andReturn(trackCollectionMock);
    EasyMock.expect(libraryMock.getTrackFactory()).andReturn(trackFactoryMock).anyTimes();
    EasyMock.expect(trackCollectionMock.iterator()).andReturn(new LinkedList<Track>().iterator()).anyTimes();
   
    EasyMock.replay(libraryMock);
    EasyMock.replay(trackCollectionMock);
    EasyMock.replay(trackFactoryMock);
   
View Full Code Here

    EasyMock.replay(libraryMock);
  }

  @Test
  public void testAddTracksInStandardCollection() throws JitcaException {
    TrackCollectionImpl tracks = new TrackCollectionImpl(libraryMock);
    this.testForDuplicates(tracks, true);
  }
View Full Code Here

    this.testForDuplicates(tracks, true);
  }

  @Test
  public void testAddTracksInDuplicatesAllowedCollection() throws JitcaException {
    TrackCollectionImpl tracks = new TrackCollectionImpl(libraryMock, TrackCollectionImpl.DUPLICATES_ALLOWED);
    this.testForDuplicates(tracks, true);
  }
View Full Code Here

    this.testForDuplicates(tracks, true);
  }

  @Test
  public void testAddTracksInDuplicatesNotAllowedCollection() throws JitcaException {
    TrackCollectionImpl tracks = new TrackCollectionImpl(libraryMock, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);
    this.testForDuplicates(tracks, false);
  }
View Full Code Here

   */
  public Track addFile(File file) throws JitcaException {
    try {
      IITOperationStatus addOperationStatus = this.itLibrary.addFile(file);
      addOperationStatus.waitForCompletion();
      TrackCollectionImpl tracks = new TrackCollectionImpl(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

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

      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 TrackCollectionImpl(this, searchResult).getFirst();
    } catch (ObjectDeletedException e) {
      throw new ITObjectDeletedError(this);
    }
  }
View Full Code Here

TOP

Related Classes of com.jitcaforwin.extended.impl.collections.TrackCollectionImpl

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.