Search in sources :

Example 1 with CheckinCollection

use of org.folio.rest.jaxrs.model.CheckinCollection in project mod-orders by folio-org.

the class ReceivingCheckinProtectionTest method testCheckInCompositeFlow.

@Test
void testCheckInCompositeFlow() {
    addMockEntry(PURCHASE_ORDER_STORAGE, JsonObject.mapFrom(getMinimalContentCompositePurchaseOrder().withAcqUnitIds(NOT_PROTECTED_UNITS).withId(ORDER_WITH_NOT_PROTECTED_UNITS_ID)));
    addMockEntry(PURCHASE_ORDER_STORAGE, JsonObject.mapFrom(getMinimalContentCompositePurchaseOrder().withAcqUnitIds(PROTECTED_UNITS).withId(ORDER_WITH_PROTECTED_UNITS_ID)));
    List<CompositePoLine> poLines = new ArrayList<>();
    poLines.add(getMinimalContentCompositePoLine(ORDER_WITH_NOT_PROTECTED_UNITS_ID).withId(EXPECTED_FLOW_PO_LINE_ID));
    poLines.add(getMinimalContentCompositePoLine(ORDER_WITH_NOT_PROTECTED_UNITS_ID).withId(RANDOM_PO_LINE_ID_1));
    poLines.add(getMinimalContentCompositePoLine(ORDER_WITH_PROTECTED_UNITS_ID).withId(RANDOM_PO_LINE_ID_2));
    poLines.forEach(line -> addMockEntry(PO_LINES_STORAGE, JsonObject.mapFrom(line)));
    MockServer.addMockTitles(poLines);
    CheckinCollection toBeCheckedInRq = new CheckinCollection();
    List<ToBeCheckedIn> toBeCheckedInList = new ArrayList<>();
    toBeCheckedInList.add(getToBeCheckedIn(EXPECTED_FLOW_PO_LINE_ID, EXPECTED_FLOW_PIECE_ID_1));
    toBeCheckedInList.add(getToBeCheckedIn(RANDOM_PO_LINE_ID_1, getRandomId()));
    toBeCheckedInList.add(getToBeCheckedIn(RANDOM_PO_LINE_ID_2, getRandomId()));
    toBeCheckedInList.add(getToBeCheckedIn(EXPECTED_FLOW_PO_LINE_ID, getRandomId()));
    toBeCheckedInRq.setToBeCheckedIn(toBeCheckedInList);
    toBeCheckedInRq.setTotalRecords(toBeCheckedInList.size());
    ReceivingResults results = verifyPostResponse(Entities.CHECK_IN.getEndpoint(), JsonObject.mapFrom(toBeCheckedInRq).encode(), prepareHeaders(EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10, X_OKAPI_USER_WITH_UNITS_NOT_ASSIGNED_TO_ORDER), APPLICATION_JSON, HttpStatus.HTTP_OK.toInt()).as(ReceivingResults.class);
    List<ProcessingStatus> result = results.getReceivingResults().stream().flatMap(r -> r.getReceivingItemResults().stream().map(ReceivingItemResult::getProcessingStatus)).filter(s -> Objects.isNull(s.getError())).collect(Collectors.toList());
    assertThat(result, hasSize(1));
    List<Error> errors = results.getReceivingResults().stream().flatMap(r -> r.getReceivingItemResults().stream().map(e -> e.getProcessingStatus().getError())).filter(Objects::nonNull).collect(Collectors.toList());
    assertThat(errors, hasSize(toBeCheckedInList.size() - 1));
    assertThat(errors.stream().filter(e -> e.getCode().equals(PIECE_NOT_FOUND.getCode())).count(), is(2L));
    assertThat(errors.stream().filter(e -> e.getCode().equals(USER_HAS_NO_PERMISSIONS.getCode())).count(), is(1L));
}
Also used : Arrays(java.util.Arrays) CheckinCollection(org.folio.rest.jaxrs.model.CheckinCollection) TimeoutException(java.util.concurrent.TimeoutException) ProcessingStatus(org.folio.rest.jaxrs.model.ProcessingStatus) X_OKAPI_USER_ID(org.folio.TestConstants.X_OKAPI_USER_ID) PIECE_NOT_FOUND(org.folio.rest.core.exceptions.ErrorCodes.PIECE_NOT_FOUND) ApiTestSuite(org.folio.ApiTestSuite) AfterAll(org.junit.jupiter.api.AfterAll) MockServer(org.folio.rest.impl.MockServer) BeforeAll(org.junit.jupiter.api.BeforeAll) JsonObject(io.vertx.core.json.JsonObject) TestUtils.getMinimalContentCompositePurchaseOrder(org.folio.TestUtils.getMinimalContentCompositePurchaseOrder) APPLICATION_JSON(javax.ws.rs.core.MediaType.APPLICATION_JSON) TestConfig.clearServiceInteractions(org.folio.TestConfig.clearServiceInteractions) Matchers.allOf(org.hamcrest.Matchers.allOf) ReceivingResults(org.folio.rest.jaxrs.model.ReceivingResults) Collectors(java.util.stream.Collectors) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) TestConfig.isVerticleNotDeployed(org.folio.TestConfig.isVerticleNotDeployed) Objects(java.util.Objects) Test(org.junit.jupiter.api.Test) ReceivingCollection(org.folio.rest.jaxrs.model.ReceivingCollection) List(java.util.List) Logger(org.apache.logging.log4j.Logger) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) PO_LINES_STORAGE(org.folio.orders.utils.ResourcePathResolver.PO_LINES_STORAGE) MockServer.addMockEntry(org.folio.rest.impl.MockServer.addMockEntry) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Matchers.is(org.hamcrest.Matchers.is) ORDERS_RECEIVING_ENDPOINT(org.folio.TestConstants.ORDERS_RECEIVING_ENDPOINT) USER_HAS_NO_PERMISSIONS(org.folio.rest.core.exceptions.ErrorCodes.USER_HAS_NO_PERMISSIONS) TestUtils.getRandomId(org.folio.TestUtils.getRandomId) TestUtils.getToBeReceived(org.folio.TestUtils.getToBeReceived) EnumSource(org.junit.jupiter.params.provider.EnumSource) ArrayList(java.util.ArrayList) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) Every.everyItem(org.hamcrest.core.Every.everyItem) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) RestTestUtils.prepareHeaders(org.folio.RestTestUtils.prepareHeaders) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ReceivingItemResult(org.folio.rest.jaxrs.model.ReceivingItemResult) EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10(org.folio.TestConstants.EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10) ToBeCheckedIn(org.folio.rest.jaxrs.model.ToBeCheckedIn) PURCHASE_ORDER_STORAGE(org.folio.orders.utils.ResourcePathResolver.PURCHASE_ORDER_STORAGE) Matchers.empty(org.hamcrest.Matchers.empty) RestTestUtils.verifyPostResponse(org.folio.RestTestUtils.verifyPostResponse) TestUtils.getToBeCheckedIn(org.folio.TestUtils.getToBeCheckedIn) ToBeReceived(org.folio.rest.jaxrs.model.ToBeReceived) TestConfig.initSpringContext(org.folio.TestConfig.initSpringContext) ExecutionException(java.util.concurrent.ExecutionException) Error(org.folio.rest.jaxrs.model.Error) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ORDERS_CHECKIN_ENDPOINT(org.folio.TestConstants.ORDERS_CHECKIN_ENDPOINT) HttpStatus(org.folio.HttpStatus) ApplicationConfig(org.folio.config.ApplicationConfig) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) CheckinCollection(org.folio.rest.jaxrs.model.CheckinCollection) ArrayList(java.util.ArrayList) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) Error(org.folio.rest.jaxrs.model.Error) ReceivingResults(org.folio.rest.jaxrs.model.ReceivingResults) ProcessingStatus(org.folio.rest.jaxrs.model.ProcessingStatus) ToBeCheckedIn(org.folio.rest.jaxrs.model.ToBeCheckedIn) TestUtils.getToBeCheckedIn(org.folio.TestUtils.getToBeCheckedIn) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with CheckinCollection

