mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-11 02:55:04 +00:00
Add Core Lambda Unit tests
This commit is contained in:
@@ -13,13 +13,12 @@ public class DBConnector {
|
||||
Connection connection;
|
||||
|
||||
public DBConnector() throws IOException, SQLException, ClassNotFoundException {
|
||||
this(loadProperties("dbProperties.json"));
|
||||
this(loadProperties(DBConnector.class.getResource("dbProperties.json").getPath()));
|
||||
}
|
||||
|
||||
public DBConnector(Properties dbProperties) throws SQLException, ClassNotFoundException {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
System.out.println(dbProperties);
|
||||
System.out.println(DBConnector.buildURL(dbProperties));
|
||||
connection = DriverManager.getConnection(dbProperties.get("url").toString(), dbProperties.get("user").toString(), dbProperties.get("password").toString());
|
||||
System.out.println(connection);
|
||||
}
|
||||
@@ -43,11 +42,4 @@ public class DBConnector {
|
||||
propertiesJSON.keys().forEachRemaining(key -> toReturn.setProperty(key, propertiesJSON.get(key).toString()));
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static String buildURL(Properties dbProperties) {
|
||||
String dbURL = dbProperties.get("url").toString();
|
||||
dbURL += "?user=" + dbProperties.get("user").toString();
|
||||
dbURL += "&password=" + dbProperties.get("password").toString();
|
||||
return dbURL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,7 @@ public class InputUtils {
|
||||
public static String getCognitoIDFromBody(Map<String, Object> inputMap) {
|
||||
System.out.println(inputMap.keySet());
|
||||
System.out.println(inputMap.entrySet());
|
||||
Map<String, Object> contextMap;
|
||||
if ((inputMap.get("context") != null) && (inputMap.get("context") instanceof Map<?, ?>)) {
|
||||
contextMap = ((Map<String, Object>) inputMap.get("context"));
|
||||
} else {
|
||||
throw new IllegalArgumentException("The key \"context\" must exist and be a map");
|
||||
}
|
||||
Map<String, Object> contextMap = getMap(inputMap, "context");
|
||||
System.out.println(inputMap.get("context"));
|
||||
System.out.println(contextMap.get("sub"));
|
||||
return contextMap.get("sub").toString();
|
||||
@@ -25,20 +20,8 @@ public class InputUtils {
|
||||
return getMap(inputMap, "body");
|
||||
}
|
||||
|
||||
private static String getQueryString(Map<String, Object> inputMap) {
|
||||
return (String) (getMap(inputMap, "params").get("querystring"));
|
||||
}
|
||||
|
||||
public static HashMap<String, String> getQueryParams(Map<String, Object> inputMap) {
|
||||
return (HashMap<String, String>) (getMap(inputMap, "params").get("querystring"));
|
||||
|
||||
// String queryString = getQueryString(inputMap);
|
||||
// List<NameValuePair> queryparams = URLEncodedUtils.parse(queryString, StandardCharsets.UTF_8);
|
||||
// HashMap<String, String> mappedParams = new HashMap<>();
|
||||
// for (NameValuePair param : queryparams) {
|
||||
// mappedParams.put(param.getName(), param.getValue());
|
||||
// }
|
||||
// return mappedParams;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user