From 99d87b7c2c62f6abffa304afb0516eaccdd3d2fc Mon Sep 17 00:00:00 2001 From: Abdulkhakimov <89521577+Abdulkhakimov@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:28:46 +0500 Subject: [PATCH 1/2] [MODORDSTOR-356] - Initial setup of claiming batch job (#791) --- .../service/pieces/flows/update/PieceUpdateFlowManager.java | 3 +++ src/test/java/org/folio/rest/impl/PieceApiTest.java | 5 ++++- .../pieces/flows/update/PieceUpdateFlowManagerTest.java | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManager.java b/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManager.java index d0567b478..1d037421a 100644 --- a/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManager.java +++ b/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManager.java @@ -17,6 +17,8 @@ import io.vertx.core.Promise; import io.vertx.core.json.JsonObject; +import java.util.Date; + public class PieceUpdateFlowManager { private static final Logger logger = LogManager.getLogger(PieceUpdateFlowManager.class); @@ -68,6 +70,7 @@ public Future updatePiece(Piece pieceToUpdate, boolean createItem, boolean logger.debug("receivingStatusStorage -- {}", receivingStatusStorage); logger.debug("receivingStatusUpdate -- {}", receivingStatusUpdate); if (receivingStatusStorage.compareTo(receivingStatusUpdate) != 0) { + holder.getPieceToUpdate().setStatusUpdatedDate(new Date()); pieceService.receiptConsistencyPiecePoLine(messageToEventBus, requestContext); } return null; diff --git a/src/test/java/org/folio/rest/impl/PieceApiTest.java b/src/test/java/org/folio/rest/impl/PieceApiTest.java index f015a2eae..3018ef49a 100644 --- a/src/test/java/org/folio/rest/impl/PieceApiTest.java +++ b/src/test/java/org/folio/rest/impl/PieceApiTest.java @@ -152,7 +152,10 @@ void testPutPiecesByIdTest() throws Exception { pieceRequest.put("receivingStatus", "Received"); addMockEntry(PIECES_STORAGE, pieceStorage); - verifyPut(String.format(PIECES_ID_PATH, pieceId), pieceRequest, "", 204); + verifyPut(String.format(PIECES_ID_PATH, pieceId), pieceRequest, "", 204) + .then() + .assertThat() + .body("statusUpdatedDate", notNullValue());; // Message sent to event bus HandlersTestHelper.verifyReceiptStatusUpdateEvent(1); diff --git a/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java b/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java index 93684a9eb..375886d9b 100644 --- a/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java +++ b/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java @@ -13,8 +13,7 @@ import static org.folio.service.inventory.InventoryManager.HOLDING_PERMANENT_LOCATION_ID; import static org.folio.service.inventory.InventoryManager.ITEM_STATUS; import static org.folio.service.inventory.InventoryManager.ITEM_STATUS_NAME; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; @@ -235,7 +234,7 @@ void shouldUpdateLineQuantityIfPoLineIsNotPackageAndHoldingReferenceChangedAndSh Piece pieceFromStorage = new Piece().withId(pieceId).withPoLineId(lineId).withItemId(itemId).withTitleId(titleId) .withHoldingId(oldHoldingId).withFormat(Piece.Format.ELECTRONIC); Piece incomingPieceToUpdate = new Piece().withId(pieceId).withPoLineId(lineId).withItemId(itemId).withTitleId(titleId) - .withHoldingId(holdingIdToUpdate).withFormat(Piece.Format.ELECTRONIC); + .withHoldingId(holdingIdToUpdate).withFormat(Piece.Format.ELECTRONIC).withReceivingStatus(Piece.ReceivingStatus.RECEIVED); Cost cost = new Cost().withQuantityElectronic(1); Location loc = new Location().withHoldingId(oldHoldingId).withQuantityElectronic(1).withQuantity(1); PoLine poLine = new PoLine().withIsPackage(false).withPurchaseOrderId(orderId).withId(lineId) @@ -265,6 +264,7 @@ void shouldUpdateLineQuantityIfPoLineIsNotPackageAndHoldingReferenceChangedAndSh Piece pieceToUpdate = pieceToUpdateCapture.getValue(); PieceUpdateHolder pieceUpdateHolder = pieceUpdateHolderCapture.getValue(); + assertNotNull(pieceToUpdate.getStatusUpdatedDate()); verify(basePieceFlowHolderBuilder).updateHolderWithOrderInformation(pieceUpdateHolderCapture.capture(), eq(requestContext)); verify(pieceUpdateFlowPoLineService).updatePoLine(pieceUpdateHolderCapture.capture(), eq(requestContext)); verify(pieceUpdateFlowInventoryManager).processInventory(any(PieceUpdateHolder.class), eq(requestContext)); From 2bc8c669eb4dafb444b07f45dd84de2f682dcad9 Mon Sep 17 00:00:00 2001 From: Irakli Merabishvili Date: Tue, 14 Nov 2023 14:13:34 +0400 Subject: [PATCH 2/2] [MODORDERS-966] - Add description to acq unit dto schema --- ramls/acq-models | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ramls/acq-models b/ramls/acq-models index c865c4578..e4f689161 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit c865c45789967686a8a6543a34e702a4f16ba3e7 +Subproject commit e4f6891617f1e93b15abbbd10c492b24908d57b9