Picture tests addec

This commit is contained in:
Adam Ding
2020-12-01 21:11:25 -05:00
parent 8385888075
commit 337c2e117b
4 changed files with 87 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ public class PictureGetter implements CallHandler {
@Override
public Object conductAction(Map<String, Object> bodyMap, HashMap<String, String> queryMap, String cognitoID) throws SQLException {
PreparedStatement statement = connection.prepareStatement(GET_ITEM);
if (!queryMap.get("id").toString().equals("profile")) {
if (!queryMap.containsKey("id") || !queryMap.get("id").toString().equals("profile")) {
throw new IllegalArgumentException("Only profile pictures are currently supported.");
}
statement.setString(1, cognitoID);

View File

@@ -18,6 +18,9 @@ public class PicturePutter implements CallHandler {
public Object conductAction(Map<String, Object> bodyMap, HashMap<String, String> queryString, String cognitoID) throws SQLException {
PreparedStatement storePicture = connection.prepareStatement(STORE_PICTURE_SQL);
if(!bodyMap.containsKey("base64EncodedImage")) {
throw new IllegalArgumentException("Base64EncodedImage not found");
}
storePicture.setString(1, cognitoID);
storePicture.setString(2, bodyMap.get("base64EncodedImage").toString());
System.out.println(storePicture);