diff --git a/src/main/java/org/folio/service/financedata/FinanceDataService.java b/src/main/java/org/folio/service/financedata/FinanceDataService.java index 71a9dfd7..6684938d 100644 --- a/src/main/java/org/folio/service/financedata/FinanceDataService.java +++ b/src/main/java/org/folio/service/financedata/FinanceDataService.java @@ -5,6 +5,7 @@ import java.util.List; import io.vertx.core.Future; +import org.apache.commons.collections4.CollectionUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.folio.okapi.common.GenericCompositeFuture; @@ -30,6 +31,9 @@ public FinanceDataService(FundService fundService, BudgetService budgetService) } public Future update(FyFinanceDataCollection entity, RequestContext requestContext) { + if (CollectionUtils.isEmpty(entity.getFyFinanceData())) { + return Future.succeededFuture(); + } var dbClient = requestContext.toDBClient(); return dbClient .withTrans(conn -> { diff --git a/src/main/java/org/folio/service/fund/StorageFundService.java b/src/main/java/org/folio/service/fund/StorageFundService.java index 81a57d34..843f9c45 100644 --- a/src/main/java/org/folio/service/fund/StorageFundService.java +++ b/src/main/java/org/folio/service/fund/StorageFundService.java @@ -31,11 +31,13 @@ public Future> getFundsByIds(List ids, DBConn conn) { @Override public Future updateFund(Fund fund, RequestContext requestContext) { + logger.debug("Trying to update fund '{}'", fund.getId()); var dbClient = requestContext.toDBClient(); return dbClient.withTrans(conn -> fundDAO.isFundStatusChanged(fund, conn) .compose(statusChanged -> { if (Boolean.TRUE.equals(statusChanged)) { + logger.info("updateFund:: Fund '{}' status has been changed to '{}'", fund.getId(), fund.getFundStatus()); return fundDAO.updateRelatedCurrentFYBudgets(fund, conn) .compose(v -> fundDAO.updateFund(fund, conn)); } @@ -46,6 +48,7 @@ public Future updateFund(Fund fund, RequestContext requestContext) { @Override public Future updateFundsWithMinChange(List funds, DBConn conn) { + logger.debug("updateFundsWithMinChange:: Trying to update '{}' fund(s) with minimal changes", funds.size()); return fundDAO.updateFunds(funds, conn); } } diff --git a/src/test/java/org/folio/rest/impl/TestBase.java b/src/test/java/org/folio/rest/impl/TestBase.java index 00f023b9..50b909b8 100644 --- a/src/test/java/org/folio/rest/impl/TestBase.java +++ b/src/test/java/org/folio/rest/impl/TestBase.java @@ -241,7 +241,7 @@ void testFetchingUpdatedEntity(String id, TestEntities subObject) { .path(subObject.getUpdatedFieldName()); // Get string value of updated field and compare - assertThat(String.valueOf(prop), equalTo(subObject.getUpdatedFieldValue())); + assertEquals(String.valueOf(prop), subObject.getUpdatedFieldValue()); } Response testEntitySuccessfullyFetched(String endpoint, String id) {