use of org.folio.rest.jaxrs.model.CheckinCollection in project mod-orders by folio-org.

the class CheckinReceivingApiTest method testPostCheckinElectronicPhysicalChangeLocationIdNewHoldingIsCreatedForPhysicalPiece.

@Test
void testPostCheckinElectronicPhysicalChangeLocationIdNewHoldingIsCreatedForPhysicalPiece() {
    logger.info("=== Test POST check-in - Check-in physical and electronic resource with new locationId ===");
    CompositePurchaseOrder order = getMinimalContentCompositePurchaseOrder();
    CompositePoLine poLine = getMinimalContentCompositePoLine(order.getId());
    poLine.setOrderFormat(CompositePoLine.OrderFormat.P_E_MIX);
    // holding mustn't be created
    poLine.setEresource(new Eresource().withCreateInventory(Eresource.CreateInventory.INSTANCE));
    // holding must be created
    poLine.setPhysical(new Physical().withCreateInventory(Physical.CreateInventory.INSTANCE_HOLDING));
    String locationForPhysical = UUID.randomUUID().toString();
    String locationForElectronic = UUID.randomUUID().toString();
    String titleId = UUID.randomUUID().toString();
    MockServer.addMockTitleWithId(poLine, titleId);
    Piece physicalPiece = getMinimalContentPiece(poLine.getId()).withReceivingStatus(Piece.ReceivingStatus.EXPECTED).withFormat(org.folio.rest.jaxrs.model.Piece.Format.PHYSICAL).withLocationId(locationForPhysical).withId(UUID.randomUUID().toString()).withTitleId(titleId).withItemId(UUID.randomUUID().toString());
    Piece electronicPiece = getMinimalContentPiece(poLine.getId()).withReceivingStatus(Piece.ReceivingStatus.EXPECTED).withFormat(org.folio.rest.jaxrs.model.Piece.Format.ELECTRONIC).withId(UUID.randomUUID().toString()).withTitleId(titleId).withItemId(UUID.randomUUID().toString());
    addMockEntry(PURCHASE_ORDER_STORAGE, order.withWorkflowStatus(CompositePurchaseOrder.WorkflowStatus.OPEN));
    addMockEntry(PO_LINES_STORAGE, poLine);
    addMockEntry(PIECES_STORAGE, physicalPiece);
    addMockEntry(PIECES_STORAGE, electronicPiece);
    List<ToBeCheckedIn> toBeCheckedInList = new ArrayList<>();
    toBeCheckedInList.add(new ToBeCheckedIn().withCheckedIn(1).withPoLineId(poLine.getId()).withCheckInPieces(Arrays.asList(new CheckInPiece().withItemStatus(CheckInPiece.ItemStatus.ON_ORDER), new CheckInPiece().withItemStatus(CheckInPiece.ItemStatus.ON_ORDER))));
    CheckinCollection request = new CheckinCollection().withToBeCheckedIn(toBeCheckedInList).withTotalRecords(2);
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setId(physicalPiece.getId());
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setLocationId(locationForPhysical);
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(1).setId(electronicPiece.getId());
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(1).setLocationId(locationForElectronic);
    checkResultWithErrors(request, 0);
    assertThat(getCreatedHoldings(), hasSize(1));
    assertThat(getCreatedHoldings().get(0).getString(HOLDING_PERMANENT_LOCATION_ID), is(locationForPhysical));
}
Also used : Physical(org.folio.rest.jaxrs.model.Physical) PoLineCommonUtil.isHoldingUpdateRequiredForPhysical(org.folio.orders.utils.PoLineCommonUtil.isHoldingUpdateRequiredForPhysical) CheckinCollection(org.folio.rest.jaxrs.model.CheckinCollection) CheckInPiece(org.folio.rest.jaxrs.model.CheckInPiece) Piece(org.folio.rest.jaxrs.model.Piece) TestUtils.getMinimalContentPiece(org.folio.TestUtils.getMinimalContentPiece) ArrayList(java.util.ArrayList) CheckInPiece(org.folio.rest.jaxrs.model.CheckInPiece) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) Matchers.emptyString(org.hamcrest.Matchers.emptyString) TestUtils.getMinimalContentCompositePurchaseOrder(org.folio.TestUtils.getMinimalContentCompositePurchaseOrder) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) PoLineCommonUtil.isHoldingUpdateRequiredForEresource(org.folio.orders.utils.PoLineCommonUtil.isHoldingUpdateRequiredForEresource) Eresource(org.folio.rest.jaxrs.model.Eresource) ToBeCheckedIn(org.folio.rest.jaxrs.model.ToBeCheckedIn) Test(org.junit.jupiter.api.Test)

Example 3 with CheckinCollection

use of org.folio.rest.jaxrs.model.CheckinCollection in project mod-orders by folio-org.

the class CheckinReceivingApiTest method testPostCheckinTitleNotFoundError.

@Test
void testPostCheckinTitleNotFoundError() {
    logger.info("=== Test POST check-in title not found error ===");
    CompositePurchaseOrder order = getMinimalContentCompositePurchaseOrder();
    CompositePoLine poLine = getMinimalContentCompositePoLine(order.getId());
    poLine.setIsPackage(true);
    poLine.setOrderFormat(CompositePoLine.OrderFormat.ELECTRONIC_RESOURCE);
    poLine.setEresource(new Eresource().withCreateInventory(Eresource.CreateInventory.INSTANCE_HOLDING_ITEM));
    String locationForElectronic = UUID.randomUUID().toString();
    Piece electronicPiece = getMinimalContentPiece(poLine.getId()).withReceivingStatus(Piece.ReceivingStatus.EXPECTED).withFormat(org.folio.rest.jaxrs.model.Piece.Format.ELECTRONIC).withId(UUID.randomUUID().toString()).withTitleId(UUID.randomUUID().toString()).withItemId(UUID.randomUUID().toString());
    addMockEntry(PURCHASE_ORDER_STORAGE, order.withWorkflowStatus(CompositePurchaseOrder.WorkflowStatus.OPEN));
    addMockEntry(PO_LINES_STORAGE, poLine);
    addMockEntry(PIECES_STORAGE, electronicPiece);
    List<ToBeCheckedIn> toBeCheckedInList = new ArrayList<>();
    toBeCheckedInList.add(new ToBeCheckedIn().withCheckedIn(1).withPoLineId(poLine.getId()).withCheckInPieces(Collections.singletonList(new CheckInPiece().withItemStatus(CheckInPiece.ItemStatus.ON_ORDER))));
    CheckinCollection request = new CheckinCollection().withToBeCheckedIn(toBeCheckedInList).withTotalRecords(1);
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setId(electronicPiece.getId());
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setLocationId(locationForElectronic);
    Response response = verifyPostResponse(ORDERS_CHECKIN_ENDPOINT, JsonObject.mapFrom(request).encode(), prepareHeaders(EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10), APPLICATION_JSON, HttpStatus.HTTP_BAD_REQUEST.toInt());
    assertThat(response.as(Errors.class).getErrors().get(0).getMessage(), is(TITLE_NOT_FOUND.getDescription()));
}
Also used : RestTestUtils.verifyPostResponse(org.folio.RestTestUtils.verifyPostResponse) Response(io.restassured.response.Response) CheckinCollection(org.folio.rest.jaxrs.model.CheckinCollection) CheckInPiece(org.folio.rest.jaxrs.model.CheckInPiece) Piece(org.folio.rest.jaxrs.model.Piece) TestUtils.getMinimalContentPiece(org.folio.TestUtils.getMinimalContentPiece) ArrayList(java.util.ArrayList) CheckInPiece(org.folio.rest.jaxrs.model.CheckInPiece) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) Matchers.emptyString(org.hamcrest.Matchers.emptyString) TestUtils.getMinimalContentCompositePurchaseOrder(org.folio.TestUtils.getMinimalContentCompositePurchaseOrder) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) PoLineCommonUtil.isHoldingUpdateRequiredForEresource(org.folio.orders.utils.PoLineCommonUtil.isHoldingUpdateRequiredForEresource) Eresource(org.folio.rest.jaxrs.model.Eresource) ToBeCheckedIn(org.folio.rest.jaxrs.model.ToBeCheckedIn) Test(org.junit.jupiter.api.Test)

Example 4 with CheckinCollection

use of org.folio.rest.jaxrs.model.CheckinCollection in project mod-orders by folio-org.

the class CheckinReceivingApiTest method testPostCheckInElectronicWithNoItems.

@Test
void testPostCheckInElectronicWithNoItems() {
    logger.info("=== Test POST Checkin - CheckIn Electronic resource");
    CompositePoLine poLines = getMockAsJson(POLINES_COLLECTION).getJsonArray("poLines").getJsonObject(7).mapTo(CompositePoLine.class);
    MockServer.addMockTitles(Collections.singletonList(poLines));
    CheckinCollection checkInRq = getMockAsJson(CHECKIN_RQ_MOCK_DATA_PATH + "checkin-pe-mix-2-electronic-resources.json").mapTo(CheckinCollection.class);
    ReceivingResults results = verifyPostResponse(ORDERS_CHECKIN_ENDPOINT, JsonObject.mapFrom(checkInRq).encode(), prepareHeaders(EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10), APPLICATION_JSON, 200).as(ReceivingResults.class);
    assertThat(results.getTotalRecords(), equalTo(checkInRq.getTotalRecords()));
    Map<String, Set<String>> pieceIdsByPol = verifyReceivingSuccessRs(results);
    List<JsonObject> pieceSearches = getPieceSearches();
    List<JsonObject> pieceUpdates = getPieceUpdates();
    List<JsonObject> polSearches = getPoLineSearches();
    List<JsonObject> polUpdates = getPoLineUpdates();
    assertThat(pieceSearches, not(nullValue()));
    assertThat(pieceUpdates, not(nullValue()));
    assertThat(getItemsSearches(), is(nullValue()));
    assertThat(getItemUpdates(), is(nullValue()));
    assertThat(polSearches, not(nullValue()));
    assertThat(polUpdates, not(nullValue()));
    int expectedSearchRqQty = Math.floorDiv(checkInRq.getTotalRecords(), MAX_IDS_FOR_GET_RQ) + 1;
    // The piece searches should be made 2 times: 1st time to get all required piece records, 2nd time to calculate expected PO Line status
    assertThat(pieceSearches, hasSize(expectedSearchRqQty + pieceIdsByPol.size()));
    assertThat(pieceUpdates, hasSize(checkInRq.getTotalRecords()));
    assertThat(polSearches, hasSize(pieceIdsByPol.size()));
    assertThat(polUpdates, hasSize(pieceIdsByPol.size()));
    polUpdates.forEach(pol -> {
        PoLine poLine = pol.mapTo(PoLine.class);
        assertThat(poLine.getCheckinItems(), is(true));
        assertThat(poLine.getReceiptStatus(), is(PoLine.ReceiptStatus.PARTIALLY_RECEIVED));
        assertThat(poLine.getReceiptDate(), is(notNullValue()));
    });
    // Verify message is sent via event bus
    verifyCheckinOrderStatusUpdateEvent(1);
}
Also used : CheckinCollection(org.folio.rest.jaxrs.model.CheckinCollection) Set(java.util.Set) HashSet(java.util.HashSet) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) PoLine(org.folio.rest.jaxrs.model.PoLine) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) JsonObject(io.vertx.core.json.JsonObject) Matchers.emptyString(org.hamcrest.Matchers.emptyString) ReceivingResults(org.folio.rest.jaxrs.model.ReceivingResults) Test(org.junit.jupiter.api.Test)

