From d4683afaaaef1a9b1b3923968d18729db6a04d5b Mon Sep 17 00:00:00 2001 From: Serhii_Nosko Date: Thu, 9 Nov 2023 11:50:23 +0200 Subject: [PATCH] MODFIN-283. Methods renaming --- .../folio/services/budget/BudgetExpenseClassService.java | 6 +++--- src/main/java/org/folio/services/budget/BudgetService.java | 4 ++-- .../folio/services/fund/FundCodeExpenseClassesService.java | 2 +- .../services/budget/BudgetExpenseClassServiceTest.java | 4 ++-- .../services/fund/FundCodeExpenseClassesServiceTest.java | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/folio/services/budget/BudgetExpenseClassService.java b/src/main/java/org/folio/services/budget/BudgetExpenseClassService.java index 7f156a6f..20d622d6 100644 --- a/src/main/java/org/folio/services/budget/BudgetExpenseClassService.java +++ b/src/main/java/org/folio/services/budget/BudgetExpenseClassService.java @@ -151,14 +151,14 @@ public BudgetExpenseClass buildBudgetExpenseClass(StatusExpenseClass statusExpen .withStatus(BudgetExpenseClass.Status.fromValue(statusExpenseClass.getStatus().value())); } - public Future> getBudgetExpensesClass(List budgetsIds, RequestContext requestContext) { - return collectResultsOnSuccess(ofSubLists(new ArrayList<>(budgetsIds), MAX_IDS_FOR_GET_RQ).map(ids -> getBudgetExpensesClassByIds(ids, requestContext)).collect(Collectors.toList())) + public Future> getBudgetExpenseClasses(List budgetsIds, RequestContext requestContext) { + return collectResultsOnSuccess(ofSubLists(new ArrayList<>(budgetsIds), MAX_IDS_FOR_GET_RQ).map(ids -> getBudgetExpenseClassesByIds(ids, requestContext)).collect(Collectors.toList())) .map(lists -> lists.stream() .flatMap(Collection::stream) .collect(toList())); } - public Future> getBudgetExpensesClassByIds(List ids, RequestContext requestContext) { + public Future> getBudgetExpenseClassesByIds(List ids, RequestContext requestContext) { String budgetId = "budgetId"; String query = convertIdsToCqlQuery(ids, budgetId); var requestEntry = new RequestEntry(resourcesPath(BUDGET_EXPENSE_CLASSES)) diff --git a/src/main/java/org/folio/services/budget/BudgetService.java b/src/main/java/org/folio/services/budget/BudgetService.java index b7bea284..e5ade69d 100644 --- a/src/main/java/org/folio/services/budget/BudgetService.java +++ b/src/main/java/org/folio/services/budget/BudgetService.java @@ -37,8 +37,8 @@ public BudgetService(RestClient restClient, BudgetExpenseClassService budgetExpe public Future getBudgets(String query, int offset, int limit, RequestContext requestContext) { var requestEntry = new RequestEntry(resourcesPath(BUDGETS_STORAGE)) - .withLimit(limit) .withOffset(offset) + .withLimit(limit) .withQuery(query); return restClient.get(requestEntry.buildEndpoint(), BudgetsCollection.class, requestContext); } @@ -83,7 +83,7 @@ private Future rollbackBudgetPutIfNeeded(Budget budgetFromStorage, Throwab if (t == null) { return succeededFuture(null); } - return restClient.get(resourceByIdPath(BUDGETS_STORAGE, budgetFromStorage.getId()), Budget.class,requestContext) + return restClient.get(resourceByIdPath(BUDGETS_STORAGE, budgetFromStorage.getId()), Budget.class, requestContext) .map(latestBudget -> { budgetFromStorage.setVersion(latestBudget.getVersion()); return null; diff --git a/src/main/java/org/folio/services/fund/FundCodeExpenseClassesService.java b/src/main/java/org/folio/services/fund/FundCodeExpenseClassesService.java index 9d941b7a..ef1db1d9 100644 --- a/src/main/java/org/folio/services/fund/FundCodeExpenseClassesService.java +++ b/src/main/java/org/folio/services/fund/FundCodeExpenseClassesService.java @@ -119,7 +119,7 @@ public Future retrieveFundCodeVsExpenseClasses .map(Budget::getId) .collect(Collectors.toList())) .map(fundCodeExpenseClassesHolder::withBudgetIds) - .compose(holder -> budgetExpenseClassService.getBudgetExpensesClass(holder.getBudgetIds(), requestContext)) + .compose(holder -> budgetExpenseClassService.getBudgetExpenseClasses(holder.getBudgetIds(), requestContext)) .map(fundCodeExpenseClassesHolder::withBudgetExpenseClassList) .compose(holder -> expenseClassService.getExpenseClassesByBudgetIds(holder.getBudgetIds(), requestContext)) .map(fundCodeExpenseClassesHolder::withExpenseClassList) diff --git a/src/test/java/org/folio/services/budget/BudgetExpenseClassServiceTest.java b/src/test/java/org/folio/services/budget/BudgetExpenseClassServiceTest.java index 82864281..73a9afc0 100644 --- a/src/test/java/org/folio/services/budget/BudgetExpenseClassServiceTest.java +++ b/src/test/java/org/folio/services/budget/BudgetExpenseClassServiceTest.java @@ -416,7 +416,7 @@ public void testGetBudgetExpensesClass(VertxTestContext vertxTestContext) { //When when(restClient.get(anyString(), eq(BudgetExpenseClassCollection.class), any())).thenReturn(succeededFuture(budgetExpenseClassCollection)); - var future = budgetExpenseClassService.getBudgetExpensesClass(budgetsIds, requestContextMock); + var future = budgetExpenseClassService.getBudgetExpenseClasses(budgetsIds, requestContextMock); vertxTestContext.assertComplete(future) .onComplete(result -> { var budgetExpenseClassListFrom = result.result(); @@ -443,7 +443,7 @@ public void testGetBudgetExpensesClassByIds(VertxTestContext vertxTestContext) { budgetExpenseClassCollection.setBudgetExpenseClasses(budgetExpenseClassList); //When when(restClient.get(anyString(), eq(BudgetExpenseClassCollection.class), any())).thenReturn(succeededFuture(budgetExpenseClassCollection)); - var future = budgetExpenseClassService.getBudgetExpensesClassByIds(budgetsIds, requestContextMock); + var future = budgetExpenseClassService.getBudgetExpenseClassesByIds(budgetsIds, requestContextMock); //Then vertxTestContext.assertComplete(future) .onComplete(result -> { diff --git a/src/test/java/org/folio/services/fund/FundCodeExpenseClassesServiceTest.java b/src/test/java/org/folio/services/fund/FundCodeExpenseClassesServiceTest.java index 6f5a94ca..c7fe66f3 100644 --- a/src/test/java/org/folio/services/fund/FundCodeExpenseClassesServiceTest.java +++ b/src/test/java/org/folio/services/fund/FundCodeExpenseClassesServiceTest.java @@ -232,7 +232,7 @@ public void shouldRetrieveCombinationFundCodeExpClassesWithFiscalYear(VertxTestC .withStatus(BudgetExpenseClass.Status.ACTIVE); List budgetExpenseClassList = new ArrayList(Arrays.asList(budgetExpenseClass1, budgetExpenseClass2)); - when(budgetExpenseClassService.getBudgetExpensesClass(eq(budgetIds), eq(requestContext))) + when(budgetExpenseClassService.getBudgetExpenseClasses(eq(budgetIds), eq(requestContext))) .thenReturn(succeededFuture(budgetExpenseClassList)); when(ledgerDetailsService.getCurrentFiscalYear(eq(ledgerId1), eq(requestContext))) @@ -389,7 +389,7 @@ public void shouldRetrieveCombinationFundCodeExpClassesWithoutFiscalYear(VertxTe when(budgetService.getBudgets(anyString(), eq(0), eq(Integer.MAX_VALUE), eq(requestContext))).thenReturn(succeededFuture(budgetCollection)); - when(budgetExpenseClassService.getBudgetExpensesClass(eq(budgetIds), eq(requestContext))) + when(budgetExpenseClassService.getBudgetExpenseClasses(eq(budgetIds), eq(requestContext))) .thenReturn(succeededFuture(budgetExpenseClassList)); ExpenseClass expenseClass1 = new ExpenseClass()