use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class TagInfoParserTest method resourceFileCorrectlyParsed.
@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
TagInfoParser parser = new TagInfoParserImpl(new ResourceUtil(TAG_INFO_FILE).getInputStream());
TagInfo tagInfo = parser.getTagInfo();
Assert.assertEquals(NAME, tagInfo.getTagName());
Assert.assertEquals(SUMMARY, tagInfo.getSummary());
Assert.assertEquals(CONTENT, tagInfo.getContent());
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ArtistQueryParserTest method emptyResourceFileCorrectlyParsed.
@Test
public void emptyResourceFileCorrectlyParsed() throws ApplicationException {
ArtistQueryParser parser = new ArtistQueryParserImpl(new ResourceUtil(ARTIST_QUERY_EMPTY_FILE).getInputStream());
MBArtist artist = parser.getArtist();
assertNull(artist);
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ArtistQueryParserTest method resourceFileCorrectlyParsed.
@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
ArtistQueryParser parser = new ArtistQueryParserImpl(new ResourceUtil(ARTIST_QUERY_FILE).getInputStream());
MBArtist artist = parser.getArtist();
assertEquals(MBID, artist.getMbid());
assertEquals(NAME, artist.getName());
assertEquals(COUNTRY_CODE, artist.getCountryCode());
assertEquals(START_YEAR, artist.getStartYear());
assertEquals(ACTIVE, artist.isActive());
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ArtistQueryParserTest method dateGetsStoredAsYearOnly.
@Test
public void dateGetsStoredAsYearOnly() throws ApplicationException {
ArtistQueryParser parser = new ArtistQueryParserImpl(new ResourceUtil(ARTIST_QUERY_DATE_FILE).getInputStream());
MBArtist artist = parser.getArtist();
assertEquals(YEAR_PART, artist.getStartYear());
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class DatabaseAdministrationService method getDatabaseUpdates.
/*
* Load the list of database updates, defined in properties file.
* An "update" is an integer number, that maps to a file consisting DDL statements.
* Updates are always run chronologically, as one update may depend on (or alter) a
* previous one (relying on a schema, adding/removing a column of a table etc).
*/
protected List<Integer> getDatabaseUpdates() {
List<Integer> updates = new ArrayList<>();
Properties props = new Properties();
try (ResourceUtil resourceUtil = new ResourceUtil(VERSION_PROPERTIES)) {
props.load(resourceUtil.getInputStream());
} catch (IOException e) {
LOG.warn("Could not load database updates list!", e);
}
for (Object key : props.keySet()) {
updates.add(toInt(key.toString()));
}
Collections.sort(updates);
return updates;
}
Aggregations