use of com.github.hakko.musiccabinet.parser.lastfm.TrackSimilarityParserImpl in project musiccabinet by hakko.
the class JdbcPlaylistGeneratorDaoTest method addCherSimilarTracksAndGetPlaylist.
@Test
public void addCherSimilarTracksAndGetPlaylist() throws ApplicationException {
TrackSimilarityParser tsParser = new TrackSimilarityParserImpl(new ResourceUtil(CHER_SIMILAR_TRACKS).getInputStream());
trackRelationDao.createTrackRelations(tsParser.getTrack(), tsParser.getTrackRelations());
List<File> files = new ArrayList<>();
for (TrackRelation tr : tsParser.getTrackRelations()) {
String artistName = tr.getTarget().getArtist().getName();
if ("Madonna".equals(artistName)) {
files.add(getFile(artistName, null, tr.getTarget().getName()));
}
}
UnittestLibraryUtil.submitFile(additionDao, files);
int trackId = musicDao.getTrackId(tsParser.getTrack().getArtist().getName(), tsParser.getTrack().getName());
playlistGeneratorDao.updateSearchIndex();
List<PlaylistItem> ts = playlistGeneratorDao.getPlaylistForTrack(trackId);
Assert.assertNotNull(ts);
Assert.assertEquals(2, ts.size());
}
Aggregations