diff --git a/src/main/java/org/folio/service/claiming/ClaimingService.java b/src/main/java/org/folio/service/claiming/ClaimingService.java index 0254a2cfc..d3c3c614b 100644 --- a/src/main/java/org/folio/service/claiming/ClaimingService.java +++ b/src/main/java/org/folio/service/claiming/ClaimingService.java @@ -109,6 +109,7 @@ private Future>> groupPieceIdsByVendorId(List p logger.info("groupPieceIdsByVendorId:: No pieces are grouped by vendor, pieceIds is empty"); return Future.succeededFuture(); } + logger.info("groupPieceIdsByVendorId:: Grouping pieces by vendor"); return pieceStorageService.getPiecesByIds(pieceIds, requestContext) .compose(pieces -> { var uniquePiecePoLinePairs = pieces.stream() diff --git a/src/main/java/org/folio/service/pieces/PieceStorageService.java b/src/main/java/org/folio/service/pieces/PieceStorageService.java index b89a19eb2..3aff04d28 100644 --- a/src/main/java/org/folio/service/pieces/PieceStorageService.java +++ b/src/main/java/org/folio/service/pieces/PieceStorageService.java @@ -135,6 +135,7 @@ public Future getAllPieces(String query, RequestContext request } public Future getAllPieces(int limit, int offset, String query, RequestContext requestContext) { + log.info("getAllPieces:: limit: {}, offset: {}, query: {}", limit, offset, query); var requestEntry = new RequestEntry(PIECE_STORAGE_ENDPOINT).withQuery(query).withOffset(offset).withLimit(limit); return restClient.get(requestEntry, PieceCollection.class, requestContext); } @@ -155,7 +156,7 @@ private Future> getUserTenantsIfNeeded(RequestContext requestContex } public Future> getPiecesByIds(List pieceIds, RequestContext requestContext) { - log.debug("getPiecesByIds:: start to retrieving pieces by ids: {}", pieceIds); + log.info("getPiecesByIds:: start to retrieving pieces by ids: {}", pieceIds); var futures = ofSubLists(new ArrayList<>(pieceIds), MAX_IDS_FOR_GET_RQ_15) .map(QueryUtils::convertIdsToCqlQuery) .map(query -> getAllPieces(query, requestContext)) diff --git a/src/test/java/org/folio/rest/impl/MockServer.java b/src/test/java/org/folio/rest/impl/MockServer.java index 155987b84..30b2165f0 100644 --- a/src/test/java/org/folio/rest/impl/MockServer.java +++ b/src/test/java/org/folio/rest/impl/MockServer.java @@ -565,7 +565,7 @@ private Optional getMockEntry(String objName, String id) { } private Optional> getMockEntries(String objName, Class tClass) { - List entryList = getRqRsEntries(HttpMethod.SEARCH, objName).stream() + List entryList = getRqRsEntries(HttpMethod.SEARCH, objName).stream() .map(entries -> entries.mapTo(tClass)) .collect(toList()); return Optional.ofNullable(entryList.isEmpty() ? null : entryList); @@ -1937,7 +1937,12 @@ private void handleGetPieces(RoutingContext ctx) { String requestQuery = ctx.request().getParam("query"); MultiMap requestHeaders = ctx.request().headers(); logger.info("handleGetPieces requestPath: {}, requestQuery: {}, requestHeaders: {}", requestPath, requestQuery, requestHeaders); - if (Objects.nonNull(requestQuery) && requestQuery.contains(ID_FOR_PIECES_INTERNAL_SERVER_ERROR)) { + if (Objects.isNull(requestQuery)) { + logger.info("handleGetPieces (empty requestQuery) requestPath: {}, requestHeaders: {}", requestPath, requestHeaders); + PieceCollection pieces = new PieceCollection().withPieces(new ArrayList<>()); + pieces.setTotalRecords(pieces.getPieces().size()); + } else + if (requestQuery.contains(ID_FOR_PIECES_INTERNAL_SERVER_ERROR)) { logger.info("handleGetPieces (with internal server error)"); addServerRqRsData(HttpMethod.GET, PIECES_STORAGE, new JsonObject()); serverResponse(ctx, 500, APPLICATION_JSON, Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase());