Search in sources :

Example 1 with ID_FOR_INTERNAL_SERVER_ERROR

use of org.folio.TestConstants.ID_FOR_INTERNAL_SERVER_ERROR in project mod-orders by folio-org.

the class PurchaseOrdersApiTest method testPutOrdersByIdToChangeStatusToOpenButWithErrorCreatingItemsForSecondPOL.

@Test
void testPutOrdersByIdToChangeStatusToOpenButWithErrorCreatingItemsForSecondPOL() throws Exception {
    logger.info("=== Test Put Order By Id to change Order's status to Open - Inventory errors expected on items creation for second POL ===");
    /*==============  Preparation ==============*/
    // Get Open Order
    CompositePurchaseOrder reqData = getMockDraftOrder().mapTo(CompositePurchaseOrder.class);
    reqData.setId(ID_FOR_PRINT_MONOGRAPH_ORDER);
    reqData.setWorkflowStatus(CompositePurchaseOrder.WorkflowStatus.OPEN);
    MockServer.addMockTitles(reqData.getCompositePoLines());
    int polCount = reqData.getCompositePoLines().size();
    // Make sure that mock PO has 2 lines
    assertThat(reqData.getCompositePoLines(), hasSize(2));
    // Make sure that inventory interaction is expected for each PO line
    for (CompositePoLine pol : reqData.getCompositePoLines()) {
        assertTrue(calculateInventoryItemsQuantity(pol) > 0);
    }
    // Set location ids to one which emulates item creation failure
    CompositePoLine line1 = reqData.getCompositePoLines().get(0);
    CompositePoLine line2 = reqData.getCompositePoLines().get(1);
    reqData.getCompositePoLines().get(1).getLocations().forEach(location -> location.withLocationId(ID_FOR_INTERNAL_SERVER_ERROR));
    reqData.getCompositePoLines().get(1).getLocations().get(0).setLocationId(UUID.randomUUID().toString());
    preparePiecesForCompositePo(reqData);
    String path = String.format(COMPOSITE_ORDERS_BY_ID_PATH, reqData.getId());
    /*==============  Assert result ==============*/
    // Server Error expected as a result because not all items created
    verifyPut(path, JsonObject.mapFrom(reqData), APPLICATION_JSON, 500);
    List<JsonObject> respOrder = MockServer.serverRqRs.get(PURCHASE_ORDER_STORAGE, HttpMethod.GET);
    CompositePurchaseOrder compPo = respOrder.get(0).mapTo(CompositePurchaseOrder.class);
    List<JsonObject> respLines = MockServer.serverRqRs.get(PO_LINES_STORAGE, HttpMethod.PUT);
    CompositePoLine respLine1 = respLines.stream().filter(line -> line.getString(ID).equals(line1.getId())).peek(line -> line.remove("reportingCodes")).map(line -> line.mapTo(CompositePoLine.class)).distinct().findAny().get();
    CompositePoLine respLine2 = respLines.stream().filter(line -> line.getString(ID).equals(line2.getId())).peek(line -> line.remove("reportingCodes")).map(line -> line.mapTo(CompositePoLine.class)).findAny().get();
    compPo.setCompositePoLines(List.of(respLine1, respLine2));
    // Check that search of the existing instances and items was done for each PO line
    List<JsonObject> instancesSearches = getInstancesSearches();
    assertNotNull(instancesSearches);
    assertNotNull(getItemsSearches());
    assertNotNull(getPieceSearches());
    assertEquals(polCount, instancesSearches.size());
    // Check that 2 new instances created and items created successfully only for first POL
    List<JsonObject> createdInstances = getCreatedInstances();
    List<JsonObject> createdPieces = getCreatedPieces();
    assertNotNull(createdInstances);
    assertNotNull(getCreatedItems());
    assertNotNull(createdPieces);
    assertEquals(polCount, createdInstances.size());
    List<JsonObject> items = joinExistingAndNewItems();
    // Check instance Ids not exist for polines
    verifyInstanceLinksNotCreatedForPoLine();
    // Verify pieces were created
    assertEquals(calculateTotalQuantity(compPo.getCompositePoLines().get(0)) + calculateTotalQuantity(compPo.getCompositePoLines().get(1)) - 1, createdPieces.size());
    // Effectively remove non-processed locations with ID_FOR_INTERNAL_SERVER_ERROR to exclude them from
    // created pieces verification
    compPo.getCompositePoLines().forEach(poLine -> poLine.getLocations().removeIf(l -> {
        if (l.getLocationId().equals(ID_FOR_INTERNAL_SERVER_ERROR)) {
            if (poLine.getCost().getQuantityElectronic() != null) {
                poLine.getCost().setQuantityElectronic(poLine.getCost().getQuantityElectronic() - l.getQuantityElectronic());
            }
            if (poLine.getCost().getQuantityPhysical() != null) {
                poLine.getCost().setQuantityPhysical(poLine.getCost().getQuantityPhysical() - l.getQuantityPhysical());
            }
            return true;
        } else {
            return false;
        }
    }));
    verifyPiecesCreated(items, compPo.getCompositePoLines(), createdPieces);
}
Also used : PO_ID_OPEN_TO_BE_CLOSED(org.folio.TestConstants.PO_ID_OPEN_TO_BE_CLOSED) BeforeEach(org.junit.jupiter.api.BeforeEach) PO_WFD_ID_OPEN_STATUS(org.folio.TestConstants.PO_WFD_ID_OPEN_STATUS) ID_BAD_FORMAT(org.folio.TestConstants.ID_BAD_FORMAT) TestUtils.validatePoLineCreationErrorForNonPendingOrder(org.folio.TestUtils.validatePoLineCreationErrorForNonPendingOrder) INVALID_CONFIG_X_OKAPI_TENANT(org.folio.TestConstants.INVALID_CONFIG_X_OKAPI_TENANT) StringUtils(org.apache.commons.lang3.StringUtils) ApiTestSuite(org.folio.ApiTestSuite) ZERO_LOCATION_QTY(org.folio.rest.core.exceptions.ErrorCodes.ZERO_LOCATION_QTY) Mockito.doAnswer(org.mockito.Mockito.doAnswer) Map(java.util.Map) EMPTY_CONFIG_X_OKAPI_TENANT(org.folio.TestConstants.EMPTY_CONFIG_X_OKAPI_TENANT) ZoneOffset(java.time.ZoneOffset) ORDER_VENDOR_NOT_FOUND(org.folio.rest.core.exceptions.ErrorCodes.ORDER_VENDOR_NOT_FOUND) Errors(org.folio.rest.jaxrs.model.Errors) TestConfig.clearServiceInteractions(org.folio.TestConfig.clearServiceInteractions) ID_FOR_INTERNAL_SERVER_ERROR(org.folio.TestConstants.ID_FOR_INTERNAL_SERVER_ERROR) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) ORDER_CLOSED(org.folio.rest.core.exceptions.ErrorCodes.ORDER_CLOSED) Metadata(org.folio.rest.acq.model.finance.Metadata) VENDOR_ISSUE(org.folio.rest.core.exceptions.ErrorCodes.VENDOR_ISSUE) ErrorCodes(org.folio.rest.core.exceptions.ErrorCodes) OTHER(org.folio.rest.jaxrs.model.Piece.Format.OTHER) ZoneId(java.time.ZoneId) TestConfig.mockPort(org.folio.TestConfig.mockPort) Logger(org.apache.logging.log4j.Logger) Eresource(org.folio.rest.jaxrs.model.Eresource) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) MIN_PO_ID(org.folio.TestConstants.MIN_PO_ID) PO_LINES_STORAGE(org.folio.orders.utils.ResourcePathResolver.PO_LINES_STORAGE) MockServer.addMockEntry(org.folio.rest.impl.MockServer.addMockEntry) POProtectedFields(org.folio.orders.utils.POProtectedFields) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) RestClient(org.folio.rest.core.RestClient) INACTIVE_ACCESS_PROVIDER_B(org.folio.TestConstants.INACTIVE_ACCESS_PROVIDER_B) INACTIVE_ACCESS_PROVIDER_A(org.folio.TestConstants.INACTIVE_ACCESS_PROVIDER_A) HelperUtils.calculateInventoryItemsQuantity(org.folio.orders.utils.HelperUtils.calculateInventoryItemsQuantity) PaymentStatus(org.folio.rest.acq.model.PaymentStatus) BUDGET_IS_INACTIVE_TENANT(org.folio.rest.impl.MockServer.BUDGET_IS_INACTIVE_TENANT) ACQUISITIONS_MEMBERSHIPS(org.folio.orders.utils.ResourcePathResolver.ACQUISITIONS_MEMBERSHIPS) Contributor(org.folio.rest.jaxrs.model.Contributor) Every(org.hamcrest.core.Every) Headers(io.restassured.http.Headers) ZERO_COST_ELECTRONIC_QTY(org.folio.rest.core.exceptions.ErrorCodes.ZERO_COST_ELECTRONIC_QTY) OrderFormat(org.folio.rest.jaxrs.model.CompositePoLine.OrderFormat) Answer(org.mockito.stubbing.Answer) MockServer.getHoldingsSearches(org.folio.rest.impl.MockServer.getHoldingsSearches) RestTestUtils.verifySuccessGet(org.folio.RestTestUtils.verifySuccessGet) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) PO_LINES_EMPTY_COLLECTION_ID(org.folio.rest.impl.MockServer.PO_LINES_EMPTY_COLLECTION_ID) Physical(org.folio.rest.jaxrs.model.Physical) EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10(org.folio.TestConstants.EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10) RestTestUtils.verifyPostResponse(org.folio.RestTestUtils.verifyPostResponse) ELECTRONIC_COST_LOC_QTY_MISMATCH(org.folio.rest.core.exceptions.ErrorCodes.ELECTRONIC_COST_LOC_QTY_MISMATCH) MockServer.getPieceSearches(org.folio.rest.impl.MockServer.getPieceSearches) MockServer.getCreatedOrderSummaries(org.folio.rest.impl.MockServer.getCreatedOrderSummaries) PO_LINE_NUMBER(org.folio.orders.utils.ResourcePathResolver.PO_LINE_NUMBER) HelperUtils(org.folio.orders.utils.HelperUtils) TestConfig.initSpringContext(org.folio.TestConfig.initSpringContext) Vertx(io.vertx.core.Vertx) RequestEntry(org.folio.rest.core.models.RequestEntry) IOException(java.io.IOException) X_OKAPI_URL(org.folio.TestConfig.X_OKAPI_URL) BUDGET_NOT_FOUND_FOR_TRANSACTION(org.folio.rest.core.exceptions.ErrorCodes.BUDGET_NOT_FOUND_FOR_TRANSACTION) ITEM_RECORDS(org.folio.rest.impl.MockServer.ITEM_RECORDS) ACQUISITIONS_UNITS(org.folio.orders.utils.ResourcePathResolver.ACQUISITIONS_UNITS) ExecutionException(java.util.concurrent.ExecutionException) PO_LINE_ID_FOR_SUCCESS_CASE(org.folio.TestConstants.PO_LINE_ID_FOR_SUCCESS_CASE) LEDGER_NOT_FOUND_FOR_TRANSACTION_TENANT(org.folio.rest.impl.MockServer.LEDGER_NOT_FOUND_FOR_TRANSACTION_TENANT) AfterEach(org.junit.jupiter.api.AfterEach) BUDGET_NOT_FOUND_FOR_TRANSACTION_TENANT(org.folio.rest.impl.MockServer.BUDGET_NOT_FOUND_FOR_TRANSACTION_TENANT) InventoryInteractionTestHelper.verifyPiecesCreated(org.folio.helper.InventoryInteractionTestHelper.verifyPiecesCreated) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) PHYSICAL(org.folio.rest.jaxrs.model.Piece.Format.PHYSICAL) ENCUMBRANCE_PATH(org.folio.rest.impl.MockServer.ENCUMBRANCE_PATH) MockServer.getInstancesSearches(org.folio.rest.impl.MockServer.getInstancesSearches) PO_ID_PENDING_STATUS_WITH_PO_LINES(org.folio.TestConstants.PO_ID_PENDING_STATUS_WITH_PO_LINES) EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_1(org.folio.TestConstants.EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_1) FUND_CANNOT_BE_PAID_TENANT(org.folio.rest.impl.MockServer.FUND_CANNOT_BE_PAID_TENANT) Date(java.util.Date) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) X_OKAPI_USER_ID(org.folio.TestConstants.X_OKAPI_USER_ID) TITLES(org.folio.orders.utils.ResourcePathResolver.TITLES) TestUtils.getInstanceId(org.folio.TestUtils.getInstanceId) Context(io.vertx.core.Context) ISBN_NOT_VALID(org.folio.rest.core.exceptions.ErrorCodes.ISBN_NOT_VALID) MockServer.getPurchaseOrderUpdates(org.folio.rest.impl.MockServer.getPurchaseOrderUpdates) MockServer.getCreatedItems(org.folio.rest.impl.MockServer.getCreatedItems) ReceiptStatus(org.folio.rest.jaxrs.model.CompositePoLine.ReceiptStatus) TestUtils(org.folio.TestUtils) ID(org.folio.TestConstants.ID) Location(org.folio.rest.jaxrs.model.Location) ORDER_VENDOR_IS_INACTIVE(org.folio.rest.core.exceptions.ErrorCodes.ORDER_VENDOR_IS_INACTIVE) ONGOING_NOT_ALLOWED(org.folio.rest.core.exceptions.ErrorCodes.ONGOING_NOT_ALLOWED) PurchaseOrder(org.folio.rest.jaxrs.model.PurchaseOrder) UUID(java.util.UUID) PO_ID_CLOSED_STATUS(org.folio.TestConstants.PO_ID_CLOSED_STATUS) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) Test(org.junit.jupiter.api.Test) ERROR_CAUSE(org.folio.helper.AbstractHelper.ERROR_CAUSE) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Matchers.equalTo(org.hamcrest.Matchers.equalTo) LocalDate(java.time.LocalDate) POLineFieldNames(org.folio.orders.utils.POLineFieldNames) ACTIVE_ACCESS_PROVIDER_B(org.folio.TestConstants.ACTIVE_ACCESS_PROVIDER_B) POL_LINES_LIMIT_EXCEEDED(org.folio.rest.core.exceptions.ErrorCodes.POL_LINES_LIMIT_EXCEEDED) ACTIVE_ACCESS_PROVIDER_A(org.folio.TestConstants.ACTIVE_ACCESS_PROVIDER_A) InventoryInteractionTestHelper.verifyPiecesQuantityForSuccessCase(org.folio.helper.InventoryInteractionTestHelper.verifyPiecesQuantityForSuccessCase) ZERO_COST_PHYSICAL_QTY(org.folio.rest.core.exceptions.ErrorCodes.ZERO_COST_PHYSICAL_QTY) TestUtils.getMockData(org.folio.TestUtils.getMockData) InventoryInteractionTestHelper.verifyHoldingsCreated(org.folio.helper.InventoryInteractionTestHelper.verifyHoldingsCreated) VENDOR_ID(org.folio.orders.utils.ResourcePathResolver.VENDOR_ID) MISSING_MATERIAL_TYPE(org.folio.rest.core.exceptions.ErrorCodes.MISSING_MATERIAL_TYPE) Encumbrance(org.folio.rest.acq.model.finance.Encumbrance) Matchers.empty(org.hamcrest.Matchers.empty) TestUtils.verifyLocationQuantity(org.folio.TestUtils.verifyLocationQuantity) PO_ID_PENDING_STATUS_WITHOUT_PO_LINES(org.folio.TestConstants.PO_ID_PENDING_STATUS_WITHOUT_PO_LINES) InventoryInteractionTestHelper.verifyItemsCreated(org.folio.helper.InventoryInteractionTestHelper.verifyItemsCreated) MockServer.getLoanTypesSearches(org.folio.rest.impl.MockServer.getLoanTypesSearches) CloseReason(org.folio.rest.jaxrs.model.CloseReason) NON_ZERO_COST_ELECTRONIC_QTY(org.folio.rest.core.exceptions.ErrorCodes.NON_ZERO_COST_ELECTRONIC_QTY) Error(org.folio.rest.jaxrs.model.Error) Collectors.toList(java.util.stream.Collectors.toList) Response(io.restassured.response.Response) ApplicationConfig(org.folio.config.ApplicationConfig) INVALID_LANG(org.folio.TestConstants.INVALID_LANG) POL_ACCESS_PROVIDER_IS_INACTIVE(org.folio.rest.core.exceptions.ErrorCodes.POL_ACCESS_PROVIDER_IS_INACTIVE) LogManager(org.apache.logging.log4j.LogManager) MockServer.getCreatedHoldings(org.folio.rest.impl.MockServer.getCreatedHoldings) MockServer.getInstanceTypesSearches(org.folio.rest.impl.MockServer.getInstanceTypesSearches) Arrays(java.util.Arrays) HelperUtils.calculateTotalQuantity(org.folio.orders.utils.HelperUtils.calculateTotalQuantity) COST_UNIT_PRICE_ELECTRONIC_INVALID(org.folio.rest.core.exceptions.ErrorCodes.COST_UNIT_PRICE_ELECTRONIC_INVALID) Matchers.not(org.hamcrest.Matchers.not) Header(io.restassured.http.Header) NON_EXIST_CONFIG_X_OKAPI_TENANT(org.folio.TestConstants.NON_EXIST_CONFIG_X_OKAPI_TENANT) Disabled(org.junit.jupiter.api.Disabled) TransactionCollection(org.folio.rest.acq.model.finance.TransactionCollection) Is(org.hamcrest.core.Is) AfterAll(org.junit.jupiter.api.AfterAll) BigDecimal(java.math.BigDecimal) MockitoAnnotations(org.mockito.MockitoAnnotations) InventoryInteractionTestHelper.joinExistingAndNewItems(org.folio.helper.InventoryInteractionTestHelper.joinExistingAndNewItems) Matcher(java.util.regex.Matcher) BUDGET_EXPENSE_CLASS_NOT_FOUND(org.folio.rest.core.exceptions.ErrorCodes.BUDGET_EXPENSE_CLASS_NOT_FOUND) BeforeAll(org.junit.jupiter.api.BeforeAll) Matchers.nullValue(org.hamcrest.Matchers.nullValue) JsonObject(io.vertx.core.json.JsonObject) OKAPI_URL(org.folio.rest.RestConstants.OKAPI_URL) Mockito.doReturn(org.mockito.Mockito.doReturn) MISSING_ONGOING(org.folio.rest.core.exceptions.ErrorCodes.MISSING_ONGOING) RestTestUtils.verifyPut(org.folio.RestTestUtils.verifyPut) Set(java.util.Set) RestTestUtils.verifyDeleteResponse(org.folio.RestTestUtils.verifyDeleteResponse) Fund(org.folio.rest.acq.model.finance.Fund) Matchers.startsWith(org.hamcrest.Matchers.startsWith) TestConfig.isVerticleNotDeployed(org.folio.TestConfig.isVerticleNotDeployed) COST_UNIT_PRICE_INVALID(org.folio.rest.core.exceptions.ErrorCodes.COST_UNIT_PRICE_INVALID) PROTECTED_READ_ONLY_TENANT(org.folio.TestConstants.PROTECTED_READ_ONLY_TENANT) X_OKAPI_TOKEN(org.folio.TestConstants.X_OKAPI_TOKEN) PO_NUMBER(org.folio.orders.utils.ResourcePathResolver.PO_NUMBER) FinanceInteractionsTestHelper.verifyEncumbrancesOnPoUpdate(org.folio.helper.FinanceInteractionsTestHelper.verifyEncumbrancesOnPoUpdate) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) Matchers.is(org.hamcrest.Matchers.is) TEXT_PLAIN(javax.ws.rs.core.MediaType.TEXT_PLAIN) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.endsWith(org.hamcrest.Matchers.endsWith) COMPOSITE_PO_LINES_PREFIX(org.folio.TestConstants.COMPOSITE_PO_LINES_PREFIX) CreateInventory(org.folio.rest.jaxrs.model.Physical.CreateInventory) Mock(org.mockito.Mock) ID_DOES_NOT_EXIST(org.folio.TestConstants.ID_DOES_NOT_EXIST) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) TransactionService(org.folio.service.finance.transaction.TransactionService) MockServer.getExistingOrderSummaries(org.folio.rest.impl.MockServer.getExistingOrderSummaries) Transaction(org.folio.rest.acq.model.finance.Transaction) MockServer.getCreatedEncumbrances(org.folio.rest.impl.MockServer.getCreatedEncumbrances) PAYMENT_STATUS(org.folio.orders.utils.ResourcePathResolver.PAYMENT_STATUS) ArrayList(java.util.ArrayList) MockServer.getQueryParams(org.folio.rest.impl.MockServer.getQueryParams) INSTANCE_TYPE_CONTAINS_CODE_AS_INSTANCE_STATUS_TENANT_HEADER(org.folio.TestConstants.INSTANCE_TYPE_CONTAINS_CODE_AS_INSTANCE_STATUS_TENANT_HEADER) InvocationOnMock(org.mockito.invocation.InvocationOnMock) OKAPI_HEADER_PERMISSIONS(org.folio.helper.PurchaseOrderHelper.OKAPI_HEADER_PERMISSIONS) Matchers.lessThan(org.hamcrest.Matchers.lessThan) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) InventoryInteractionTestHelper.verifyInventoryInteraction(org.folio.helper.InventoryInteractionTestHelper.verifyInventoryInteraction) InjectMocks(org.mockito.InjectMocks) COMP_ORDER_MOCK_DATA_PATH(org.folio.TestConstants.COMP_ORDER_MOCK_DATA_PATH) RestTestUtils.verifyGet(org.folio.RestTestUtils.verifyGet) Piece(org.folio.rest.jaxrs.model.Piece) COMPOSITE_PO_LINES(org.folio.orders.utils.HelperUtils.COMPOSITE_PO_LINES) Assertions.assertArrayEquals(org.junit.jupiter.api.Assertions.assertArrayEquals) JsonArray(io.vertx.core.json.JsonArray) AcqDesiredPermissions(org.folio.orders.utils.AcqDesiredPermissions) TestUtils.getMockAsJson(org.folio.TestUtils.getMockAsJson) GENERIC_ERROR_CODE(org.folio.rest.core.exceptions.ErrorCodes.GENERIC_ERROR_CODE) Cost(org.folio.rest.jaxrs.model.Cost) MockServer.getItemsSearches(org.folio.rest.impl.MockServer.getItemsSearches) MockServer.getContributorNameTypesSearches(org.folio.rest.impl.MockServer.getContributorNameTypesSearches) TimeoutException(java.util.concurrent.TimeoutException) PoLine(org.folio.rest.jaxrs.model.PoLine) Ongoing(org.folio.rest.acq.model.Ongoing) MISMATCH_BETWEEN_ID_IN_PATH_AND_BODY(org.folio.rest.core.exceptions.ErrorCodes.MISMATCH_BETWEEN_ID_IN_PATH_AND_BODY) MockServer.getItemUpdates(org.folio.rest.impl.MockServer.getItemUpdates) FUNDS(org.folio.orders.utils.ResourcePathResolver.FUNDS) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) StringUtils.containsAny(org.apache.commons.lang3.StringUtils.containsAny) TestUtils.getMinimalContentCompositePurchaseOrder(org.folio.TestUtils.getMinimalContentCompositePurchaseOrder) InventoryInteractionTestHelper.verifyOpenOrderPiecesCreated(org.folio.helper.InventoryInteractionTestHelper.verifyOpenOrderPiecesCreated) APPLICATION_JSON(javax.ws.rs.core.MediaType.APPLICATION_JSON) BAD_QUERY(org.folio.TestConstants.BAD_QUERY) NON_EXIST_LOAN_TYPE_TENANT_HEADER(org.folio.TestConstants.NON_EXIST_LOAN_TYPE_TENANT_HEADER) RestTestUtils.checkPreventProtectedFieldsModificationRule(org.folio.RestTestUtils.checkPreventProtectedFieldsModificationRule) PIECES_TO_BE_DELETED(org.folio.rest.core.exceptions.ErrorCodes.PIECES_TO_BE_DELETED) FundDistribution(org.folio.rest.jaxrs.model.FundDistribution) HasPropertyWithValue(org.hamcrest.beans.HasPropertyWithValue) INSTANCE_ID_NOT_ALLOWED_FOR_PACKAGE_POLINE(org.folio.rest.core.exceptions.ErrorCodes.INSTANCE_ID_NOT_ALLOWED_FOR_PACKAGE_POLINE) InventoryInteractionTestHelper.verifyInventoryNonInteraction(org.folio.helper.InventoryInteractionTestHelper.verifyInventoryNonInteraction) InventoryInteractionTestHelper.verifyInstanceLinksForUpdatedOrder(org.folio.helper.InventoryInteractionTestHelper.verifyInstanceLinksForUpdatedOrder) PO_ID_OPEN_STATUS(org.folio.TestConstants.PO_ID_OPEN_STATUS) List(java.util.List) DistributionType(org.folio.rest.jaxrs.model.FundDistribution.DistributionType) EncumbranceService(org.folio.service.finance.transaction.EncumbranceService) Parameter(org.folio.rest.jaxrs.model.Parameter) Pattern(java.util.regex.Pattern) AcquisitionsUnitMembershipCollection(org.folio.rest.jaxrs.model.AcquisitionsUnitMembershipCollection) PIECES_STORAGE(org.folio.orders.utils.ResourcePathResolver.PIECES_STORAGE) RECEIPT_STATUS(org.folio.orders.utils.ResourcePathResolver.RECEIPT_STATUS) ORGANIZATION_NOT_A_VENDOR(org.folio.rest.core.exceptions.ErrorCodes.ORGANIZATION_NOT_A_VENDOR) X_ECHO_STATUS(org.folio.TestConstants.X_ECHO_STATUS) OKAPI_HEADER_TENANT(org.folio.rest.RestVerticle.OKAPI_HEADER_TENANT) HashMap(java.util.HashMap) PO_LINE_NUMBER_VALUE(org.folio.TestConstants.PO_LINE_NUMBER_VALUE) MockServer.getCreatedInstances(org.folio.rest.impl.MockServer.getCreatedInstances) MockServer.getCreatedPieces(org.folio.rest.impl.MockServer.getCreatedPieces) Title(org.folio.rest.jaxrs.model.Title) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) ObjectUtils(org.apache.commons.lang3.ObjectUtils) RequestContext(org.folio.rest.core.models.RequestContext) EMPTY(org.apache.commons.lang3.StringUtils.EMPTY) RestTestUtils.prepareHeaders(org.folio.RestTestUtils.prepareHeaders) PURCHASE_ORDER_STORAGE(org.folio.orders.utils.ResourcePathResolver.PURCHASE_ORDER_STORAGE) PO_ID_OPEN_TO_CANCEL(org.folio.TestConstants.PO_ID_OPEN_TO_CANCEL) INCORRECT_FUND_DISTRIBUTION_TOTAL(org.folio.rest.core.exceptions.ErrorCodes.INCORRECT_FUND_DISTRIBUTION_TOTAL) PHYSICAL_COST_LOC_QTY_MISMATCH(org.folio.rest.core.exceptions.ErrorCodes.PHYSICAL_COST_LOC_QTY_MISMATCH) NON_EXIST_INSTANCE_STATUS_TENANT_HEADER(org.folio.TestConstants.NON_EXIST_INSTANCE_STATUS_TENANT_HEADER) INACTIVE_EXPENSE_CLASS(org.folio.rest.core.exceptions.ErrorCodes.INACTIVE_EXPENSE_CLASS) MockServer.getInstanceStatusesSearches(org.folio.rest.impl.MockServer.getInstanceStatusesSearches) PurchaseOrderCollection(org.folio.rest.jaxrs.model.PurchaseOrderCollection) HttpMethod(io.vertx.core.http.HttpMethod) HttpStatus(org.folio.HttpStatus) X_OKAPI_USER_ID_WITH_ACQ_UNITS(org.folio.TestConstants.X_OKAPI_USER_ID_WITH_ACQ_UNITS) NON_EXIST_INSTANCE_TYPE_TENANT_HEADER(org.folio.TestConstants.NON_EXIST_INSTANCE_TYPE_TENANT_HEADER) WorkflowStatus(org.folio.rest.jaxrs.model.CompositePurchaseOrder.WorkflowStatus) ELECTRONIC(org.folio.rest.jaxrs.model.Piece.Format.ELECTRONIC) Collections(java.util.Collections) ORDER_OPEN(org.folio.rest.core.exceptions.ErrorCodes.ORDER_OPEN) FinanceInteractionsTestHelper.verifyEncumbrancesOnPoCreation(org.folio.helper.FinanceInteractionsTestHelper.verifyEncumbrancesOnPoCreation) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) TestUtils.getMinimalContentCompositePoLine(org.folio.TestUtils.getMinimalContentCompositePoLine) JsonObject(io.vertx.core.json.JsonObject) Matchers.containsString(org.hamcrest.Matchers.containsString) TestUtils.getMinimalContentCompositePurchaseOrder(org.folio.TestUtils.getMinimalContentCompositePurchaseOrder) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) Test(org.junit.jupiter.api.Test)

