Skip to content

Commit

Permalink
[MODORDERS-1209]. Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
BKadirkhodjaev committed Dec 4, 2024
1 parent a087e92 commit 7097155
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/test/java/org/folio/rest/impl/MockServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1913,17 +1913,18 @@ private void handleGetPieceById(RoutingContext ctx) {
serverResponse(ctx, 500, APPLICATION_JSON, pieceId);
} else {
// Attempt to find POLine in mock server memory
JsonObject body = getMockEntry(PIECES_STORAGE, pieceId).orElse(null);
if (body == null) {
JsonObject data = getMockEntry(PIECES_STORAGE, pieceId).orElse(null);
if (data == null) {
if (PIECE_POLINE_CONSISTENCY_404_POLINE_NOT_FOUND_ID.equals(pieceId)) {
body = new JsonObject(getMockData(PIECE_RECORDS_MOCK_DATA_PATH + "pieceRecord-poline-not-exists-5b454292-6aaa-474f-9510-b59a564e0c8d.json"));
data = new JsonObject(getMockData(PIECE_RECORDS_MOCK_DATA_PATH + "pieceRecord-poline-not-exists-5b454292-6aaa-474f-9510-b59a564e0c8d.json"));
} else if (PIECE_POLINE_CONSISTENT_RECEIPT_STATUS_ID.equals(pieceId)) {
body = new JsonObject(getMockData(PIECE_RECORDS_MOCK_DATA_PATH + "pieceRecord-received-consistent-receipt-status-5b454292-6aaa-474f-9510-b59a564e0c8d2.json"));
data = new JsonObject(getMockData(PIECE_RECORDS_MOCK_DATA_PATH + "pieceRecord-received-consistent-receipt-status-5b454292-6aaa-474f-9510-b59a564e0c8d2.json"));
} else {
body = new JsonObject(getMockData(PIECE_RECORDS_MOCK_DATA_PATH + String.format("pieceRecord-%s.json", pieceId)));
data = new JsonObject(getMockData(PIECE_RECORDS_MOCK_DATA_PATH + String.format("pieceRecord-%s.json", pieceId)));
}
}
serverResponse(ctx, HttpStatus.HTTP_OK.toInt(), APPLICATION_JSON, body.encodePrettily());
logger.info("handleGetPieceById, data: {}", data.encodePrettily());
serverResponse(ctx, HttpStatus.HTTP_OK.toInt(), APPLICATION_JSON, data.encodePrettily());
}
} catch (IOException e) {
serverResponse(ctx, 404, APPLICATION_JSON, pieceId);
Expand Down Expand Up @@ -2009,6 +2010,7 @@ private void handleGetPieces(RoutingContext ctx) {

JsonObject data = JsonObject.mapFrom(pieces);
addServerRqRsData(HttpMethod.GET, PIECES_STORAGE, data);
logger.info("handleGetPieces, data: {}", data.encodePrettily());

ctx.response()
.setStatusCode(200)
Expand Down Expand Up @@ -2153,8 +2155,7 @@ private void addServerRqQuery(String objName, String query) {
private void handleGetPurchaseOrderById(RoutingContext ctx) {
logger.info("handleGetPurchaseOrderById got: GET {}", ctx.request().path());
String id = ctx.request().getParam(ID);
logger.info("id: " + id);

logger.info("id: {}", id);
try {
// Attempt to find PO in mock server memory
JsonObject po = getMockEntry(PURCHASE_ORDER_STORAGE, id).orElse(null);
Expand Down

0 comments on commit 7097155

Please sign in to comment.