1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-13 01:36:18 +00:00

#41: DB: Storage quota and current usage, accessible from /user

This commit is contained in:
jendib
2015-11-24 00:30:01 +01:00
parent dd671795e6
commit 1cae964c09
12 changed files with 107 additions and 96 deletions

View File

@@ -155,7 +155,23 @@ public class ValidationUtil {
try {
return Integer.valueOf(s);
} catch (NumberFormatException e) {
throw new ClientException("Validation Error", MessageFormat.format("{0} is not a number", name));
throw new ClientException("ValidationError", MessageFormat.format("{0} is not a number", name));
}
}
/**
* Checks if the string is a number.
*
* @param s String to validate
* @param name Name of the parameter
* @return Parsed number
* @throws ClientException
*/
public static Long validateLong(String s, String name) throws ClientException {
try {
return Long.valueOf(s);
} catch (NumberFormatException e) {
throw new ClientException("ValidationError", MessageFormat.format("{0} is not a number", name));
}
}

View File

@@ -40,7 +40,7 @@ public class ClientUtil {
form.param("username", username);
form.param("email", username + "@docs.com");
form.param("password", "12345678");
form.param("time_zone", "Asia/Tokyo");
form.param("storage_quota", "1000000"); // 1MB quota
resource.path("/user").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminAuthenticationToken)
.put(Entity.form(form), JsonObject.class);