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:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user