Example 5 with CheckinCollection

use of org.folio.rest.jaxrs.model.CheckinCollection in project mod-orders by folio-org.

the class CheckinReceivingApiTest method testPostCheckInLocationId.

@Test
void testPostCheckInLocationId() {
    logger.info("=== Test POST Checkin - locationId checking ===");
    String poLineId = "fe47e95d-24e9-4a9a-9dc0-bcba64b51f56";
    String pieceId = UUID.randomUUID().toString();
    CompositePoLine poLine = getMockAsJson(POLINES_COLLECTION).getJsonArray("poLines").getJsonObject(5).mapTo(CompositePoLine.class);
    MockServer.addMockTitles(Collections.singletonList(poLine));
    List<ToBeCheckedIn> toBeCheckedInList = new ArrayList<>();
    toBeCheckedInList.add(new ToBeCheckedIn().withCheckedIn(1).withPoLineId(poLineId).withCheckInPieces(Arrays.asList(new CheckInPiece().withId(pieceId).withItemStatus(CheckInPiece.ItemStatus.ON_ORDER), new CheckInPiece().withItemStatus(CheckInPiece.ItemStatus.IN_PROCESS))));
    CheckinCollection request = new CheckinCollection().withToBeCheckedIn(toBeCheckedInList).withTotalRecords(2);
    String physicalPieceWithoutLocationId = "90894300-5285-4d83-80f4-76cf621e555e";
    String electronicPieceWithoutLocationId = "1a247602-c51a-4221-9a07-27d075d03625";
    // Positive cases:
    // 1. Both CheckInPiece with locationId
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setId(physicalPieceWithoutLocationId);
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setLocationId(UUID.randomUUID().toString());
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(1).setId(electronicPieceWithoutLocationId);
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(1).setLocationId(UUID.randomUUID().toString());
    checkResultWithErrors(request, 0);
    assertThat(getPieceSearches(), hasSize(2));
    assertThat(getPieceUpdates(), hasSize(2));
    assertThat(getPoLineSearches(), hasSize(1));
    assertThat(getPoLineUpdates(), hasSize(1));
    verifyCheckinOrderStatusUpdateEvent(1);
    // Negative cases:
    // 1. One CheckInPiece and corresponding Piece without locationId
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setLocationId(null);
    clearServiceInteractions();
    MockServer.addMockTitles(Collections.singletonList(poLine));
    checkResultWithErrors(request, 1);
    assertThat(getPieceSearches(), hasSize(2));
    assertThat(getPieceUpdates(), hasSize(1));
    assertThat(getPoLineSearches(), hasSize(1));
    assertThat(getPoLineUpdates(), hasSize(1));
    verifyCheckinOrderStatusUpdateEvent(1);
    // 2. All CheckInPieces and corresponding Pieces without locationId
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(0).setLocationId(null);
    request.getToBeCheckedIn().get(0).getCheckInPieces().get(1).setLocationId(null);
    clearServiceInteractions();
    MockServer.addMockTitles(Collections.singletonList(poLine));
    checkResultWithErrors(request, 2);
    assertThat(getPieceSearches(), hasSize(1));
    assertThat(getPieceUpdates(), nullValue());
    assertThat(getPoLineSearches(), hasSize(1));
    assertThat(getPoLineUpdates(), nullValue());
    verifyOrderStatusUpdateEvent(0);
}
Also used : CheckinCollection(org.folio.rest.jaxrs.model.CheckinCollection) ArrayList(java.util.ArrayList) CheckInPiece(org.folio.rest.jaxrs.model.CheckInPiece) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) Matchers.emptyString(org.hamcrest.Matchers.emptyString) ToBeCheckedIn(org.folio.rest.jaxrs.model.ToBeCheckedIn) Test(org.junit.jupiter.api.Test)

