You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2022/12/29 11:38:22 UTC

[fineract] branch develop updated (fd3ad81f8 -> 77ee43acb)

This is an automated email from the ASF dual-hosted git repository.

arnold pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


    from fd3ad81f8 FINERACT-1837: DelinquencyBucketsIntegrationTest performance
     new 797ba293c chore(deps): update dependency io.github.resilience4j:resilience4j-spring-boot2 to v2
     new 7a9e696ac Removed vavr related code
     new 77ee43acb Fixed purge external events job

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../groovy/org.apache.fineract.dependencies.gradle |  2 +-
 .../commands/domain/CommandSourceRepository.java   |  4 +-
 .../jobs/PurgeProcessedCommandsTasklet.java        |  6 +-
 .../core/filters/IdempotencyStoreFilter.java       | 13 ++--
 .../jobs/filter/LoanCOBApiFilter.java              | 78 ++++++++++++----------
 .../jobs/PurgeProcessedCommandsTaskletTest.java    |  7 +-
 ...eauIntegrationWritePlatformServiceImplTest.java |  7 +-
 ...AccountDelinquencyRangeEventSerializerTest.java | 36 +++++-----
 integration-tests/build.gradle                     |  2 +-
 .../BatchRequestsIntegrationTest.java              | 11 +--
 .../integrationtests/CreditBureauTest.java         |  6 +-
 11 files changed, 90 insertions(+), 82 deletions(-)


[fineract] 02/03: Removed vavr related code

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 7a9e696ac890d2c59b29f216b7254b0782ca9a82
Author: Arnold Galovics <ga...@gmail.com>
AuthorDate: Wed Dec 28 18:22:50 2022 +0100

    Removed vavr related code
---
 .../core/filters/IdempotencyStoreFilter.java       | 13 ++--
 .../jobs/filter/LoanCOBApiFilter.java              | 78 ++++++++++++----------
 ...eauIntegrationWritePlatformServiceImplTest.java |  7 +-
 ...AccountDelinquencyRangeEventSerializerTest.java | 36 +++++-----
 .../BatchRequestsIntegrationTest.java              | 11 +--
 .../integrationtests/CreditBureauTest.java         |  6 +-
 6 files changed, 79 insertions(+), 72 deletions(-)

diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/filters/IdempotencyStoreFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/filters/IdempotencyStoreFilter.java
index 2030f2de0..5072e2710 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/filters/IdempotencyStoreFilter.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/filters/IdempotencyStoreFilter.java
@@ -18,7 +18,6 @@
  */
 package org.apache.fineract.infrastructure.core.filters;
 
-import io.vavr.collection.List;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.Optional;
@@ -115,11 +114,13 @@ public class IdempotencyStoreFilter extends OncePerRequestFilter implements Batc
     }
 
     private Optional<String> extractIdempotentKeyFromBatchRequest(BatchRequest request) {
-        return Optional.ofNullable(request.getHeaders()) //
-                .map(List::ofAll) //
-                .flatMap(headers -> headers.find(header -> header.getName().equals(fineractProperties.getIdempotencyKeyHeaderName()))
-                        .toJavaOptional()) //
-                .map(Header::getValue); //
+        if (request.getHeaders() == null) {
+            return Optional.empty();
+        }
+        return request.getHeaders() //
+                .stream().filter(header -> header.getName().equals(fineractProperties.getIdempotencyKeyHeaderName())) //
+                .map(Header::getValue) //
+                .findAny(); //
 
     }
 
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
index f31ef3127..95b09bd70 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
@@ -19,7 +19,6 @@
 package org.apache.fineract.infrastructure.jobs.filter;
 
 import com.google.common.base.Splitter;
-import io.vavr.control.Either;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.Collections;
@@ -34,6 +33,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.UriInfo;
+import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.fineract.batch.domain.BatchRequest;
@@ -74,6 +74,13 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchFilte
     private static final Integer GLIM_STRING_INDEX_IN_URL = 2;
     private static final String JOB_NAME = "INLINE_LOAN_COB";
 
