Skip to content

Commit

Permalink
[MODORDSTOR-356] - Initial setup of claiming batch job (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdulkhakimov authored Nov 13, 2023
1 parent aa294fe commit 99d87b7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -68,6 +70,7 @@ public Future<Void> 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;
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/org/folio/rest/impl/PieceApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 99d87b7

Please sign in to comment.