Search in sources :

Example 16 with RequestContext

use of org.folio.rest.core.models.RequestContext in project mod-invoice by folio-org.

the class PaymentCreditWorkflowService method createTransactions.

private CompletionStage<Void> createTransactions(List<InvoiceWorkflowDataHolder> holders, RequestContext requestContext) {
    CompletableFuture<Void> future = completedFuture(null);
    for (InvoiceWorkflowDataHolder holder : holders) {
        Transaction tr = holder.getNewTransaction();
        future = future.thenCompose(v -> baseTransactionService.createTransaction(tr, requestContext).thenAccept(t -> {
        }).exceptionally(t -> {
            logger.error("Failed to create transaction for invoice with id - {}", tr.getSourceInvoiceId(), t);
            List<Parameter> parameters = new ArrayList<>();
            parameters.add(new Parameter().withKey("invoiceLineId").withValue(tr.getSourceInvoiceLineId()));
            parameters.add(new Parameter().withKey(FUND_ID).withValue((tr.getTransactionType() == Transaction.TransactionType.PAYMENT) ? tr.getFromFundId() : tr.getToFundId()));
            throw new HttpException(400, TRANSACTION_CREATION_FAILURE.toError().withParameters(parameters));
        }));
    }
    return future;
}
Also used : HelperUtils.convertToDoubleWithRounding(org.folio.invoices.utils.HelperUtils.convertToDoubleWithRounding) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) CompletableFuture(java.util.concurrent.CompletableFuture) InvoiceWorkflowDataHolder(org.folio.models.InvoiceWorkflowDataHolder) Transaction(org.folio.rest.acq.model.finance.Transaction) FundsDistributionService.distributeFunds(org.folio.services.FundsDistributionService.distributeFunds) ArrayList(java.util.ArrayList) HttpException(org.folio.invoices.rest.exceptions.HttpException) Collectors.toList(java.util.stream.Collectors.toList) HelperUtils.getFundDistributionAmount(org.folio.invoices.utils.HelperUtils.getFundDistributionAmount) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) Logger(org.apache.logging.log4j.Logger) RequestContext(org.folio.rest.core.models.RequestContext) Parameter(org.folio.rest.jaxrs.model.Parameter) LogManager(org.apache.logging.log4j.LogManager) MonetaryAmount(javax.money.MonetaryAmount) TRANSACTION_CREATION_FAILURE(org.folio.invoices.utils.ErrorCodes.TRANSACTION_CREATION_FAILURE) Transaction(org.folio.rest.acq.model.finance.Transaction) InvoiceWorkflowDataHolder(org.folio.models.InvoiceWorkflowDataHolder) ArrayList(java.util.ArrayList) Parameter(org.folio.rest.jaxrs.model.Parameter) HttpException(org.folio.invoices.rest.exceptions.HttpException)

Example 17 with RequestContext

use of org.folio.rest.core.models.RequestContext in project mod-invoice by folio-org.

the class PendingPaymentWorkflowService method handlePendingPaymentsCreation.

