Package com.jitcaforwin.extended.api.artist

Examples of com.jitcaforwin.extended.api.artist.Artist


  public Artist getArtist(String name) {
    if (name == null || name.isEmpty()) {
      return null; // No artist specified.
    }

    Artist artist = searchForArtist(name);
    if (artist == null) {
      artist = addArtist(name);
    }
    return artist;
  }
View Full Code Here


   * @throws JitcaException
   *             if an error occurs.
   */
  private Artist addArtist(String name) {
    // special case treatments
    Artist artist = ArtistImpl.create(name, this.source);

    this.artists.put(name, artist);
    if (!this.lazy) {
      artist.loadAllTracks();
    }

    return artist;
  }
View Full Code Here

public class DefaultTrack extends TrackImpl {

  protected DefaultTrack(Source source, IITTrack itTrack){
    super(source, itTrack);
    try {
      Artist albumArtist = this.getArtist(); // AlbumArtist is not part of IITTrack
      this.album = this.source.getAlbum(itTrack.getAlbum(), albumArtist);
    } catch (TrackDeletedException e) {
      throw new JitcaInitializationError("Track could not be initialized, because Object has been deleted!");
    }
  }
View Full Code Here

   
    EasyMock.replay(libraryMock);
    EasyMock.replay(trackCollectionMock);
    EasyMock.replay(trackFactoryMock);
   
    Artist albumArtist = ArtistImpl.create("Nelly Furtado", libraryMock);
    Album loose = new AlbumImpl("Loose", albumArtist, libraryMock);
    Album folklore = new AlbumImpl("Folklore", albumArtist, libraryMock);
   
    EasyMock.reset(libraryMock);
    EasyMock.expect(libraryMock.getAlbum("Loose", albumArtist)).andReturn(loose);
View Full Code Here

  private Source createSourceMock(){
    Source sourceMock = EasyMock.createMock(Source.class);
    EasyMock.expect(sourceMock.isLazy()).andReturn(true).anyTimes();
    EasyMock.expect(sourceMock.getTrackFactory()).andReturn(null).anyTimes();
   
    Artist michael = EasyMock.createMock(Artist.class);
    Artist paul = EasyMock.createMock(Artist.class);
   
    Artist memberA = EasyMock.createMock(Artist.class);
    Artist memberB = EasyMock.createMock(Artist.class);
    Artist memberC = EasyMock.createMock(Artist.class);
    Artist memberD = EasyMock.createMock(Artist.class);
   
    EasyMock.expect(michael.getName()).andReturn("Michael Jackson").anyTimes();
    EasyMock.expect(paul.getName()).andReturn("Paul McCartney").anyTimes();
    EasyMock.expect(sourceMock.getArtist("Michael Jackson")).andReturn(michael).anyTimes();
    EasyMock.expect(sourceMock.getArtist("Paul McCartney")).andReturn(paul).anyTimes();
   
    EasyMock.expect(memberA.getName()).andReturn("MemberA").anyTimes();
    EasyMock.expect(sourceMock.getArtist("MemberA")).andReturn(memberA).anyTimes();
   
    EasyMock.expect(memberB.getName()).andReturn("MemberB").anyTimes();
    EasyMock.expect(sourceMock.getArtist("MemberB")).andReturn(memberB).anyTimes();
   
    EasyMock.expect(memberC.getName()).andReturn("MemberC").anyTimes();
    EasyMock.expect(sourceMock.getArtist("MemberC")).andReturn(memberC).anyTimes();
   
    EasyMock.expect(memberD.getName()).andReturn("MemberD").anyTimes();
    EasyMock.expect(sourceMock.getArtist("MemberD")).andReturn(memberD).anyTimes();
   
    EasyMock.replay(michael);
    EasyMock.replay(paul);
    EasyMock.replay(memberA);
View Full Code Here

    EasyMock.expect(iTunesMock.getLibraryPlaylist()).andReturn(null).anyTimes();
    EasyMock.replay(iTunesMock);
   
    Source source = new UserLibraryImpl(true, iTunesMock);
   
    Artist michaelAndPaul = source.getArtist("Michael Jackson, Paul McCartney");
   
    assertTrue(michaelAndPaul instanceof GroupArtist);
    assertTrue(source.getArtistFactory().getManagedArtists().size() == 3);
  }
View Full Code Here

 
  @Test
  public void ConstructorTest(){
    Source sourceMock = this.createSourceMock();
   
    Artist singleArtist = ArtistImpl.create("SingleArtist", sourceMock);
    Artist group = new GroupArtistImpl("Group", sourceMock);
   
    assertFalse(singleArtist.isGroup());
    assertTrue(group.isGroup());
  }
View Full Code Here

 
  @Test
  public void MemberTest(){
    Source sourceMock = this.createSourceMock();
   
    Artist memberOne = ArtistImpl.create("MemberOne", sourceMock);
    Artist memberTwo = ArtistImpl.create("MemberTwo", sourceMock);
   
    GroupArtist group = new GroupArtistImpl("Group", sourceMock);
   
    assertTrue(group.size() == 0);
   
View Full Code Here

  }
 
  @Test
  public void trackTest(){
    Source sourceMock = this.createSourceMock();
    Artist group = new GroupArtistImpl("Group", sourceMock);
    Artist memberA = ArtistImpl.create("MemberA", sourceMock);
    Artist memberB = ArtistImpl.create("MemberB", sourceMock);
   
    ((GroupArtist) group).addArtist(memberA);
    ((GroupArtist) group).addArtist(memberB);
   
    Track trackMockA = EasyMock.createMock(Track.class);
    group.addTrack(trackMockA);
   
    assertTrue(group.getTracks().contains(trackMockA));
    assertTrue(memberA.getTracks().contains(trackMockA));
    assertTrue(memberB.getTracks().contains(trackMockA));
   
    Track trackMockB = EasyMock.createMock(Track.class);
    group.addTrackAsComposer(trackMockB);
   
    assertTrue(group.getTracksAsComposer().contains(trackMockB));
    assertTrue(memberA.getTracksAsComposer().contains(trackMockB));
    assertTrue(memberB.getTracksAsComposer().contains(trackMockB));
   
  }
View Full Code Here

  protected FileOrCDTrackImpl(Source source, IITFileOrCDTrack itTrack) {
    super(source, itTrack);
    try {
      this.itTrack = itTrack;
      Artist albumArtist = super.source.getArtist(itTrack.getAlbumArtist());
      if (albumArtist == null) {
        albumArtist = this.getArtist();
      }
      super.album = super.source.getAlbum(itTrack.getAlbum(), albumArtist);
    } catch (TrackDeletedException e) {
View Full Code Here

TOP

Related Classes of com.jitcaforwin.extended.api.artist.Artist

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.