Skip to content

Commit

Permalink
fix: Rename deletedUserIds to deletedIds
Browse files Browse the repository at this point in the history
  • Loading branch information
anku255 committed Feb 28, 2024
1 parent bee759c commit 61c9225
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,22 +211,22 @@ protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws
}

try {
List<String> deletedUserIds = BulkImport.deleteUsers(appIdentifierWithStorage, userIds);
List<String> deletedIds = BulkImport.deleteUsers(appIdentifierWithStorage, userIds);

JsonArray deletedUserIdsJson = new JsonArray();
JsonArray invalidUserIds = new JsonArray();
JsonArray deletedIdsJson = new JsonArray();
JsonArray invalidIds = new JsonArray();

for (String userId : userIds) {
if (deletedUserIds.contains(userId)) {
deletedUserIdsJson.add(new JsonPrimitive(userId));
if (deletedIds.contains(userId)) {
deletedIdsJson.add(new JsonPrimitive(userId));
} else {
invalidUserIds.add(new JsonPrimitive(userId));
invalidIds.add(new JsonPrimitive(userId));
}
}

JsonObject result = new JsonObject();
result.add("deletedUserIds", deletedUserIdsJson);
result.add("invalidUserIds", invalidUserIds);
result.add("deletedIds", deletedIdsJson);
result.add("invalidIds", invalidIds);

super.sendJsonResponse(200, result, resp);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,15 @@ public void shouldReturn200Response() throws Exception {

request.add("ids", validIds);


JsonObject response = HttpRequestForTesting.sendJsonDELETERequest(process.getProcess(), "",
"http://localhost:3567/bulk-import/users",
request, 1000000, 1000000, null, Utils.getCdiVersionStringLatestForTests(), null);

response.get("deletedUserIds").getAsJsonArray().forEach(id -> {
response.get("deletedIds").getAsJsonArray().forEach(id -> {
assertTrue(validIds.contains(id));
});

assertEquals(invalidId, response.get("invalidUserIds").getAsJsonArray().get(0).getAsString());
assertEquals(invalidId, response.get("invalidIds").getAsJsonArray().get(0).getAsString());

process.kill();
Assert.assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STOPPED));
Expand Down

0 comments on commit 61c9225

Please sign in to comment.