public CompletableFuture<Void> handlePendingPaymentsCreation(List<InvoiceWorkflowDataHolder> dataHolders, RequestContext requestContext) {
    List<InvoiceWorkflowDataHolder> holders = withNewPendingPayments(dataHolders);
    holderValidator.validate(holders);
    InvoiceTransactionSummary summary = buildInvoiceTransactionsSummary(holders);
    return invoiceTransactionSummaryService.createInvoiceTransactionSummary(summary, requestContext).thenCompose(s -> createPendingPayments(holders, requestContext)).thenCompose(s -> cleanupOldEncumbrances(holders, requestContext));
}
Also used : HelperUtils.convertToDoubleWithRounding(org.folio.invoices.utils.HelperUtils.convertToDoubleWithRounding) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) CompletableFuture(java.util.concurrent.CompletableFuture) FolioVertxCompletableFuture(org.folio.completablefuture.FolioVertxCompletableFuture) InvoiceWorkflowDataHolder(org.folio.models.InvoiceWorkflowDataHolder) Transaction(org.folio.rest.acq.model.finance.Transaction) HolderValidator(org.folio.services.validator.HolderValidator) FundsDistributionService.distributeFunds(org.folio.services.FundsDistributionService.distributeFunds) ArrayList(java.util.ArrayList) HttpException(org.folio.invoices.rest.exceptions.HttpException) InvoiceTransactionSummary(org.folio.rest.acq.model.finance.InvoiceTransactionSummary) RequestContext(org.folio.rest.core.models.RequestContext) HelperUtils.collectResultsOnSuccess(org.folio.invoices.utils.HelperUtils.collectResultsOnSuccess) PENDING_PAYMENT_ERROR(org.folio.invoices.utils.ErrorCodes.PENDING_PAYMENT_ERROR) InvoiceLine(org.folio.rest.jaxrs.model.InvoiceLine) AwaitingPayment(org.folio.rest.acq.model.finance.AwaitingPayment) FundDistribution(org.folio.rest.jaxrs.model.FundDistribution) Collectors.toList(java.util.stream.Collectors.toList) HelperUtils.getFundDistributionAmount(org.folio.invoices.utils.HelperUtils.getFundDistributionAmount) List(java.util.List) Logger(org.apache.logging.log4j.Logger) Optional(java.util.Optional) LogManager(org.apache.logging.log4j.LogManager) MonetaryAmount(javax.money.MonetaryAmount) Invoice(org.folio.rest.jaxrs.model.Invoice) InvoiceWorkflowDataHolder(org.folio.models.InvoiceWorkflowDataHolder) InvoiceTransactionSummary(org.folio.rest.acq.model.finance.InvoiceTransactionSummary)

Example 18 with RequestContext

use of org.folio.rest.core.models.RequestContext in project mod-invoice by folio-org.

the class PendingPaymentWorkflowService method createPendingPayments.

private CompletableFuture<Void> createPendingPayments(List<InvoiceWorkflowDataHolder> holders, RequestContext requestContext) {
    CompletableFuture<Void> future = completedFuture(null);
    for (InvoiceWorkflowDataHolder holder : holders) {
        Transaction pendingPayment = holder.getNewTransaction();
        future = future.thenCompose(v -> baseTransactionService.createTransaction(pendingPayment, requestContext).thenAccept(t -> {
        }).exceptionally(t -> {
            logger.error("Failed to create pending payment with id {}", pendingPayment.getId(), t);
            throw new HttpException(400, PENDING_PAYMENT_ERROR.toError());
        }));
    }
    return future;
}
Also used : HelperUtils.convertToDoubleWithRounding(org.folio.invoices.utils.HelperUtils.convertToDoubleWithRounding) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) CompletableFuture(java.util.concurrent.CompletableFuture) FolioVertxCompletableFuture(org.folio.completablefuture.FolioVertxCompletableFuture) InvoiceWorkflowDataHolder(org.folio.models.InvoiceWorkflowDataHolder) Transaction(org.folio.rest.acq.model.finance.Transaction) HolderValidator(org.folio.services.validator.HolderValidator) FundsDistributionService.distributeFunds(org.folio.services.FundsDistributionService.distributeFunds) ArrayList(java.util.ArrayList) HttpException(org.folio.invoices.rest.exceptions.HttpException) InvoiceTransactionSummary(org.folio.rest.acq.model.finance.InvoiceTransactionSummary) RequestContext(org.folio.rest.core.models.RequestContext) HelperUtils.collectResultsOnSuccess(org.folio.invoices.utils.HelperUtils.collectResultsOnSuccess) PENDING_PAYMENT_ERROR(org.folio.invoices.utils.ErrorCodes.PENDING_PAYMENT_ERROR) InvoiceLine(org.folio.rest.jaxrs.model.InvoiceLine) AwaitingPayment(org.folio.rest.acq.model.finance.AwaitingPayment) FundDistribution(org.folio.rest.jaxrs.model.FundDistribution) Collectors.toList(java.util.stream.Collectors.toList) HelperUtils.getFundDistributionAmount(org.folio.invoices.utils.HelperUtils.getFundDistributionAmount) List(java.util.List) Logger(org.apache.logging.log4j.Logger) Optional(java.util.Optional) LogManager(org.apache.logging.log4j.LogManager) MonetaryAmount(javax.money.MonetaryAmount) Invoice(org.folio.rest.jaxrs.model.Invoice) Transaction(org.folio.rest.acq.model.finance.Transaction) InvoiceWorkflowDataHolder(org.folio.models.InvoiceWorkflowDataHolder) HttpException(org.folio.invoices.rest.exceptions.HttpException)

