Skip to content

Commit

Permalink
CIRC-2100 Adding test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh-kalyanasundaram committed Jul 29, 2024
1 parent 6304446 commit 02ecd1a
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public void register(Router router) {
}

private void handlePrintEventStatusRequest(RoutingContext routingContext) {
System.out.println("handlePrintEventStatusRequest **************");
var request = routingContext.body().asJsonObject();
var requestIds = request.getJsonArray("requestIds");
if (requestIds.isEmpty()) {
Expand Down Expand Up @@ -58,21 +57,19 @@ private void handlePrintEventStatusRequest(RoutingContext routingContext) {
throw new RuntimeException(e);
}
});

Map<String, List<JsonObject>> groupByRequestIdMap = new LinkedHashMap<>();
requestIds.forEach(requestId -> {
var requestList = jsonObjectList.stream().filter(jsonObject ->
jsonObject.getJsonArray("requestIds").contains(requestId))
.toList();
groupByRequestIdMap.put((String) requestId, requestList);
});

var jsonObjectResponse = new JsonObject();
var printEventStatusResponses = new ArrayList<>();
jsonObjectResponse.put("printEventsStatusResponses", printEventStatusResponses);
requestIds.forEach(id -> {
var requestDetail = groupByRequestIdMap.get(id);
if (requestDetail !=null && !requestDetail.isEmpty()) {
if (requestDetail != null && !requestDetail.isEmpty()) {
var object = new JsonObject()
.put("requestId", id)
.put("count", requestDetail.size())
Expand Down

0 comments on commit 02ecd1a

Please sign in to comment.