Example 2 with ID_FOR_INTERNAL_SERVER_ERROR

use of org.folio.TestConstants.ID_FOR_INTERNAL_SERVER_ERROR in project mod-orders by folio-org.

the class InventoryInteractionTestHelper method verifyOpenOrderPiecesCreated.

public static void verifyOpenOrderPiecesCreated(List<JsonObject> inventoryItems, List<CompositePoLine> compositePoLines, List<JsonObject> pieceJsons, int expectedWithItemQty) {
    // Collect all item id's
    List<String> itemIds = inventoryItems.stream().map(item -> item.getString(ID)).collect(Collectors.toList());
    List<Piece> pieces = pieceJsons.stream().map(pieceObj -> pieceObj.mapTo(Piece.class)).collect(Collectors.toList());
    // Verify quantity of created pieces
    int totalForAllPoLines = 0;
    for (CompositePoLine poLine : compositePoLines) {
        Map<String, List<JsonObject>> createdHoldingsByLocationId = getCreatedHoldings().stream().filter(json -> json.getString("instanceId").equals(poLine.getInstanceId())).collect(groupingBy(json -> json.getString(HOLDING_PERMANENT_LOCATION_ID)));
        List<Location> locations = poLine.getLocations().stream().filter(location -> PoLineCommonUtil.isHoldingCreationRequiredForLocation(poLine, location) && !Objects.equals(location.getLocationId(), ID_FOR_INTERNAL_SERVER_ERROR)).collect(Collectors.toList());
        // Prepare data first
        // Calculated quantities
        int expectedElQty = 0;
        int expectedPhysQty = 0;
        int expectedOthQty = 0;
        if (poLine.getCheckinItems() == null || !poLine.getCheckinItems()) {
            if (poLine.getOrderFormat() == CompositePoLine.OrderFormat.OTHER) {
                // calculatePiecesQuantity(Piece.Format.OTHER, locations);
                expectedOthQty += getPhysicalCostQuantity(poLine);
            } else {
                // calculatePiecesQuantity(Piece.Format.PHYSICAL, locations);
                expectedPhysQty += getPhysicalCostQuantity(poLine);
            }
            // calculatePiecesQuantity(Piece.Format.ELECTRONIC, locations);
            expectedElQty = getElectronicCostQuantity(poLine);
        }
        int expectedWithoutItemQty = calculateInventoryItemsQuantity(poLine, locations);
        int expectedWithoutLocation = calculatePiecesQuantityWithoutLocation(poLine).values().stream().mapToInt(Integer::intValue).sum();
        // Prepare pieces for PO Line
        List<Piece> poLinePieces = pieces.stream().filter(piece -> piece.getPoLineId().equals(poLine.getId())).collect(Collectors.toList());
        Map<String, Long> piecesByLocationIdQuantity = poLinePieces.stream().filter(piece -> Objects.nonNull(piece.getLocationId())).collect(groupingBy(Piece::getLocationId, Collectors.counting()));
        int expectedTotal = expectedWithItemQty + expectedWithoutItemQty + expectedWithoutLocation;
        // Make sure that quantities by piece type and by item presence are the same
        assertThat(expectedPhysQty + expectedElQty + expectedOthQty, is(expectedTotal));
        assertThat(poLinePieces, hasSize(expectedTotal));
        // Verify each piece individually
        poLinePieces.forEach(piece -> {
            // Check if itemId in inventoryItems match itemId in piece record
            if (poLine.getCheckinItems() != null && Boolean.FALSE.equals(poLine.getCheckinItems())) {
                if (piece.getLocationId() != null) {
                    String pieceLocationId = piece.getLocationId();
                    List<JsonObject> createdHoldingsForLocation = createdHoldingsByLocationId.get(pieceLocationId);
                    assertNotNull(createdHoldingsForLocation);
                }
            }
            assertThat(piece.getReceivingStatus(), equalTo(Piece.ReceivingStatus.EXPECTED));
            if (piece.getItemId() != null) {
                assertThat(itemIds, hasItem(piece.getItemId()));
            }
            assertThat(piece.getFormat(), notNullValue());
        });
        totalForAllPoLines += expectedTotal;
    }
    // Make sure that none of pieces missed
    assertThat(pieceJsons, hasSize(totalForAllPoLines));
}
Also used : MockServer.getCreatedHoldings(org.folio.rest.impl.MockServer.getCreatedHoldings) CONFIG_NAME_INSTANCE_STATUS_CODE(org.folio.service.inventory.InventoryManager.CONFIG_NAME_INSTANCE_STATUS_CODE) CONFIG_NAME_INSTANCE_TYPE_CODE(org.folio.service.inventory.InventoryManager.CONFIG_NAME_INSTANCE_TYPE_CODE) HelperUtils.calculateTotalQuantity(org.folio.orders.utils.HelperUtils.calculateTotalQuantity) CONFIG_NAME_LOAN_TYPE_NAME(org.folio.service.inventory.InventoryManager.CONFIG_NAME_LOAN_TYPE_NAME) Matchers.not(org.hamcrest.Matchers.not) Header(io.restassured.http.Header) LOAN_TYPES(org.folio.service.inventory.InventoryManager.LOAN_TYPES) StringUtils(org.apache.commons.lang3.StringUtils) INSTANCE_TYPES_MOCK_DATA_PATH(org.folio.rest.impl.MockServer.INSTANCE_TYPES_MOCK_DATA_PATH) PoLineCommonUtil(org.folio.orders.utils.PoLineCommonUtil) CONFIG_NAME(org.folio.orders.utils.HelperUtils.CONFIG_NAME) Map(java.util.Map) INSTANCE_STATUSES_MOCK_DATA_PATH(org.folio.rest.impl.MockServer.INSTANCE_STATUSES_MOCK_DATA_PATH) JsonObject(io.vertx.core.json.JsonObject) DEFAULT_LOAN_TYPE_NAME(org.folio.service.inventory.InventoryManager.DEFAULT_LOAN_TYPE_NAME) ID_FOR_INTERNAL_SERVER_ERROR(org.folio.TestConstants.ID_FOR_INTERNAL_SERVER_ERROR) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Assertions.fail(org.assertj.core.api.Assertions.fail) Logger(org.apache.logging.log4j.Logger) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) INSTANCE_STATUSES(org.folio.service.inventory.InventoryManager.INSTANCE_STATUSES) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) DEFAULT_INSTANCE_STATUS_CODE(org.folio.service.inventory.InventoryManager.DEFAULT_INSTANCE_STATUS_CODE) Matchers.is(org.hamcrest.Matchers.is) INSTANCE_CONTRIBUTORS(org.folio.service.inventory.InventoryManager.INSTANCE_CONTRIBUTORS) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) HelperUtils.calculateInventoryItemsQuantity(org.folio.orders.utils.HelperUtils.calculateInventoryItemsQuantity) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) Contributor(org.folio.rest.jaxrs.model.Contributor) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) LOAN_TYPES_MOCK_DATA_PATH(org.folio.rest.impl.MockServer.LOAN_TYPES_MOCK_DATA_PATH) INSTANCE_IDENTIFIERS(org.folio.service.inventory.InventoryManager.INSTANCE_IDENTIFIERS) MockServer.getHoldingsSearches(org.folio.rest.impl.MockServer.getHoldingsSearches) Matchers.emptyOrNullString(org.hamcrest.Matchers.emptyOrNullString) HOLDING_PERMANENT_LOCATION_ID(org.folio.service.inventory.InventoryManager.HOLDING_PERMANENT_LOCATION_ID) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) INSTANCE_DATE_OF_PUBLICATION(org.folio.service.inventory.InventoryManager.INSTANCE_DATE_OF_PUBLICATION) CONTRIBUTOR_NAME_TYPE_ID(org.folio.service.inventory.InventoryManager.CONTRIBUTOR_NAME_TYPE_ID) EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10(org.folio.TestConstants.EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10) MockServer.getPieceSearches(org.folio.rest.impl.MockServer.getPieceSearches) INSTANCE_PUBLISHER(org.folio.service.inventory.InventoryManager.INSTANCE_PUBLISHER) Piece(org.folio.rest.jaxrs.model.Piece) HelperUtils(org.folio.orders.utils.HelperUtils) PieceUtil.calculatePiecesQuantityWithoutLocation(org.folio.service.pieces.PieceUtil.calculatePiecesQuantityWithoutLocation) IOException(java.io.IOException) Assertions.assertArrayEquals(org.junit.jupiter.api.Assertions.assertArrayEquals) ITEM_MATERIAL_TYPE_ID(org.folio.service.inventory.InventoryManager.ITEM_MATERIAL_TYPE_ID) JsonArray(io.vertx.core.json.JsonArray) Matchers.hasItem(org.hamcrest.Matchers.hasItem) MockServer.getInstancesSearches(org.folio.rest.impl.MockServer.getInstancesSearches) PoLineCommonUtil.getPhysicalCostQuantity(org.folio.orders.utils.PoLineCommonUtil.getPhysicalCostQuantity) ITEM_STATUS_NAME(org.folio.service.inventory.InventoryManager.ITEM_STATUS_NAME) INSTANCE_TITLE(org.folio.service.inventory.InventoryManager.INSTANCE_TITLE) MockServer.getItemsSearches(org.folio.rest.impl.MockServer.getItemsSearches) ITEM_PERMANENT_LOAN_TYPE_ID(org.folio.service.inventory.InventoryManager.ITEM_PERMANENT_LOAN_TYPE_ID) INSTANCE_STATUS_ID(org.folio.service.inventory.InventoryManager.INSTANCE_STATUS_ID) MockServer.getPurchaseOrderRetrievals(org.folio.rest.impl.MockServer.getPurchaseOrderRetrievals) PoLine(org.folio.rest.jaxrs.model.PoLine) MockServer.getPurchaseOrderUpdates(org.folio.rest.impl.MockServer.getPurchaseOrderUpdates) MockServer.getCreatedItems(org.folio.rest.impl.MockServer.getCreatedItems) ITEM_STATUS(org.folio.service.inventory.InventoryManager.ITEM_STATUS) Location(org.folio.rest.jaxrs.model.Location) CONFIGS(org.folio.orders.utils.HelperUtils.CONFIGS) CONTRIBUTOR_NAME(org.folio.service.inventory.InventoryManager.CONTRIBUTOR_NAME) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Matchers.equalTo(org.hamcrest.Matchers.equalTo) PoLineCommonUtil.getElectronicCostQuantity(org.folio.orders.utils.PoLineCommonUtil.getElectronicCostQuantity) Optional(java.util.Optional) INSTANCE_SOURCE(org.folio.service.inventory.InventoryManager.INSTANCE_SOURCE) INSTANCE_TYPE_ID(org.folio.service.inventory.InventoryManager.INSTANCE_TYPE_ID) INSTANCE_IDENTIFIER_TYPE_ID(org.folio.service.inventory.InventoryManager.INSTANCE_IDENTIFIER_TYPE_ID) INSTANCE_PUBLICATION(org.folio.service.inventory.InventoryManager.INSTANCE_PUBLICATION) ID(org.folio.service.inventory.InventoryManager.ID) MockServer.getCreatedInstances(org.folio.rest.impl.MockServer.getCreatedInstances) TestUtils.getMockData(org.folio.TestUtils.getMockData) MockServer.getCreatedPieces(org.folio.rest.impl.MockServer.getCreatedPieces) ITEM_HOLDINGS_RECORD_ID(org.folio.service.inventory.InventoryManager.ITEM_HOLDINGS_RECORD_ID) ITEM_PURCHASE_ORDER_LINE_IDENTIFIER(org.folio.service.inventory.InventoryManager.ITEM_PURCHASE_ORDER_LINE_IDENTIFIER) INSTANCE_IDENTIFIER_TYPE_VALUE(org.folio.service.inventory.InventoryManager.INSTANCE_IDENTIFIER_TYPE_VALUE) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) CONFIG_VALUE(org.folio.orders.utils.HelperUtils.CONFIG_VALUE) INSTANCE_TYPES(org.folio.service.inventory.InventoryManager.INSTANCE_TYPES) ReceivedItem(org.folio.rest.jaxrs.model.ReceivedItem) CONFIG_MOCK_PATH(org.folio.rest.impl.MockServer.CONFIG_MOCK_PATH) HOLDING_INSTANCE_ID(org.folio.service.inventory.InventoryManager.HOLDING_INSTANCE_ID) MockServer.getPoLineSearches(org.folio.rest.impl.MockServer.getPoLineSearches) PoLineCommonUtil.groupLocationsByLocationId(org.folio.orders.utils.PoLineCommonUtil.groupLocationsByLocationId) MockServer.getPoLineUpdates(org.folio.rest.impl.MockServer.getPoLineUpdates) DEFAULT_INSTANCE_TYPE_CODE(org.folio.service.inventory.InventoryManager.DEFAULT_INSTANCE_TYPE_CODE) LogManager(org.apache.logging.log4j.LogManager) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) JsonObject(io.vertx.core.json.JsonObject) Matchers.emptyOrNullString(org.hamcrest.Matchers.emptyOrNullString) Piece(org.folio.rest.jaxrs.model.Piece) ArrayList(java.util.ArrayList) List(java.util.List) PieceUtil.calculatePiecesQuantityWithoutLocation(org.folio.service.pieces.PieceUtil.calculatePiecesQuantityWithoutLocation) Location(org.folio.rest.jaxrs.model.Location)