+    @RequiredArgsConstructor
+    @Getter
+    private static class LoanIdsHardLockedException extends RuntimeException {
+
+        private final Long loanIdFromRequest;
+    }
+
     private static class Reject {
 
         private final String message;
@@ -109,35 +116,37 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchFilte
         if (!isOnApiList(request.getPathInfo(), request.getMethod())) {
             proceed(filterChain, request, response);
         } else {
-            Either<Reject, Boolean> bypassUser = isBypassUser();
-            if (bypassUser.isRight() && Boolean.TRUE.equals(bypassUser.get())) {
-                proceed(filterChain, request, response);
-            } else if (bypassUser.isLeft()) {
-                bypassUser.getLeft().toServletResponse(response);
-            } else {
-                Either<Reject, List<Long>> result = loanIdCalculation(request.getPathInfo());
-                if (result.isLeft()) {
-                    result.getLeft().toServletResponse(response);
+            try {
+                boolean bypassUser = isBypassUser();
+                if (bypassUser) {
+                    proceed(filterChain, request, response);
                 } else {
-                    if (isLoanSoftLocked(result.get())) {
-                        executeInlineCob(result.get());
+                    try {
+                        List<Long> result = calculateRelevantLoanIds(request.getPathInfo());
+                        if (isLoanSoftLocked(result)) {
+                            executeInlineCob(result);
+                        }
+                        proceed(filterChain, request, response);
+                    } catch (LoanIdsHardLockedException e) {
+                        Reject.reject(e.getLoanIdFromRequest(), HttpStatus.SC_CONFLICT).toServletResponse(response);
                     }
-                    proceed(filterChain, request, response);
                 }
+            } catch (UnAuthenticatedUserException e) {
+                Reject.reject(null, HttpStatus.SC_UNAUTHORIZED).toServletResponse(response);
             }
         }
     }
 
-    private Either<Reject, List<Long>> loanIdCalculation(String pathInfo) {
+    private List<Long> calculateRelevantLoanIds(String pathInfo) {
         Iterable<String> split = Splitter.on('/').split(pathInfo);
         Supplier<Stream<String>> streamSupplier = () -> StreamSupport.stream(split.spliterator(), false);
         boolean isGlim = isGlim(streamSupplier);
         Long loanIdFromRequest = getLoanId(isGlim, streamSupplier);
         List<Long> loanIds = isGlim ? getGlimChildLoanIds(loanIdFromRequest) : Collections.singletonList(loanIdFromRequest);
         if (isLoanHardLocked(loanIds)) {
-            return Either.left(Reject.reject(loanIdFromRequest, HttpStatus.SC_CONFLICT));
+            throw new LoanIdsHardLockedException(loanIdFromRequest);
         } else {
-            return Either.right(loanIds);
+            return loanIds;
         }
     }
 
@@ -145,12 +154,8 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchFilte
         inlineLoanCOBExecutorService.execute(loanIds, JOB_NAME);
     }
 
-    private Either<Reject, Boolean> isBypassUser() {
-        try {
-            return Either.right(context.authenticatedUser().isBypassUser());
-        } catch (UnAuthenticatedUserException e) {
-            return Either.left(Reject.reject(null, HttpStatus.SC_UNAUTHORIZED));
-        }
+    private boolean isBypassUser() {
+        return context.authenticatedUser().isBypassUser();
     }
 
     private List<Long> getGlimChildLoanIds(Long loanIdFromRequest) {
@@ -205,25 +210,24 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchFilte
         if (!isOnApiList("/" + batchRequest.getRelativeUrl(), batchRequest.getMethod())) {
             return chain.serviceCall(batchRequest, uriInfo);
         } else {
-            Either<Reject, Boolean> bypassUser = isBypassUser();
-            if (bypassUser.isRight() && Boolean.TRUE.equals(bypassUser.get())) {
-                return chain.serviceCall(batchRequest, uriInfo);
-            } else if (bypassUser.isLeft()) {
-                return bypassUser.getLeft().toBatchResponse(batchRequest);
-            } else {
-                Either<Reject, List<Long>> result = loanIdCalculation("/" + batchRequest.getRelativeUrl());
-                if (result.isLeft()) {
-                    return result.getLeft().toBatchResponse(batchRequest);
+            try {
+                boolean bypassUser = isBypassUser();
+                if (bypassUser) {
+                    return chain.serviceCall(batchRequest, uriInfo);
                 } else {
-                    if (!isLoanSoftLocked(result.get())) {
-                        executeInlineCob(result.get());
+                    try {
+                        List<Long> result = calculateRelevantLoanIds("/" + batchRequest.getRelativeUrl());
+                        if (!isLoanSoftLocked(result)) {
+                            executeInlineCob(result);
+                        }
+                        return chain.serviceCall(batchRequest, uriInfo);
+                    } catch (LoanIdsHardLockedException e) {
+                        return Reject.reject(e.getLoanIdFromRequest(), HttpStatus.SC_CONFLICT).toBatchResponse(batchRequest);
                     }
-                    return chain.serviceCall(batchRequest, uriInfo);
-
                 }
+            } catch (UnAuthenticatedUserException e) {
+                return Reject.reject(null, HttpStatus.SC_UNAUTHORIZED).toBatchResponse(batchRequest);
             }
         }
-
     }
-
 }
diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest.java
index 1d7b9895a..47fb2e845 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest.java
@@ -32,7 +32,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.gson.JsonParser;
-import io.vavr.CheckedFunction1;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -135,7 +134,7 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest {
         return mapper.writeValueAsString(jsonResponse);
     }
 
-    public void mockOkHttpCall(CheckedFunction1<Request, Response> responseGenerator) throws IOException {
+    public void mockOkHttpCall(CheckedFunction<Request, Response> responseGenerator) throws IOException {
         ArgumentCaptor<Request> requestCaptor = ArgumentCaptor.forClass(Request.class);
         Call callMock = mock(Call.class);
         when(okHttpClient.newCall(requestCaptor.capture())).thenReturn(callMock);
@@ -592,4 +591,8 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest {
         assertNull(result.getClosedAccounts());
     }
 
+    private interface CheckedFunction<T, R> {
+
+        R apply(T t) throws Exception;
+    }
 }
diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanAccountDelinquencyRangeEventSerializerTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanAccountDelinquencyRangeEventSerializerTest.java
index e9e8fcbe9..a4d70e36c 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanAccountDelinquencyRangeEventSerializerTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanAccountDelinquencyRangeEventSerializerTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.fineract.infrastructure.event.external.service.serialization.serializer.loan;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -60,7 +62,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge;
 import org.apache.fineract.portfolio.loanaccount.domain.LoanInstallmentCharge;
 import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
 import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -119,24 +120,21 @@ public class LoanAccountDelinquencyRangeEventSerializerTest {
         LoanAccountDelinquencyRangeDataV1 data = (LoanAccountDelinquencyRangeDataV1) serializer.toAvroDTO(event);
 
         // then
-        Assertions.assertEquals(1L, data.getLoanId());
-        Assertions.assertEquals("0001", data.getLoanAccountNo());
-        Assertions.assertEquals("externalId", data.getLoanExternalId());
-        Assertions.assertEquals(1L, data.getDelinquencyRange().getId());
-        Assertions.assertEquals("classification", data.getDelinquencyRange().getClassification());
-        Assertions.assertEquals(1, data.getDelinquencyRange().getMinimumAgeDays());
-        Assertions.assertEquals(10, data.getDelinquencyRange().getMaximumAgeDays());
-        Assertions.assertEquals(2, data.getCharges().size());
-        Assertions.assertTrue(io.vavr.collection.List.ofAll(data.getCharges())
-                .find(a -> a.getAmount().compareTo(new BigDecimal("100.5")) == 0).isDefined());
-        Assertions.assertTrue(io.vavr.collection.List.ofAll(data.getCharges())
-                .find(a -> a.getAmount().compareTo(new BigDecimal("200.3")) == 0).isDefined());
-
-        Assertions.assertEquals(0, data.getAmount().getTotalAmount().compareTo(new BigDecimal("185.0")));
-        Assertions.assertEquals(0, data.getAmount().getPrincipalAmount().compareTo(new BigDecimal("100.0")));
-        Assertions.assertEquals(0, data.getAmount().getInterestAmount().compareTo(new BigDecimal("30.0")));
-        Assertions.assertEquals(0, data.getAmount().getFeeAmount().compareTo(new BigDecimal("5.0")));
-        Assertions.assertEquals(0, data.getAmount().getPenaltyAmount().compareTo(new BigDecimal("50.0")));
+        assertEquals(1L, data.getLoanId());
+        assertEquals("0001", data.getLoanAccountNo());
+        assertEquals("externalId", data.getLoanExternalId());
+        assertEquals(1L, data.getDelinquencyRange().getId());
+        assertEquals("classification", data.getDelinquencyRange().getClassification());
+        assertEquals(1, data.getDelinquencyRange().getMinimumAgeDays());
+        assertEquals(10, data.getDelinquencyRange().getMaximumAgeDays());
+        assertEquals(2, data.getCharges().size());
+        assertTrue(data.getCharges().stream().anyMatch(a -> a.getAmount().compareTo(new BigDecimal("100.5")) == 0));
+        assertTrue(data.getCharges().stream().anyMatch(a -> a.getAmount().compareTo(new BigDecimal("200.3")) == 0));
+        assertEquals(0, data.getAmount().getTotalAmount().compareTo(new BigDecimal("185.0")));
+        assertEquals(0, data.getAmount().getPrincipalAmount().compareTo(new BigDecimal("100.0")));
+        assertEquals(0, data.getAmount().getInterestAmount().compareTo(new BigDecimal("30.0")));
+        assertEquals(0, data.getAmount().getFeeAmount().compareTo(new BigDecimal("5.0")));
+        assertEquals(0, data.getAmount().getPenaltyAmount().compareTo(new BigDecimal("50.0")));
 
         // assertEquals(data, expectedSerializedData);
         moneyHelper.close();
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java
index 694de4e12..23b869667 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java
@@ -220,8 +220,9 @@ public class BatchRequestsIntegrationTest {
 
         // Verify that each loan has been applied successfully
         for (BatchResponse res : response) {
-            Assertions.assertFalse(io.vavr.collection.List.ofAll(res.getHeaders())
-                    .find(header -> header.getName().equals(AbstractIdempotentCommandException.IDEMPOTENT_CACHE_HEADER)).isDefined(),
+            Assertions.assertFalse(
+                    res.getHeaders().stream()
+                            .anyMatch(header -> header.getName().equals(AbstractIdempotentCommandException.IDEMPOTENT_CACHE_HEADER)),
                     "First can not be cached!");
             Assertions.assertEquals(200L, (long) res.getStatusCode(), "Verify Status Code 200");
         }
@@ -232,9 +233,9 @@ public class BatchRequestsIntegrationTest {
         // Verify that each loan has been applied successfully
         for (BatchResponse res : secondResponse) {
             Assertions.assertEquals("true",
-                    io.vavr.collection.List.ofAll(res.getHeaders())
-                            .find(header -> header.getName().equals(AbstractIdempotentCommandException.IDEMPOTENT_CACHE_HEADER))
-                            .map(Header::getValue).get(),
+                    res.getHeaders().stream()
+                            .filter(header -> header.getName().equals(AbstractIdempotentCommandException.IDEMPOTENT_CACHE_HEADER))
+                            .map(Header::getValue).findAny().get(),
                     "Not cached by idempotency key!");
             Assertions.assertEquals(200L, (long) res.getStatusCode(), "Verify Status Code 200");
         }
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauTest.java
index 7d11d8c6c..49872176e 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauTest.java
@@ -37,6 +37,7 @@ import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatterBuilder;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauReportData;
 import org.apache.fineract.integrationtests.common.CreditBureauConfigurationHelper;
 import org.apache.fineract.integrationtests.common.CreditBureauIntegrationHelper;
@@ -80,9 +81,8 @@ public class CreditBureauTest {
         List<Map<String, Object>> configurations = CreditBureauConfigurationHelper.getCreditBureauConfiguration(requestSpec, responseSpec,
                 "1");
         Assertions.assertNotNull(configurations);
-        Map<String, Integer> currentConfiguration = io.vavr.collection.List.ofAll(configurations)
-                .toMap(k -> String.valueOf(k.get("configurationKey")).toUpperCase(), v -> (int) v.get("creditBureauConfigurationId"))
-                .toJavaMap();
+        Map<String, Integer> currentConfiguration = configurations.stream().collect(Collectors
+                .toMap(k -> String.valueOf(k.get("configurationKey")).toUpperCase(), v -> (int) v.get("creditBureauConfigurationId")));
         final Object usernameConfigurationId = CreditBureauConfigurationHelper.updateCreditBureauConfiguration(this.requestSpec,
                 this.responseSpec, currentConfiguration.get("USERNAME").intValue(), "USERNAME", "testUser");
         Assertions.assertNotNull(usernameConfigurationId);


[fineract] 03/03: Fixed purge external events job

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 77ee43acb841e1e5954367035ef657daf5526c89
Author: Arnold Galovics <ga...@gmail.com>
AuthorDate: Wed Dec 28 22:56:56 2022 +0100

    Fixed purge external events job
---
 .../apache/fineract/commands/domain/CommandSourceRepository.java   | 4 ++--
 .../fineract/commands/jobs/PurgeProcessedCommandsTasklet.java      | 6 +++---
 .../fineract/commands/jobs/PurgeProcessedCommandsTaskletTest.java  | 7 ++++---
 integration-tests/build.gradle                                     | 2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSourceRepository.java b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSourceRepository.java
index 13b6affbb..31dbe21a4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSourceRepository.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSourceRepository.java
@@ -18,7 +18,7 @@
  */
 package org.apache.fineract.commands.domain;
 
-import java.time.LocalDate;
+import java.time.OffsetDateTime;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
@@ -30,6 +30,6 @@ public interface CommandSourceRepository extends JpaRepository<CommandSource, Lo
 
     @Modifying(flushAutomatically = true)
     @Query("delete from CommandSource c where c.status = :status and c.madeOnDate is not null and c.madeOnDate <= :dateForPurgeCriteria")
-    void deleteOlderEventsWithStatus(CommandProcessingResultType status, LocalDate dateForPurgeCriteria);
+    void deleteOlderEventsWithStatus(Integer status, OffsetDateTime dateForPurgeCriteria);
 
 }
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTasklet.java
index 92cfac681..ba81cdfbb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTasklet.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTasklet.java
@@ -18,7 +18,7 @@
  */
 package org.apache.fineract.commands.jobs;
 
-import java.time.LocalDate;
+import java.time.OffsetDateTime;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.fineract.commands.domain.CommandProcessingResultType;
@@ -43,8 +43,8 @@ public class PurgeProcessedCommandsTasklet implements Tasklet {
     public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
         try {
             Long numberOfDaysForPurgeCriteria = configurationDomainService.retrieveProcessedCommandsPurgeDaysCriteria();
-            LocalDate dateForPurgeCriteria = DateUtils.getBusinessLocalDate().minusDays(numberOfDaysForPurgeCriteria);
-            repository.deleteOlderEventsWithStatus(CommandProcessingResultType.PROCESSED, dateForPurgeCriteria);
+            OffsetDateTime dateForPurgeCriteria = DateUtils.getOffsetDateTimeOfTenant().minusDays(numberOfDaysForPurgeCriteria);
+            repository.deleteOlderEventsWithStatus(CommandProcessingResultType.PROCESSED.getValue(), dateForPurgeCriteria);
         } catch (Exception e) {
             log.error("Error occurred while purging processed commands: ", e);
         }
diff --git a/fineract-provider/src/test/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTaskletTest.java b/fineract-provider/src/test/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTaskletTest.java
index 050438443..c172dfa96 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTaskletTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/commands/jobs/PurgeProcessedCommandsTaskletTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import java.time.LocalDate;
+import java.time.OffsetDateTime;
 import java.time.ZoneId;
 import java.util.HashMap;
 import java.util.Map;
@@ -70,15 +71,15 @@ public class PurgeProcessedCommandsTaskletTest {
     @Test
     public void givenEventsForPurgeWhenTaskExecutionThenEventsPurgeForDaysCriteria() {
         // given
-        ArgumentCaptor<LocalDate> dateCriteriaCaptor = ArgumentCaptor.forClass(LocalDate.class);
+        ArgumentCaptor<OffsetDateTime> dateCriteriaCaptor = ArgumentCaptor.forClass(OffsetDateTime.class);
         when(configurationDomainService.retrieveProcessedCommandsPurgeDaysCriteria()).thenReturn(2L);
         // when
         resultStatus = underTest.execute(stepContribution, chunkContext);
         // then
         verify(repository, times(1)).deleteOlderEventsWithStatus(Mockito.any(), Mockito.any());
         verify(repository).deleteOlderEventsWithStatus(Mockito.any(), dateCriteriaCaptor.capture());
-        LocalDate expectedDateForPurgeCriteriaTest = DateUtils.getBusinessLocalDate().minusDays(2);
-        LocalDate actualDateForPurgeCriteria = dateCriteriaCaptor.getValue();
+        OffsetDateTime expectedDateForPurgeCriteriaTest = DateUtils.getOffsetDateTimeOfTenant().minusDays(2);
+        OffsetDateTime actualDateForPurgeCriteria = dateCriteriaCaptor.getValue();
         assertEquals(expectedDateForPurgeCriteriaTest, actualDateForPurgeCriteria);
         assertEquals(RepeatStatus.FINISHED, resultStatus);
     }
diff --git a/integration-tests/build.gradle b/integration-tests/build.gradle
index e1969a2ca..5eb324723 100644
--- a/integration-tests/build.gradle
+++ b/integration-tests/build.gradle
@@ -57,7 +57,7 @@ cargo {
             downloadDir = file("$buildDir/download")
             extractDir = file("$buildDir/tomcat-integration-tests")
         }
-        startStopTimeout = 240000
+        startStopTimeout = 300000
         sharedClasspath = configurations.driver
         containerProperties {
             def jvmArgs = '--add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED '


[fineract] 01/03: chore(deps): update dependency io.github.resilience4j:resilience4j-spring-boot2 to v2

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 797ba293c03f208d5d12fea6e06062d0c16569d2
Author: Renovate <bo...@renovateapp.com>
AuthorDate: Thu Dec 15 16:32:07 2022 +0000

    chore(deps): update dependency io.github.resilience4j:resilience4j-spring-boot2 to v2
---
 buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle b/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle
index 2cfc378d4..9f20cef78 100644
--- a/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle
+++ b/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle
@@ -220,7 +220,7 @@ dependencyManagement {
 
         dependency "org.apache.avro:avro:1.11.1"
 
-        dependency "io.github.resilience4j:resilience4j-spring-boot2:1.7.1"
+        dependency "io.github.resilience4j:resilience4j-spring-boot2:2.0.2"
 
         dependency ('org.mariadb.jdbc:mariadb-java-client:3.0.9') {
             exclude 'org.slf4j:jcl-over-slf4j'