Example 19 with RequestContext

use of org.folio.rest.core.models.RequestContext in project mod-orders by folio-org.

the class PurchaseOrderHelper method reopenOrder.

private CompletionStage<Void> reopenOrder(CompositePurchaseOrder compPO, CompositePurchaseOrder poFromStorage, RequestContext requestContext) {
    EncumbranceWorkflowStrategy strategy = encumbranceWorkflowStrategyFactory.getStrategy(OrderWorkflowType.CLOSED_TO_OPEN);
    CompositePurchaseOrder clonedCompPO = JsonObject.mapFrom(compPO).mapTo(CompositePurchaseOrder.class);
    if (CollectionUtils.isEmpty(clonedCompPO.getCompositePoLines())) {
        List<CompositePoLine> clonedLines = poFromStorage.getCompositePoLines().stream().map(line -> JsonObject.mapFrom(line).mapTo(CompositePoLine.class)).collect(toList());
        clonedCompPO.setCompositePoLines(clonedLines);
    }
    return strategy.processEncumbrances(clonedCompPO, poFromStorage, requestContext);
}
Also used : OrderInvoiceRelationService(org.folio.service.orders.OrderInvoiceRelationService) EN(org.folio.rest.RestConstants.EN) StringUtils(org.apache.commons.lang3.StringUtils) PoLineCommonUtil(org.folio.orders.utils.PoLineCommonUtil) HelperUtils.verifyProtectedFieldsChanged(org.folio.orders.utils.HelperUtils.verifyProtectedFieldsChanged) OpenCompositeOrderFlowValidator(org.folio.service.orders.flows.update.open.OpenCompositeOrderFlowValidator) Map(java.util.Map) JsonObject(io.vertx.core.json.JsonObject) ORDER_CONFIG_MODULE_NAME(org.folio.orders.utils.HelperUtils.ORDER_CONFIG_MODULE_NAME) TagService(org.folio.service.TagService) POProtectedFields.getFieldNamesForOpenOrder(org.folio.orders.utils.POProtectedFields.getFieldNamesForOpenOrder) OrderStatusTransitionUtil.isTransitionToOpen(org.folio.orders.utils.OrderStatusTransitionUtil.isTransitionToOpen) MISSING_ONGOING(org.folio.rest.core.exceptions.ErrorCodes.MISSING_ONGOING) HelperUtils.convertToCompositePurchaseOrder(org.folio.orders.utils.HelperUtils.convertToCompositePurchaseOrder) OrderStatusTransitionUtil.isOrderReopening(org.folio.orders.utils.OrderStatusTransitionUtil.isOrderReopening) UnOpenCompositeOrderManager(org.folio.service.orders.flows.update.unopen.UnOpenCompositeOrderManager) WORKFLOW_STATUS(org.folio.orders.utils.HelperUtils.WORKFLOW_STATUS) Set(java.util.Set) ErrorCodes(org.folio.rest.core.exceptions.ErrorCodes) OrderStatusTransitionUtil.isOrderClosing(org.folio.orders.utils.OrderStatusTransitionUtil.isOrderClosing) HelperUtils.handleGetRequest(org.folio.orders.utils.HelperUtils.handleGetRequest) ConfigurationEntriesService(org.folio.service.configuration.ConfigurationEntriesService) OPEN(org.folio.rest.jaxrs.model.CompositePurchaseOrder.WorkflowStatus.OPEN) CompletionStage(java.util.concurrent.CompletionStage) Logger(org.apache.logging.log4j.Logger) CREATE(org.folio.orders.utils.ProtectedOperationType.CREATE) CompositePoLineValidationUtil(org.folio.orders.utils.validators.CompositePoLineValidationUtil) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) HttpClientInterface(org.folio.rest.tools.client.interfaces.HttpClientInterface) MAX_REPEAT_ON_FAILURE(org.folio.helper.AbstractHelper.MAX_REPEAT_ON_FAILURE) USER_HAS_NO_UNOPEN_PERMISSIONS(org.folio.rest.core.exceptions.ErrorCodes.USER_HAS_NO_UNOPEN_PERMISSIONS) UPDATE(org.folio.orders.utils.ProtectedOperationType.UPDATE) FolioVertxCompletableFuture(org.folio.completablefuture.FolioVertxCompletableFuture) OrderStatusTransitionUtil.isTransitionToClosed(org.folio.orders.utils.OrderStatusTransitionUtil.isTransitionToClosed) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) MAX_IDS_FOR_GET_RQ(org.folio.rest.RestConstants.MAX_IDS_FOR_GET_RQ) ResourcePathResolver.resourcesPath(org.folio.orders.utils.ResourcePathResolver.resourcesPath) APPROVAL_REQUIRED_TO_OPEN(org.folio.rest.core.exceptions.ErrorCodes.APPROVAL_REQUIRED_TO_OPEN) PO_LINE_NUMBER(org.folio.orders.utils.ResourcePathResolver.PO_LINE_NUMBER) HelperUtils(org.folio.orders.utils.HelperUtils) OrderStatusTransitionUtil.isTransitionToApproved(org.folio.orders.utils.OrderStatusTransitionUtil.isTransitionToApproved) OrderStatusTransitionUtil.isTransitionToReopen(org.folio.orders.utils.OrderStatusTransitionUtil.isTransitionToReopen) OKAPI_USERID_HEADER(org.folio.rest.RestVerticle.OKAPI_USERID_HEADER) COMPOSITE_PO_LINES(org.folio.orders.utils.HelperUtils.COMPOSITE_PO_LINES) HelperUtils.combineCqlExpressions(org.folio.orders.utils.HelperUtils.combineCqlExpressions) JsonArray(io.vertx.core.json.JsonArray) OpenCompositeOrderManager(org.folio.service.orders.flows.update.open.OpenCompositeOrderManager) HelperUtils.changeOrderStatus(org.folio.orders.utils.HelperUtils.changeOrderStatus) OrderWorkflowType(org.folio.service.orders.OrderWorkflowType) AcqDesiredPermissions(org.folio.orders.utils.AcqDesiredPermissions) Date(java.util.Date) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) PurchaseOrderStorageService(org.folio.service.orders.PurchaseOrderStorageService) USER_HAS_NO_REOPEN_PERMISSIONS(org.folio.rest.core.exceptions.ErrorCodes.USER_HAS_NO_REOPEN_PERMISSIONS) PoLine(org.folio.rest.jaxrs.model.PoLine) CollectionUtils.isEmpty(org.apache.commons.collections4.CollectionUtils.isEmpty) ASSIGN(org.folio.orders.utils.AcqDesiredPermissions.ASSIGN) MANAGE(org.folio.orders.utils.AcqDesiredPermissions.MANAGE) CompositeOrderRetrieveHolder(org.folio.models.CompositeOrderRetrieveHolder) ProtectionService(org.folio.service.ProtectionService) ListUtils(org.apache.commons.collections4.ListUtils) ONGOING_NOT_ALLOWED(org.folio.rest.core.exceptions.ErrorCodes.ONGOING_NOT_ALLOWED) PurchaseOrder(org.folio.rest.jaxrs.model.PurchaseOrder) SEARCH_PARAMS(org.folio.helper.AbstractHelper.SEARCH_PARAMS) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) CollectionUtils.isNotEmpty(org.apache.commons.collections4.CollectionUtils.isNotEmpty) StreamEx(one.util.streamex.StreamEx) EncumbranceService(org.folio.service.finance.transaction.EncumbranceService) Optional(java.util.Optional) Parameter(org.folio.rest.jaxrs.model.Parameter) CompositeOrderDynamicDataPopulateService(org.folio.service.orders.CompositeOrderDynamicDataPopulateService) AcquisitionsUnitsService(org.folio.service.AcquisitionsUnitsService) ProtectedOperationType(org.folio.orders.utils.ProtectedOperationType) HttpException(org.folio.rest.core.exceptions.HttpException) CompletableFuture(java.util.concurrent.CompletableFuture) PENDING(org.folio.rest.jaxrs.model.CompositePurchaseOrder.WorkflowStatus.PENDING) USER_HAS_NO_ACQ_PERMISSIONS(org.folio.rest.core.exceptions.ErrorCodes.USER_HAS_NO_ACQ_PERMISSIONS) HashSet(java.util.HashSet) Title(org.folio.rest.jaxrs.model.Title) TitlesService(org.folio.service.titles.TitlesService) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) RequestContext(org.folio.rest.core.models.RequestContext) POProtectedFields.getFieldNames(org.folio.orders.utils.POProtectedFields.getFieldNames) HelperUtils.getPoLineLimit(org.folio.orders.utils.HelperUtils.getPoLineLimit) DELETE(org.folio.orders.utils.ProtectedOperationType.DELETE) EncumbranceWorkflowStrategyFactory(org.folio.service.finance.transaction.EncumbranceWorkflowStrategyFactory) InventoryManager(org.folio.service.inventory.InventoryManager) EncumbranceWorkflowStrategy(org.folio.service.finance.transaction.EncumbranceWorkflowStrategy) PURCHASE_ORDER_STORAGE(org.folio.orders.utils.ResourcePathResolver.PURCHASE_ORDER_STORAGE) Error(org.folio.rest.jaxrs.model.Error) Collectors.toList(java.util.stream.Collectors.toList) USER_HAS_NO_APPROVAL_PERMISSIONS(org.folio.rest.core.exceptions.ErrorCodes.USER_HAS_NO_APPROVAL_PERMISSIONS) HelperUtils.buildQuery(org.folio.orders.utils.HelperUtils.buildQuery) OrderStatusTransitionUtil.isTransitionToPending(org.folio.orders.utils.OrderStatusTransitionUtil.isTransitionToPending) PurchaseOrderCollection(org.folio.rest.jaxrs.model.PurchaseOrderCollection) HttpStatus(org.folio.HttpStatus) PurchaseOrderLineService(org.folio.service.orders.PurchaseOrderLineService) WorkflowStatus(org.folio.rest.jaxrs.model.CompositePurchaseOrder.WorkflowStatus) CompletableFutureRepeater(org.folio.completablefuture.CompletableFutureRepeater) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) EncumbranceWorkflowStrategy(org.folio.service.finance.transaction.EncumbranceWorkflowStrategy) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) HelperUtils.convertToCompositePurchaseOrder(org.folio.orders.utils.HelperUtils.convertToCompositePurchaseOrder) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder)

