Package com.github.hakko.musiccabinet.domain.model.library

Examples of com.github.hakko.musiccabinet.domain.model.library.File


public class UnittestLibraryUtil {

  private static int counter = 0;
 
  public static File getFile() {
    File file = new File("/unittest", "/unittest/file" + counter++ + ".ogg", new DateTime(), 0);
    MetaData md = new MetaData();
    md.setArtist("Unittest Artist");
    md.setAlbum("Unittest Album " + counter);
    md.setTitle("Unittest Title " + counter);
    md.setBitrate((short) 144);
    md.setVbr(false);
    md.setDuration((short) 90);
    md.setYear((short) 1900);
    md.setMediaType(Mediatype.OGG);
    file.setMetaData(md);
    return file;
  }
View Full Code Here


    file.setMetaData(md);
    return file;
  }

  public static File getFile(String directory, String filename) {
    File file = getFile();
    file.setDirectory(directory);
    file.setFilename(filename);
    return file;
  }
View Full Code Here

    file.setFilename(filename);
    return file;
  }
 
  public static File getFile(String artist, String album, String title) {
    File file = getFile();
    MetaData md = file.getMetadata();
    if (artist != null) md.setArtist(artist);
    if (album != null) md.setAlbum(album);
    if (title != null) md.setTitle(title);
    return file;
  }
View Full Code Here

    PostgreSQLUtil.truncateTables(dao);

    lastFmDao.createOrUpdateLastFmUser(user1);
    lastFmDao.createOrUpdateLastFmUser(user2);

    File file1 = getFile(artistName1, albumName1, trackName1),
        file2 = getFile(artistName2, albumName2, trackName2);
    submitFile(additionDao, Arrays.asList(file1, file2));

    List<Artist> artists = browserDao.getArtists();
    assertEquals(2, artists.size());
View Full Code Here

    assertEquals(track1, userStarredTracks.get(0).getStarredTrack());
  }

  @Test
  public void onlyTracksFromEarliestAlbumsAreStarredWhenImportingLovedTracks() {
    File f1, f2, f3, f4, f5;
    deleteLovedAndStarredTracks();
    additionDao.getJdbcTemplate().execute("truncate library.directory cascade");
    submitFile(additionDao, asList(
        f1 = getFile(artistName1, albumName1, trackName1, (short) 2006),
        f2 = getFile(artistName1, albumName2, trackName1, (short) 1999),
View Full Code Here

    user1 = new LastFmUser(username1 = "user1");
    user2 = new LastFmUser(username2 = "user2");
    lastFmDao.createOrUpdateLastFmUser(user1);
    lastFmDao.createOrUpdateLastFmUser(user2);

    File file1 = UnittestLibraryUtil.getFile("artist1", "album1", "title1");
    File file2 = UnittestLibraryUtil.getFile("artist1", "album1", "title2");
    File file3 = UnittestLibraryUtil.getFile("artist2", "album2", "title3");
    submitFile(additionDao, Arrays.asList(file1, file2, file3));
   
    List<Artist> artists = browserDao.getArtists();
    assertEquals(2, artists.size());
    artist1 = artists.get(0);
View Full Code Here

  }
 
  @Test
  public void returnsUniqueTagsFoundInLibraryFiles() {
   
    File file1 = UnittestLibraryUtil.getFile();
    File file2 = UnittestLibraryUtil.getFile();
    File file3 = UnittestLibraryUtil.getFile();
   
    file1.getMetadata().setGenre("drone");
    file2.getMetadata().setGenre("disco");
    file3.getMetadata().setGenre("drone");
   
    additionDao.addFiles(file1.getDirectory(), set(file1, file2, file3));
    additionDao.updateLibrary();
   
    List<String> fileTags = dao.getFileTags();
View Full Code Here

    if (title != null) md.setTitle(title);
    return file;
  }

  public static File getFile(String artist, String album, String title, short year) {
    File file = getFile(artist, album, title);
    file.getMetadata().setYear(year);
    return file;
  }
View Full Code Here

  @Test
  public void identifiesArtistsWithoutInvocations() {
    deleteLibraryTracks();
    deleteWebserviceInvocations();

    File file = UnittestLibraryUtil.getFile("Madonna", null, "Jump");
    UnittestLibraryUtil.submitFile(additionDao, file);
   
    final Calltype INFO = ARTIST_GET_INFO, TOP_TRACKS = ARTIST_GET_TOP_TRACKS;
    final String MADONNA = file.getMetadata().getArtist();
    List<String> artistInfo, artistTopTracks;
    artistInfo = dao.getArtistNamesWithNoInvocations(INFO);
    artistTopTracks = dao.getArtistNamesWithNoInvocations(TOP_TRACKS);
   
    Assert.assertNotNull(artistInfo);
View Full Code Here

  }
 
  private void clearLibraryAndAddCherTrack() throws ApplicationException {
    PostgreSQLUtil.truncateTables(artistTopTagsDao);

    File file = getFile(artistName, null, "Believe");
    UnittestLibraryUtil.submitFile(additionDao, file);
  }
View Full Code Here

TOP

Related Classes of com.github.hakko.musiccabinet.domain.model.library.File

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.