mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-10 18:55:03 +00:00
Merge pull request #60 from ClaytonWWilson/layout-improvements
Layout improvements
This commit is contained in:
@@ -46,28 +46,26 @@ public class UserDeleter implements CallHandler {
|
||||
awsCognitoIdentityProvider.adminDeleteUser(adminDeleteUserRequest);
|
||||
|
||||
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement(GET_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
ResultSet userLists = statement.executeQuery();
|
||||
while (userLists.next()) {
|
||||
int listID = userLists.getInt("listID");
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LIST_PRODUCT);
|
||||
statement.setInt(1, listID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
}
|
||||
PreparedStatement statement = connection.prepareStatement(GET_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
ResultSet userLists = statement.executeQuery();
|
||||
while (userLists.next()) {
|
||||
int listID = userLists.getInt("listID");
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
statement = connection.prepareStatement(DELETE_LIST_PRODUCT);
|
||||
statement.setInt(1, listID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
connection.commit();
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
connection.commit();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
30
Lambdas/Lists/User/test/TestUserDeleter.java
Normal file
30
Lambdas/Lists/User/test/TestUserDeleter.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class TestUserDeleter {
|
||||
@Test
|
||||
public void TestUserDelete(){
|
||||
try {
|
||||
testUserDeleter(false);
|
||||
assert(false);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
public void testUserDeleter(boolean shouldThrow) {
|
||||
StatementInjector si = null;
|
||||
try {
|
||||
si = new StatementInjector(null, null, shouldThrow);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String cognitoID = "adbe8b88-9df4-4900-90e1-58dc48b82612";
|
||||
UserDeleter userDeleter = new UserDeleter(si, cognitoID);
|
||||
|
||||
try {
|
||||
userDeleter.conductAction(null, null, cognitoID);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user