Example 20 with RequestContext

use of org.folio.rest.core.models.RequestContext in project mod-orders by folio-org.

the class OpenCompositeOrderPieceServiceTest method shouldCreatePieceWithLocationAndHoldingReferenceIfMixedLineContainsLocationAndInventoryIsInstanceOrNoneAndNoCreatedPieces.

@ParameterizedTest
@CsvSource(value = { "P/E Mix:Instance:Instance, Holding:2:3", "P/E Mix:None:Instance, Holding:2:3" }, delimiter = ':')
void shouldCreatePieceWithLocationAndHoldingReferenceIfMixedLineContainsLocationAndInventoryIsInstanceOrNoneAndNoCreatedPieces(String lineType, String elecCreateInventory, String physCreateInventory, int elecQty1, int physQty2) {
    // given
    String lineId = UUID.randomUUID().toString();
    String locationId1 = UUID.randomUUID().toString();
    String holdingId = UUID.randomUUID().toString();
    String titleId = UUID.randomUUID().toString();
    Location location1 = new Location().withLocationId(locationId1).withQuantityElectronic(elecQty1).withQuantity(elecQty1);
    Location location2 = new Location().withHoldingId(holdingId).withQuantityPhysical(physQty2).withQuantity(physQty2);
    Cost cost = new Cost().withQuantityElectronic(elecQty1 + physQty2);
    Eresource eresource = new Eresource().withCreateInventory(Eresource.CreateInventory.fromValue(elecCreateInventory));
    Physical physical = new Physical().withCreateInventory(Physical.CreateInventory.fromValue(physCreateInventory));
    CompositePoLine line = new CompositePoLine().withId(lineId).withCost(cost).withLocations(List.of(location1, location2)).withIsPackage(false).withEresource(eresource).withPhysical(physical).withOrderFormat(CompositePoLine.OrderFormat.fromValue(lineType));
    CompositePurchaseOrder compOrder = new CompositePurchaseOrder().withCompositePoLines(List.of(line));
    doReturn(completedFuture(null)).when(openCompositeOrderPieceService).openOrderUpdateInventory(any(CompositePoLine.class), any(Piece.class), any(Boolean.class), eq(requestContext));
    doReturn(completedFuture(Collections.emptyList())).when(pieceStorageService).getPiecesByPoLineId(line, requestContext);
    doReturn(completedFuture(new Piece())).when(pieceStorageService).insertPiece(any(Piece.class), eq(requestContext));
    doReturn(completedFuture(null)).when(protectionService).isOperationRestricted(any(List.class), any(ProtectedOperationType.class), eq(requestContext));
    doReturn(completedFuture(compOrder)).when(purchaseOrderStorageService).getCompositeOrderByPoLineId(eq(lineId), eq(requestContext));
    final ArgumentCaptor<Piece> pieceArgumentCaptor = ArgumentCaptor.forClass(Piece.class);
    doAnswer((Answer<CompletableFuture<Piece>>) invocation -> {
        Piece piece = invocation.getArgument(0);
        return completedFuture(piece);
    }).when(pieceStorageService).insertPiece(pieceArgumentCaptor.capture(), eq(requestContext));
    // When
    List<Piece> createdPieces = openCompositeOrderPieceService.handlePieces(line, titleId, Collections.emptyList(), false, requestContext).join();
    // Then
    List<Piece> piecesLoc1 = createdPieces.stream().filter(piece -> locationId1.equals(piece.getLocationId())).collect(toList());
    assertEquals(elecQty1, piecesLoc1.size());
    piecesLoc1.forEach(piece -> {
        assertNull(piece.getHoldingId());
        assertNull(piece.getItemId());
        assertEquals(lineId, piece.getPoLineId());
        assertEquals(titleId, piece.getTitleId());
        assertEquals(Piece.Format.ELECTRONIC, piece.getFormat());
    });
    List<Piece> piecesLoc2 = createdPieces.stream().filter(piece -> holdingId.equals(piece.getHoldingId())).collect(toList());
    assertEquals(physQty2, piecesLoc2.size());
    piecesLoc2.forEach(piece -> {
        assertNull(piece.getLocationId());
        assertNull(piece.getItemId());
        assertEquals(lineId, piece.getPoLineId());
        assertEquals(titleId, piece.getTitleId());
        assertEquals(Piece.Format.PHYSICAL, piece.getFormat());
    });
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) Cost(org.folio.rest.jaxrs.model.Cost) TestConfig.getVertx(org.folio.TestConfig.getVertx) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) PurchaseOrderStorageService(org.folio.service.orders.PurchaseOrderStorageService) TimeoutException(java.util.concurrent.TimeoutException) Autowired(org.springframework.beans.factory.annotation.Autowired) Context(io.vertx.core.Context) ApiTestSuite(org.folio.ApiTestSuite) AfterAll(org.junit.jupiter.api.AfterAll) MockitoAnnotations(org.mockito.MockitoAnnotations) ProtectionService(org.folio.service.ProtectionService) BeforeAll(org.junit.jupiter.api.BeforeAll) Mockito.doAnswer(org.mockito.Mockito.doAnswer) Map(java.util.Map) Spy(org.mockito.Spy) JsonObject(io.vertx.core.json.JsonObject) Mockito.doReturn(org.mockito.Mockito.doReturn) PieceStorageService(org.folio.service.pieces.PieceStorageService) BASE_MOCK_DATA_PATH(org.folio.rest.impl.MockServer.BASE_MOCK_DATA_PATH) OpenCompositeOrderHolderBuilder(org.folio.service.orders.flows.update.open.OpenCompositeOrderHolderBuilder) TILES_PATH(org.folio.TestConstants.TILES_PATH) OpenCompositeOrderPieceService(org.folio.service.orders.flows.update.open.OpenCompositeOrderPieceService) TestConfig.clearServiceInteractions(org.folio.TestConfig.clearServiceInteractions) Location(org.folio.rest.jaxrs.model.Location) UUID(java.util.UUID) TestConfig.isVerticleNotDeployed(org.folio.TestConfig.isVerticleNotDeployed) Test(org.junit.jupiter.api.Test) List(java.util.List) Eresource(org.folio.rest.jaxrs.model.Eresource) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) TestConfig.getFirstContextFromVertx(org.folio.TestConfig.getFirstContextFromVertx) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) CsvSource(org.junit.jupiter.params.provider.CsvSource) PieceChangeReceiptStatusPublisher(org.folio.service.pieces.PieceChangeReceiptStatusPublisher) Mock(org.mockito.Mock) ProtectedOperationType(org.folio.orders.utils.ProtectedOperationType) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) CompletableFuture(java.util.concurrent.CompletableFuture) TestConfig.clearVertxContext(org.folio.TestConfig.clearVertxContext) Mockito.spy(org.mockito.Mockito.spy) ArrayList(java.util.ArrayList) Title(org.folio.rest.jaxrs.model.Title) Answer(org.mockito.stubbing.Answer) TitlesService(org.folio.service.titles.TitlesService) ArgumentCaptor(org.mockito.ArgumentCaptor) PIECE_PATH(org.folio.TestConstants.PIECE_PATH) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) RequestContext(org.folio.rest.core.models.RequestContext) TestConfig.autowireDependencies(org.folio.TestConfig.autowireDependencies) InventoryManager(org.folio.service.inventory.InventoryManager) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Physical(org.folio.rest.jaxrs.model.Physical) ORDER_PATH(org.folio.service.orders.flows.unopen.UnOpenCompositeOrderManagerTest.ORDER_PATH) MessageAddress(org.folio.orders.events.handlers.MessageAddress) Piece(org.folio.rest.jaxrs.model.Piece) TestConfig.initSpringContext(org.folio.TestConfig.initSpringContext) Mockito.times(org.mockito.Mockito.times) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) Collectors.toList(java.util.stream.Collectors.toList) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Bean(org.springframework.context.annotation.Bean) Collections(java.util.Collections) TestUtils.getMockAsJson(org.folio.TestUtils.getMockAsJson) CompositePoLine(org.folio.rest.jaxrs.model.CompositePoLine) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) Cost(org.folio.rest.jaxrs.model.Cost) Eresource(org.folio.rest.jaxrs.model.Eresource) Physical(org.folio.rest.jaxrs.model.Physical) CompletableFuture(java.util.concurrent.CompletableFuture) Piece(org.folio.rest.jaxrs.model.Piece) List(java.util.List) ArrayList(java.util.ArrayList) Collectors.toList(java.util.stream.Collectors.toList) ProtectedOperationType(org.folio.orders.utils.ProtectedOperationType) Location(org.folio.rest.jaxrs.model.Location) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

RequestContext (org.folio.rest.core.models.RequestContext)165 JsonObject (io.vertx.core.json.JsonObject)109 CompletableFuture (java.util.concurrent.CompletableFuture)105 Map (java.util.Map)100 List (java.util.List)92 Logger (org.apache.logging.log4j.Logger)85 LogManager (org.apache.logging.log4j.LogManager)83 Collections (java.util.Collections)73 ArrayList (java.util.ArrayList)72 Context (io.vertx.core.Context)71 CompletableFuture.completedFuture (java.util.concurrent.CompletableFuture.completedFuture)69 Collectors.toList (java.util.stream.Collectors.toList)68 BeforeEach (org.junit.jupiter.api.BeforeEach)63 CompositePoLine (org.folio.rest.jaxrs.model.CompositePoLine)56 Optional (java.util.Optional)53 StringUtils (org.apache.commons.lang3.StringUtils)53 Autowired (org.springframework.beans.factory.annotation.Autowired)51 Piece (org.folio.rest.jaxrs.model.Piece)49 Error (org.folio.rest.jaxrs.model.Error)46 RequestEntry (org.folio.rest.core.models.RequestEntry)45