use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class JdbcDatabaseAdministrationDaoEnvironmentDependentTest method getPostgresPassword.
private String getPostgresPassword() {
Properties props = new Properties();
try (ResourceUtil resourceUtil = new ResourceUtil("local.jdbc.properties")) {
props.load(resourceUtil.getInputStream());
} catch (IOException e) {
Assert.fail("IOException encountered while reading password!");
}
String password = props.getProperty("musiccabinet.jdbc.password");
Assert.assertNotNull(password);
return password;
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class JdbcUserTopArtistsDaoTest method loadFunctionDependency.
@Before
public void loadFunctionDependency() throws ApplicationException {
PostgreSQLUtil.loadFunction(dao, UPDATE_USER_TOP_ARTISTS);
arnOverall = new UserTopArtists(arn, Period.OVERALL, new UserTopArtistsParserImpl(new ResourceUtil(ARN_OVERALL_FILE).getInputStream()).getArtists());
arn6month = new UserTopArtists(arn, Period.SIX_MONTHS, new UserTopArtistsParserImpl(new ResourceUtil(ARN_6MONTH_FILE).getInputStream()).getArtists());
sys3month = new UserTopArtists(sys, Period.THREE_MONTHS, new UserTopArtistsParserImpl(new ResourceUtil(SYS_3MONTH_FILE).getInputStream()).getArtists());
createArtistMetaData();
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class WSResponseTest method failedKeyResponseValidatesCorrectly.
@Test
public void failedKeyResponseValidatesCorrectly() throws ApplicationException, IOException {
String failedResponse = new ResourceUtil(FAILED_KEY_RESOURCE).getContent();
WSResponse response = new WSResponse(failedResponse);
assertFalse(response.wasCallSuccessful());
assertEquals(26, response.getErrorCode());
assertEquals("Suspended API key", response.getErrorMessage());
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class WSResponseTest method normalResponseValidatesCorrectly.
@Test
public void normalResponseValidatesCorrectly() throws ApplicationException, IOException {
String normalResponse = new ResourceUtil(TOP_TRACKS_RESOURCE).getContent();
WSResponse response = new WSResponse(normalResponse);
assertTrue(response.wasCallSuccessful());
assertEquals(normalResponse, response.getResponseBody());
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class WSResponseTest method failedTrackResponseValidatesCorrectly.
@Test
public void failedTrackResponseValidatesCorrectly() throws ApplicationException, IOException {
String failedResponse = new ResourceUtil(FAILED_TRACK_RESOURCE).getContent();
WSResponse response = new WSResponse(failedResponse);
assertFalse(response.wasCallSuccessful());
assertEquals(6, response.getErrorCode());
assertEquals("Track not found", response.getErrorMessage());
}
Aggregations