Aggregations

CheckinCollection (org.folio.rest.jaxrs.model.CheckinCollection)13 TestUtils.getMinimalContentCompositePoLine (org.folio.TestUtils.getMinimalContentCompositePoLine)10 CompositePoLine (org.folio.rest.jaxrs.model.CompositePoLine)10 Test (org.junit.jupiter.api.Test)10 ToBeCheckedIn (org.folio.rest.jaxrs.model.ToBeCheckedIn)9 ArrayList (java.util.ArrayList)8 CheckInPiece (org.folio.rest.jaxrs.model.CheckInPiece)7 JsonObject (io.vertx.core.json.JsonObject)6 TestUtils.getMinimalContentCompositePurchaseOrder (org.folio.TestUtils.getMinimalContentCompositePurchaseOrder)6 CompositePurchaseOrder (org.folio.rest.jaxrs.model.CompositePurchaseOrder)6 Piece (org.folio.rest.jaxrs.model.Piece)5 ReceivingResults (org.folio.rest.jaxrs.model.ReceivingResults)5 Matchers.emptyString (org.hamcrest.Matchers.emptyString)5 PoLine (org.folio.rest.jaxrs.model.PoLine)4 List (java.util.List)3 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3 RestTestUtils.verifyPostResponse (org.folio.RestTestUtils.verifyPostResponse)3 TestUtils.getMinimalContentPiece (org.folio.TestUtils.getMinimalContentPiece)3 PoLineCommonUtil.isHoldingUpdateRequiredForEresource (org.folio.orders.utils.PoLineCommonUtil.isHoldingUpdateRequiredForEresource)3