Example 3 with ID_FOR_INTERNAL_SERVER_ERROR

use of org.folio.TestConstants.ID_FOR_INTERNAL_SERVER_ERROR in project mod-orders by folio-org.

the class InventoryInteractionTestHelper method verifyPiecesCreated.

public static void verifyPiecesCreated(List<JsonObject> inventoryItems, List<CompositePoLine> compositePoLines, List<JsonObject> pieceJsons) {
    // Collect all item id's
    List<String> itemIds = inventoryItems.stream().map(item -> item.getString(ID)).collect(Collectors.toList());
    List<Piece> pieces = pieceJsons.stream().map(pieceObj -> pieceObj.mapTo(Piece.class)).collect(Collectors.toList());
    // Verify quantity of created pieces
    int totalForAllPoLines = 0;
    for (CompositePoLine poLine : compositePoLines) {
        List<Location> locations = poLine.getLocations().stream().filter(location -> PoLineCommonUtil.isHoldingCreationRequiredForLocation(poLine, location) && !Objects.equals(location.getLocationId(), ID_FOR_INTERNAL_SERVER_ERROR)).collect(Collectors.toList());
        // Prepare data first
        // Calculated quantities
        int expectedElQty = 0;
        int expectedPhysQty = 0;
        int expectedOthQty = 0;
        if (poLine.getCheckinItems() == null || !poLine.getCheckinItems()) {
            if (poLine.getOrderFormat() == CompositePoLine.OrderFormat.OTHER) {
                // calculatePiecesQuantity(Piece.Format.OTHER, locations);
                expectedOthQty += getPhysicalCostQuantity(poLine);
            } else {
                // calculatePiecesQuantity(Piece.Format.PHYSICAL, locations);
                expectedPhysQty += getPhysicalCostQuantity(poLine);
            }
            // calculatePiecesQuantity(Piece.Format.ELECTRONIC, locations);
            expectedElQty = getElectronicCostQuantity(poLine);
        }
        int expectedWithItemQty = 0;
        int expectedWithoutItemQty = calculateInventoryItemsQuantity(poLine, locations);
        int expectedWithoutLocation = calculatePiecesQuantityWithoutLocation(poLine).values().stream().mapToInt(Integer::intValue).sum();
        // Prepare pieces for PO Line
        List<Piece> piecesByPoLine = pieces.stream().filter(piece -> piece.getPoLineId().equals(poLine.getId())).collect(Collectors.toList());
        // Get all PO Line's locations' ids
        List<String> locationIds = locations.stream().map(Location::getLocationId).distinct().collect(Collectors.toList());
        int expectedTotal = expectedWithItemQty + expectedWithoutItemQty + expectedWithoutLocation;
        // Make sure that quantities by piece type and by item presence are the same
        assertThat(expectedPhysQty + expectedElQty + expectedOthQty, is(expectedTotal));
        assertThat(piecesByPoLine, hasSize(expectedTotal));
        // Verify each piece individually
        piecesByPoLine.forEach(piece -> {
            // Check if itemId in inventoryItems match itemId in piece record
            if (piece.getLocationId() != null) {
                assertThat(locationIds, hasItem(piece.getLocationId()));
            }
            assertThat(piece.getReceivingStatus(), equalTo(Piece.ReceivingStatus.EXPECTED));
            if (piece.getItemId() != null) {
                assertThat(itemIds, hasItem(piece.getItemId()));
            }
            assertThat(piece.getFormat(), notNullValue());
        });
        totalForAllPoLines += expectedTotal;
    }
    // Make sure that none of pieces missed
    assertThat(pieceJsons, hasSize(totalForAllPoLines));
}
Also used : MockServer.getCreatedHoldings(org.folio.rest.impl.MockServer.getCreatedHoldings) CONFIG_NAME_INSTANCE_STATUS_CODE(org.folio.service.inventory.InventoryManager.CONFIG_NAME_INSTANCE_STATUS_CODE) CONFIG_NAME_INSTANCE_TYPE_CODE(org.folio.service.inventory.InventoryManager.CONFIG_NAME_INSTANCE_TYPE_CODE) HelperUtils.calculateTotalQuantity(org.folio.orders.utils.HelperUtils.calculateTotalQuantity) CONFIG_NAME_LOAN_TYPE_NAME(org.folio.service.inventory.InventoryManager.CONFIG_NAME_LOAN_TYPE_NAME) Matchers.not(org.hamcrest.Matchers.not) Header(io.restassured.http.Header) LOAN_TYPES(org.folio.service.inventory.InventoryManager.LOAN_TYPES) StringUtils(org.apache.commons.lang3.StringUtils) INSTANCE_TYPES_MOCK_DATA_PATH(org.folio.rest.impl.MockServer.INSTANCE_TYPES_MOCK_DATA_PATH) PoLineCommonUtil(org.folio.orders.utils.PoLineCommonUtil) CONFIG_NAME(org.folio.orders.utils.HelperUtils.CONFIG_NAME) Map(java.util.Map) INSTANCE_STATUSES_MOCK_DATA_PATH(org.folio.rest.impl.MockServer.INSTANCE_STATUSES_MOCK_DATA_PATH) JsonObject(io.vertx.core.json.JsonObject) DEFAULT_LOAN_TYPE_NAME(org.folio.service.inventory.InventoryManager.DEFAULT_LOAN_TYPE_NAME) ID_FOR_INTERNAL_SERVER_ERROR(org.folio.TestConstants.ID_FOR_INTERNAL_SERVER_ERROR) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Assertions.fail(org.assertj.core.api.Assertions.fail) Logger(org.apache.logging.log4j.Logger) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) INSTANCE_STATUSES(org.folio.service.inventory.InventoryManager.INSTANCE_STATUSES) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) DEFAULT_INSTANCE_STATUS_CODE(org.folio.service.inventory.InventoryManager.DEFAULT_INSTANCE_STATUS_CODE) Matchers.is(org.hamcrest.Matchers.is) INSTANCE_CONTRIBUTORS(org.folio.service.inventory.InventoryManager.INSTANCE_CONTRIBUTORS) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) HelperUtils.calculateInventoryItemsQuantity(org.folio.orders.utils.HelperUtils.calculateInventoryItemsQuantity) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) Contributor(org.folio.rest.jaxrs.model.Contributor) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) LOAN_TYPES_MOCK_DATA_PATH(org.folio.rest.impl.MockServer.LOAN_TYPES_MOCK_DATA_PATH) INSTANCE_IDENTIFIERS(org.folio.service.inventory.InventoryManager.INSTANCE_IDENTIFIERS) MockServer.getHoldingsSearches(org.folio.rest.impl.MockServer.getHoldingsSearches) Matchers.emptyOrNullString(org.hamcrest.Matchers.emptyOrNullString) HOLDING_PERMANENT_LOCATION_ID(org.folio.service.inventory.InventoryManager.HOLDING_PERMANENT_LOCATION_ID) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) INSTANCE_DATE_OF_PUBLICATION(org.folio.service.inventory.InventoryManager.INSTANCE_DATE_OF_PUBLICATION) CONTRIBUTOR_NAME_TYPE_ID(org.folio.service.inventory.InventoryManager.CONTRIBUTOR_NAME_TYPE_ID) EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10(org.folio.TestConstants.EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10) MockServer.getPieceSearches(org.folio.rest.impl.MockServer.getPieceSearches) INSTANCE_PUBLISHER(org.folio.service.inventory.InventoryManager.INSTANCE_PUBLISHER) Piece(org.folio.rest.jaxrs.model.Piece) HelperUtils(org.folio.orders.utils.HelperUtils) PieceUtil.calculatePiecesQuantityWithoutLocation(org.folio.service.pieces.PieceUtil.calculatePiecesQuantityWithoutLocation) IOException(java.io.IOException) Assertions.assertArrayEquals(org.junit.jupiter.api.Assertions.assertArrayEquals) ITEM_MATERIAL_TYPE_ID(org.folio.service.inventory.InventoryManager.ITEM_MATERIAL_TYPE_ID) JsonArray(io.vertx.core.json.JsonArray) Matchers.hasItem(org.hamcrest.Matchers.hasItem) MockServer.getInstancesSearches(org.folio.rest.impl.MockServer.getInstancesSearches) PoLineCommonUtil.getPhysicalCostQuantity(org.folio.orders.utils.PoLineCommonUtil.getPhysicalCostQuantity) ITEM_STATUS_NAME(org.folio.service.inventory.InventoryManager.ITEM_STATUS_NAME) INSTANCE_TITLE(org.folio.service.inventory.InventoryManager.INSTANCE_TITLE) MockServer.getItemsSearches(org.folio.rest.impl.MockServer.getItemsSearches) ITEM_PERMANENT_LOAN_TYPE_ID(org.folio.service.inventory.InventoryManager.ITEM_PERMANENT_LOAN_TYPE_ID) INSTANCE_STATUS_ID(org.folio.service.inventory.InventoryManager.INSTANCE_STATUS_ID) MockServer.getPurchaseOrderRetrievals(org.folio.rest.impl.MockServer.getPurchaseOrderRetrievals) PoLine(org.folio.rest.jaxrs.model.PoLine) MockServer.getPurchaseOrderUpdates(org.folio.rest.impl.MockServer.getPurchaseOrderUpdates) MockServer.getCreatedItems(org.folio.rest.impl.MockServer.getCreatedItems) ITEM_STATUS(org.folio.service.inventory.InventoryManager.ITEM_STATUS) Location(org.folio.rest.jaxrs.model.Location) CONFIGS(org.folio.orders.utils.HelperUtils.CONFIGS) CONTRIBUTOR_NAME(org.folio.service.inventory.InventoryManager.CONTRIBUTOR_NAME) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Matchers.equalTo(org.hamcrest.Matchers.equalTo) PoLineCommonUtil.getElectronicCostQuantity(org.folio.orders.utils.PoLineCommonUtil.getElectronicCostQuantity) Optional(java.util.Optional) INSTANCE_SOURCE(org.folio.service.inventory.InventoryManager.INSTANCE_SOURCE) INSTANCE_TYPE_ID(org.folio.service.inventory.InventoryManager.INSTANCE_TYPE_ID) INSTANCE_IDENTIFIER_TYPE_ID(org.folio.service.inventory.InventoryManager.INSTANCE_IDENTIFIER_TYPE_ID) INSTANCE_PUBLICATION(org.folio.service.inventory.InventoryManager.INSTANCE_PUBLICATION) ID(org.folio.service.inventory.InventoryManager.ID) MockServer.getCreatedInstances(org.folio.rest.impl.MockServer.getCreatedInstances) TestUtils.getMockData(org.folio.TestUtils.getMockData) MockServer.getCreatedPieces(org.folio.rest.impl.MockServer.getCreatedPieces) ITEM_HOLDINGS_RECORD_ID(org.folio.service.inventory.InventoryManager.ITEM_HOLDINGS_RECORD_ID) ITEM_PURCHASE_ORDER_LINE_IDENTIFIER(org.folio.service.inventory.InventoryManager.ITEM_PURCHASE_ORDER_LINE_IDENTIFIER) INSTANCE_IDENTIFIER_TYPE_VALUE(org.folio.service.inventory.InventoryManager.INSTANCE_IDENTIFIER_TYPE_VALUE) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) CONFIG_VALUE(org.folio.orders.utils.HelperUtils.CONFIG_VALUE) INSTANCE_TYPES(org.folio.service.inventory.InventoryManager.INSTANCE_TYPES) ReceivedItem(org.folio.rest.jaxrs.model.ReceivedItem) CONFIG_MOCK_PATH(org.folio.rest.impl.MockServer.CONFIG_MOCK_PATH) HOLDING_INSTANCE_ID(org.folio.service.inventory.InventoryManager.HOLDING_INSTANCE_ID) MockServer.getPoLineSearches(org.folio.rest.impl.MockServer.getPoLineSearches) PoLineCommonUtil.groupLocationsByLocationId(org.folio.orders.utils.PoLineCommonUtil.groupLocationsByLocationId) MockServer.getPoLineUpdates(org.folio.rest.impl.MockServer.getPoLineUpdates) DEFAULT_INSTANCE_TYPE_CODE(org.folio.service.inventory.InventoryManager.DEFAULT_INSTANCE_TYPE_CODE) LogManager(org.apache.logging.log4j.LogManager) Piece(org.folio.rest.jaxrs.model.Piece) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) Matchers.emptyOrNullString(org.hamcrest.Matchers.emptyOrNullString) PieceUtil.calculatePiecesQuantityWithoutLocation(org.folio.service.pieces.PieceUtil.calculatePiecesQuantityWithoutLocation) Location(org.folio.rest.jaxrs.model.Location)

Aggregations

Header (io.restassured.http.Header)3 JsonArray (io.vertx.core.json.JsonArray)3 JsonObject (io.vertx.core.json.JsonObject)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3 Objects (java.util.Objects)3 Collectors (java.util.stream.Collectors)3 StringUtils (org.apache.commons.lang3.StringUtils)3 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3 EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10 (org.folio.TestConstants.EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10)3 ID_FOR_INTERNAL_SERVER_ERROR (org.folio.TestConstants.ID_FOR_INTERNAL_SERVER_ERROR)3 TestUtils.getMockData (org.folio.TestUtils.getMockData)3 HelperUtils (org.folio.orders.utils.HelperUtils)3 HelperUtils.calculateInventoryItemsQuantity (org.folio.orders.utils.HelperUtils.calculateInventoryItemsQuantity)3 HelperUtils.calculateTotalQuantity (org.folio.orders.utils.HelperUtils.calculateTotalQuantity)3 MockServer.getCreatedHoldings (org.folio.rest.impl.MockServer.getCreatedHoldings)3 MockServer.getCreatedInstances (org.folio.rest.impl.MockServer.getCreatedInstances)3