From 1808e921ba86c44b99b37cae5196c77ba2495034 Mon Sep 17 00:00:00 2001 From: Janos Haber Date: Wed, 25 Jan 2023 15:38:46 +0100 Subject: [PATCH] Revert "FINERACT-1724 - Replayed bulk transaction fix [x] - Remove bulk transaction from ReplayedTransactionBusinessEventService [x] - Create Aspect and custom annotation for CommandHandler and Tasklet bulk events [x] - Add @BulkEventSupport annotation where ReplayedTransactionBusinessEventService was used [x] - Test class for Aspect call failure handling" This reverts commit 1b2c09ea --- fineract-provider/build.gradle | 3 +- .../business/annotation/BulkEventSupport.java | 37 ---------- .../business/aspect/BulkEventAspect.java | 55 --------------- .../service/BusinessEventNotifierService.java | 4 +- .../BusinessEventNotifierServiceImpl.java | 4 +- .../CreateAccountTransferCommandHandler.java | 2 - .../ExecuteStandingInstructionsTasklet.java | 2 - ...dividualCollectionSheetCommandHandler.java | 2 - .../UpdateCollectionSheetCommandHandler.java | 2 - ...veCenterCollectionSheetCommandHandler.java | 2 - ...aveGroupCollectionSheetCommandHandler.java | 2 - ...leteLoanDisburseDetailsCommandHandler.java | 2 - .../handler/AddLoanChargeCommandHandler.java | 2 - .../handler/DisburseLoanCommandHandler.java | 2 - .../DisburseLoanToSavingsCommandHandler.java | 2 - .../handler/ForeClosureCommandHandler.java | 2 - ...LoanApplicationDisburseCommandHandler.java | 2 - .../LoanChargeRefundCommandHandler.java | 2 - .../LoanGoodwillCreditCommandHandler.java | 2 - ...oanMerchantIssuedRefundCommandHandler.java | 2 - .../LoanPayoutRefundCommandHandler.java | 2 - .../LoanRecoveryPaymentCommandHandler.java | 2 - ...LoanRepaymentAdjustmentCommandHandler.java | 2 - .../handler/LoanRepaymentCommandHandler.java | 2 - .../handler/PayLoanChargeCommandHandler.java | 2 - .../RecoverFromGuarantorCommandHandler.java | 2 - .../UndoWriteOffLoanCommandHandler.java | 2 - .../UpdateLoanDisburseDateCommandHandler.java | 2 - ...veInterestPortionOnLoanCommandHandler.java | 2 - ...ChargeToOverdueLoanInstallmentTasklet.java | 2 - .../RecalculateInterestForLoanTasklet.java | 2 - .../TransferFeeChargeForLoansTasklet.java | 2 - ...veLoanRescheduleRequestCommandHandler.java | 2 - ...edTransactionBusinessEventServiceImpl.java | 20 ++++-- ...vateFixedDepositAccountCommandHandler.java | 2 - ...RecurringDepositAccountCommandHandler.java | 2 - ...loseFixedDepositAccountCommandHandler.java | 2 - ...RecurringDepositAccountCommandHandler.java | 2 - ...loseFixedDepositAccountCommandHandler.java | 2 - ...RecurringDepositAccountCommandHandler.java | 2 - .../TransferInterestToSavingsTasklet.java | 2 - ...DepositsAccountMaturityDetailsTasklet.java | 2 - .../apache/fineract/AbstractSpringTest.java | 31 -------- .../apache/fineract/TestConfiguration.java | 10 +-- ...{CucumberTestSuite.java => TestSuite.java} | 4 +- .../apache/fineract/bulk/BulkAspectTest.java | 44 ------------ .../apache/fineract/bulk/BulkTestEvent.java | 42 ----------- .../fineract/bulk/NestedBulkTestEvent.java | 31 -------- .../loanaccount/service/DummyTasklet.java | 52 -------------- ...onBusinessEventServiceIntegrationTest.java | 70 ++++++++----------- 50 files changed, 48 insertions(+), 431 deletions(-) delete mode 100644 fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/annotation/BulkEventSupport.java delete mode 100644 fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/aspect/BulkEventAspect.java delete mode 100644 fineract-provider/src/test/java/org/apache/fineract/AbstractSpringTest.java rename fineract-provider/src/test/java/org/apache/fineract/{CucumberTestSuite.java => TestSuite.java} (90%) delete mode 100644 fineract-provider/src/test/java/org/apache/fineract/bulk/BulkAspectTest.java delete mode 100644 fineract-provider/src/test/java/org/apache/fineract/bulk/BulkTestEvent.java delete mode 100644 fineract-provider/src/test/java/org/apache/fineract/bulk/NestedBulkTestEvent.java delete mode 100644 fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/DummyTasklet.java diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 35d2685aa..5adfc25af 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -150,10 +150,9 @@ configurations { driver } dependencies { - testImplementation 'org.projectlombok:lombok:1.18.24' driver 'org.mariadb.jdbc:mariadb-java-client' driver 'org.postgresql:postgresql' - driver 'mysql:mysql-connector-java:8.0.32' + driver 'mysql:mysql-connector-java:8.0.31' } URLClassLoader loader = GroovyObject.class.classLoader diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/annotation/BulkEventSupport.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/annotation/BulkEventSupport.java deleted file mode 100644 index 6299bb8ff..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/annotation/BulkEventSupport.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.infrastructure.event.business.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to be used to collect events into BulkEvent - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE, ElementType.METHOD }) -@Documented -@Inherited -public @interface BulkEventSupport { - -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/aspect/BulkEventAspect.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/aspect/BulkEventAspect.java deleted file mode 100644 index e89422dc8..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/aspect/BulkEventAspect.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.infrastructure.event.business.aspect; - -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.springframework.stereotype.Component; - -@Component -@RequiredArgsConstructor -@Aspect -public class BulkEventAspect { - - private final BusinessEventNotifierService businessEventNotifierService; - - @Around("execution(@org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport public * *(..)) || execution(public * (@org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport *).*(..))") - public Object processCommandJoinPoint(ProceedingJoinPoint proceedingJoinPoint) { - return bulkAroundWrapper(proceedingJoinPoint); - } - - @SneakyThrows - private Object bulkAroundWrapper(ProceedingJoinPoint proceedingJoinPoint) { - if (businessEventNotifierService.isExternalEventRecordingEnabled()) { - return proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs()); - } - try { - businessEventNotifierService.startExternalEventRecording(); - Object result = proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs()); - businessEventNotifierService.stopExternalEventRecording(); - return result; - } finally { - businessEventNotifierService.resetEventRecording(); - } - } -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierService.java index c5fb59fa0..d0176bc41 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierService.java @@ -23,6 +23,7 @@ import org.apache.fineract.infrastructure.event.business.domain.BusinessEvent; /** * Implemented class is responsible for notifying the business event to registered listeners. + * */ public interface BusinessEventNotifierService { @@ -46,12 +47,9 @@ public interface BusinessEventNotifierService { */ > void addPostBusinessEventListener(Class eventType, BusinessEventListener listener); - boolean isExternalEventRecordingEnabled(); - void startExternalEventRecording(); void stopExternalEventRecording(); void resetEventRecording(); - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierServiceImpl.java index 3573c03d8..dca732ad9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/service/BusinessEventNotifierServiceImpl.java @@ -110,8 +110,7 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe businessEventListeners.add(listener); } - @Override - public boolean isExternalEventRecordingEnabled() { + private boolean isExternalEventRecordingEnabled() { return eventRecordingEnabled.get(); } @@ -162,5 +161,4 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe eventRecordingEnabled.set(false); recordedEvents.remove(); } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/handler/CreateAccountTransferCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/handler/CreateAccountTransferCommandHandler.java index a9433c67f..fef99250f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/handler/CreateAccountTransferCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/handler/CreateAccountTransferCommandHandler.java @@ -23,7 +23,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "ACCOUNTTRANSFER", action = "CREATE") -@BulkEventSupport public class CreateAccountTransferCommandHandler implements NewCommandSourceHandler { private final AccountTransfersWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/jobs/executestandinginstructions/ExecuteStandingInstructionsTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/jobs/executestandinginstructions/ExecuteStandingInstructionsTasklet.java index 5be7e56e0..16fd0c3e1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/jobs/executestandinginstructions/ExecuteStandingInstructionsTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/jobs/executestandinginstructions/ExecuteStandingInstructionsTasklet.java @@ -30,7 +30,6 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformService import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException; import org.apache.fineract.portfolio.account.data.AccountTransferDTO; import org.apache.fineract.portfolio.account.data.StandingInstructionData; @@ -53,7 +52,6 @@ import org.springframework.jdbc.core.JdbcTemplate; @Slf4j @RequiredArgsConstructor -@BulkEventSupport public class ExecuteStandingInstructionsTasklet implements Tasklet { private final StandingInstructionReadPlatformService standingInstructionReadPlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/SaveIndividualCollectionSheetCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/SaveIndividualCollectionSheetCommandHandler.java index ac94a7561..943761270 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/SaveIndividualCollectionSheetCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/SaveIndividualCollectionSheetCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "COLLECTIONSHEET", action = "SAVE") -@BulkEventSupport public class SaveIndividualCollectionSheetCommandHandler implements NewCommandSourceHandler { private final CollectionSheetWritePlatformService collectionSheetWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/UpdateCollectionSheetCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/UpdateCollectionSheetCommandHandler.java index c77c189a5..171e804bd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/UpdateCollectionSheetCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/handler/UpdateCollectionSheetCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "COLLECTIONSHEET", action = "UPDATE") -@BulkEventSupport public class UpdateCollectionSheetCommandHandler implements NewCommandSourceHandler { private final CollectionSheetWritePlatformService collectionSheetWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveCenterCollectionSheetCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveCenterCollectionSheetCommandHandler.java index 09199bb85..f134a8cfc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveCenterCollectionSheetCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveCenterCollectionSheetCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "CENTER", action = "SAVECOLLECTIONSHEET") -@BulkEventSupport public class SaveCenterCollectionSheetCommandHandler implements NewCommandSourceHandler { private final CollectionSheetWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveGroupCollectionSheetCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveGroupCollectionSheetCommandHandler.java index 9435a79cb..3eca03069 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveGroupCollectionSheetCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/handler/SaveGroupCollectionSheetCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "GROUP", action = "SAVECOLLECTIONSHEET") -@BulkEventSupport public class SaveGroupCollectionSheetCommandHandler implements NewCommandSourceHandler { private final CollectionSheetWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddAndDeleteLoanDisburseDetailsCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddAndDeleteLoanDisburseDetailsCommandHandler.java index 8678f6ebc..07c161bdb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddAndDeleteLoanDisburseDetailsCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddAndDeleteLoanDisburseDetailsCommandHandler.java @@ -22,14 +22,12 @@ import lombok.RequiredArgsConstructor; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor -@BulkEventSupport public class AddAndDeleteLoanDisburseDetailsCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddLoanChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddLoanChargeCommandHandler.java index 8a92ff9bd..46c50bb5b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddLoanChargeCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/AddLoanChargeCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.DataIntegrityErrorHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.orm.jpa.JpaSystemException; @@ -34,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOANCHARGE", action = "CREATE") -@BulkEventSupport public class AddLoanChargeCommandHandler implements NewCommandSourceHandler { private final LoanChargeWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanCommandHandler.java index 21f94b31b..83267c329 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.DataIntegrityErrorHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.orm.jpa.JpaSystemException; @@ -34,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "DISBURSE") -@BulkEventSupport public class DisburseLoanCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanToSavingsCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanToSavingsCommandHandler.java index fb0424ab3..762b7c389 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanToSavingsCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/DisburseLoanToSavingsCommandHandler.java @@ -23,7 +23,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "DISBURSETOSAVINGS") -@BulkEventSupport public class DisburseLoanToSavingsCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/ForeClosureCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/ForeClosureCommandHandler.java index 73d3fb311..caf039903 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/ForeClosureCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/ForeClosureCommandHandler.java @@ -23,14 +23,12 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "FORECLOSURE") -@BulkEventSupport public class ForeClosureCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/GlimLoanApplicationDisburseCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/GlimLoanApplicationDisburseCommandHandler.java index 6fdc7971c..3a3d5faaf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/GlimLoanApplicationDisburseCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/GlimLoanApplicationDisburseCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -32,7 +31,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "GLIMLOAN", action = "DISBURSE") -@BulkEventSupport public class GlimLoanApplicationDisburseCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanChargeRefundCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanChargeRefundCommandHandler.java index 49fa06afb..245cf2473 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanChargeRefundCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanChargeRefundCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.DataIntegrityErrorHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.orm.jpa.JpaSystemException; @@ -34,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "CHARGEREFUND") -@BulkEventSupport public class LoanChargeRefundCommandHandler implements NewCommandSourceHandler { private final LoanChargeWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanGoodwillCreditCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanGoodwillCreditCommandHandler.java index cd50d04e0..196dd35a3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanGoodwillCreditCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanGoodwillCreditCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.DataIntegrityErrorHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.dao.DataIntegrityViolationException; @@ -35,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "GOODWILLCREDIT") -@BulkEventSupport public class LoanGoodwillCreditCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanMerchantIssuedRefundCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanMerchantIssuedRefundCommandHandler.java index e092f8f06..ef71cc222 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanMerchantIssuedRefundCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanMerchantIssuedRefundCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.DataIntegrityErrorHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.dao.DataIntegrityViolationException; @@ -35,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "MERCHANTISSUEDREFUND") -@BulkEventSupport public class LoanMerchantIssuedRefundCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanPayoutRefundCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanPayoutRefundCommandHandler.java index e42c0c3a7..1de3ccfb8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanPayoutRefundCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanPayoutRefundCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.DataIntegrityErrorHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.dao.DataIntegrityViolationException; @@ -35,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "PAYOUTREFUND") -@BulkEventSupport public class LoanPayoutRefundCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java index 8413d5d86..8004f99f6 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java @@ -23,7 +23,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; @@ -31,7 +30,6 @@ import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "RECOVERYPAYMENT") -@BulkEventSupport public class LoanRecoveryPaymentCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentAdjustmentCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentAdjustmentCommandHandler.java index 536755262..3e313f152 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentAdjustmentCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentAdjustmentCommandHandler.java @@ -23,7 +23,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "ADJUST") -@BulkEventSupport public class LoanRepaymentAdjustmentCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentCommandHandler.java index 7e6b911dd..28d679b76 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRepaymentCommandHandler.java @@ -24,7 +24,6 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.DataIntegrityErrorHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.dao.DataIntegrityViolationException; @@ -35,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "REPAYMENT") -@BulkEventSupport public class LoanRepaymentCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/PayLoanChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/PayLoanChargeCommandHandler.java index 0ff2209a1..1d3a25101 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/PayLoanChargeCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/PayLoanChargeCommandHandler.java @@ -23,7 +23,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOANCHARGE", action = "PAY") -@BulkEventSupport public class PayLoanChargeCommandHandler implements NewCommandSourceHandler { private final LoanChargeWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/RecoverFromGuarantorCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/RecoverFromGuarantorCommandHandler.java index ecec460ca..2c25fdfd7 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/RecoverFromGuarantorCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/RecoverFromGuarantorCommandHandler.java @@ -23,14 +23,12 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "RECOVERGUARANTEES") -@BulkEventSupport public class RecoverFromGuarantorCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UndoWriteOffLoanCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UndoWriteOffLoanCommandHandler.java index a02bb752a..f0559fa65 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UndoWriteOffLoanCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UndoWriteOffLoanCommandHandler.java @@ -23,7 +23,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "UNDOWRITEOFF") -@BulkEventSupport public class UndoWriteOffLoanCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UpdateLoanDisburseDateCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UpdateLoanDisburseDateCommandHandler.java index a5b92501b..17fa829dc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UpdateLoanDisburseDateCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/UpdateLoanDisburseDateCommandHandler.java @@ -22,14 +22,12 @@ import lombok.RequiredArgsConstructor; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor -@BulkEventSupport public class UpdateLoanDisburseDateCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/WaiveInterestPortionOnLoanCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/WaiveInterestPortionOnLoanCommandHandler.java index ca7ffcd76..a80f32b47 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/WaiveInterestPortionOnLoanCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/WaiveInterestPortionOnLoanCommandHandler.java @@ -23,7 +23,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @CommandType(entity = "LOAN", action = "WAIVEINTERESTPORTION") -@BulkEventSupport public class WaiveInterestPortionOnLoanCommandHandler implements NewCommandSourceHandler { private final LoanWritePlatformService writePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/applychargetooverdueloaninstallment/ApplyChargeToOverdueLoanInstallmentTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/applychargetooverdueloaninstallment/ApplyChargeToOverdueLoanInstallmentTasklet.java index 92b52f673..bce7e33c4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/applychargetooverdueloaninstallment/ApplyChargeToOverdueLoanInstallmentTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/applychargetooverdueloaninstallment/ApplyChargeToOverdueLoanInstallmentTasklet.java @@ -29,7 +29,6 @@ import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDoma import org.apache.fineract.infrastructure.core.data.ApiParameterError; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData; import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService; @@ -41,7 +40,6 @@ import org.springframework.batch.repeat.RepeatStatus; @Slf4j @RequiredArgsConstructor -@BulkEventSupport public class ApplyChargeToOverdueLoanInstallmentTasklet implements Tasklet { private final ConfigurationDomainService configurationDomainService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/recalculateinterestforloan/RecalculateInterestForLoanTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/recalculateinterestforloan/RecalculateInterestForLoanTasklet.java index 043cf43ad..7d70c478b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/recalculateinterestforloan/RecalculateInterestForLoanTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/recalculateinterestforloan/RecalculateInterestForLoanTasklet.java @@ -31,7 +31,6 @@ import java.util.concurrent.Future; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException; import org.apache.fineract.organisation.office.data.OfficeData; import org.apache.fineract.organisation.office.exception.OfficeNotFoundException; @@ -47,7 +46,6 @@ import org.springframework.batch.repeat.RepeatStatus; @Slf4j @RequiredArgsConstructor -@BulkEventSupport public class RecalculateInterestForLoanTasklet implements Tasklet { private final LoanReadPlatformService loanReadPlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/transferfeechargeforloans/TransferFeeChargeForLoansTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/transferfeechargeforloans/TransferFeeChargeForLoansTasklet.java index a814343f2..66c03a401 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/transferfeechargeforloans/TransferFeeChargeForLoansTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/transferfeechargeforloans/TransferFeeChargeForLoansTasklet.java @@ -25,7 +25,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.fineract.infrastructure.core.domain.ExternalId; import org.apache.fineract.infrastructure.core.service.DateUtils; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException; import org.apache.fineract.portfolio.account.PortfolioAccountType; import org.apache.fineract.portfolio.account.data.AccountTransferDTO; @@ -46,7 +45,6 @@ import org.springframework.batch.repeat.RepeatStatus; @Slf4j @RequiredArgsConstructor -@BulkEventSupport public class TransferFeeChargeForLoansTasklet implements Tasklet { private final LoanChargeReadPlatformService loanChargeReadPlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/handler/ApproveLoanRescheduleRequestCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/handler/ApproveLoanRescheduleRequestCommandHandler.java index 8915d0c6c..20964b619 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/handler/ApproveLoanRescheduleRequestCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/handler/ApproveLoanRescheduleRequestCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.loanaccount.rescheduleloan.service.LoanRescheduleRequestWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "RESCHEDULELOAN", action = "APPROVE") -@BulkEventSupport public class ApproveLoanRescheduleRequestCommandHandler implements NewCommandSourceHandler { private final LoanRescheduleRequestWritePlatformService loanRescheduleRequestWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java index 080ca0814..1359e00e6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java @@ -41,13 +41,19 @@ public class ReplayedTransactionBusinessEventServiceImpl implements ReplayedTran return; } // Extra safety net to avoid event leaking - for (Map.Entry mapEntry : changedTransactionDetail.getNewTransactionMappings().entrySet()) { - LoanTransaction oldTransaction = loanTransactionRepository.findById(mapEntry.getKey()) - .orElseThrow(() -> new LoanTransactionNotFoundException(mapEntry.getKey())); - LoanAdjustTransactionBusinessEvent.Data data = new LoanAdjustTransactionBusinessEvent.Data(oldTransaction); - data.setNewTransactionDetail(mapEntry.getValue()); - businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data)); + try { + businessEventNotifierService.startExternalEventRecording(); + for (Map.Entry mapEntry : changedTransactionDetail.getNewTransactionMappings().entrySet()) { + LoanTransaction oldTransaction = loanTransactionRepository.findById(mapEntry.getKey()) + .orElseThrow(() -> new LoanTransactionNotFoundException(mapEntry.getKey())); + LoanAdjustTransactionBusinessEvent.Data data = new LoanAdjustTransactionBusinessEvent.Data(oldTransaction); + data.setNewTransactionDetail(mapEntry.getValue()); + businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data)); + } + businessEventNotifierService.stopExternalEventRecording(); + } catch (Exception e) { + businessEventNotifierService.resetEventRecording(); + throw e; } } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateFixedDepositAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateFixedDepositAccountCommandHandler.java index 209906c6a..437ad8109 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateFixedDepositAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateFixedDepositAccountCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "ACTIVATE") -@BulkEventSupport public class ActivateFixedDepositAccountCommandHandler implements NewCommandSourceHandler { private final DepositAccountWritePlatformService depositAccountWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateRecurringDepositAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateRecurringDepositAccountCommandHandler.java index 4ce8798f8..bab80747c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateRecurringDepositAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ActivateRecurringDepositAccountCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "ACTIVATE") -@BulkEventSupport public class ActivateRecurringDepositAccountCommandHandler implements NewCommandSourceHandler { private final DepositAccountWritePlatformService depositAccountWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseFixedDepositAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseFixedDepositAccountCommandHandler.java index 39dead817..8b105b5a8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseFixedDepositAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseFixedDepositAccountCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "CLOSE") -@BulkEventSupport public class CloseFixedDepositAccountCommandHandler implements NewCommandSourceHandler { private final DepositAccountWritePlatformService depositAccountWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseRecurringDepositAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseRecurringDepositAccountCommandHandler.java index 959e482b9..c259d8499 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseRecurringDepositAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/CloseRecurringDepositAccountCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "CLOSE") -@BulkEventSupport public class CloseRecurringDepositAccountCommandHandler implements NewCommandSourceHandler { private final DepositAccountWritePlatformService depositAccountWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseFixedDepositAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseFixedDepositAccountCommandHandler.java index 84da79a52..cb509a3a7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseFixedDepositAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseFixedDepositAccountCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "PREMATURECLOSE") -@BulkEventSupport public class PrematureCloseFixedDepositAccountCommandHandler implements NewCommandSourceHandler { private final DepositAccountWritePlatformService depositAccountWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseRecurringDepositAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseRecurringDepositAccountCommandHandler.java index ec276000d..15044fe43 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseRecurringDepositAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/PrematureCloseRecurringDepositAccountCommandHandler.java @@ -22,7 +22,6 @@ import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "PREMATURECLOSE") -@BulkEventSupport public class PrematureCloseRecurringDepositAccountCommandHandler implements NewCommandSourceHandler { private final DepositAccountWritePlatformService depositAccountWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/transferinteresttosavings/TransferInterestToSavingsTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/transferinteresttosavings/TransferInterestToSavingsTasklet.java index 34f2d448d..15252d122 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/transferinteresttosavings/TransferInterestToSavingsTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/transferinteresttosavings/TransferInterestToSavingsTasklet.java @@ -24,7 +24,6 @@ import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException; import org.apache.fineract.portfolio.account.data.AccountTransferDTO; import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService; @@ -37,7 +36,6 @@ import org.springframework.batch.repeat.RepeatStatus; @Slf4j @RequiredArgsConstructor -@BulkEventSupport public class TransferInterestToSavingsTasklet implements Tasklet { private final DepositAccountReadPlatformService depositAccountReadPlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/updatedepositsaccountmaturitydetails/UpdateDepositsAccountMaturityDetailsTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/updatedepositsaccountmaturitydetails/UpdateDepositsAccountMaturityDetailsTasklet.java index d4d63886b..5f956586a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/updatedepositsaccountmaturitydetails/UpdateDepositsAccountMaturityDetailsTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/jobs/updatedepositsaccountmaturitydetails/UpdateDepositsAccountMaturityDetailsTasklet.java @@ -25,7 +25,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.fineract.infrastructure.core.data.ApiParameterError; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.data.DepositAccountData; import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService; @@ -37,7 +36,6 @@ import org.springframework.batch.repeat.RepeatStatus; @Slf4j @RequiredArgsConstructor -@BulkEventSupport public class UpdateDepositsAccountMaturityDetailsTasklet implements Tasklet { private final DepositAccountReadPlatformService depositAccountReadPlatformService; diff --git a/fineract-provider/src/test/java/org/apache/fineract/AbstractSpringTest.java b/fineract-provider/src/test/java/org/apache/fineract/AbstractSpringTest.java deleted file mode 100644 index 88534b644..000000000 --- a/fineract-provider/src/test/java/org/apache/fineract/AbstractSpringTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract; - -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.WebAppConfiguration; - -@ExtendWith(SpringExtension.class) -@TestPropertySource("classpath:application-test.properties") -@WebAppConfiguration -@ContextConfiguration(classes = TestConfiguration.class) -public class AbstractSpringTest {} diff --git a/fineract-provider/src/test/java/org/apache/fineract/TestConfiguration.java b/fineract-provider/src/test/java/org/apache/fineract/TestConfiguration.java index f9208fe65..3d30b193b 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/TestConfiguration.java +++ b/fineract-provider/src/test/java/org/apache/fineract/TestConfiguration.java @@ -23,7 +23,6 @@ import static org.mockito.Mockito.mock; import com.zaxxer.hikari.HikariDataSource; import javax.sql.DataSource; -import org.apache.fineract.infrastructure.core.config.CacheConfig; import org.apache.fineract.infrastructure.core.config.FineractProperties; import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant; import org.apache.fineract.infrastructure.core.service.database.DatabaseIndependentQueryService; @@ -55,7 +54,6 @@ import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfigurati import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.cache.jcache.JCacheCacheManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -78,8 +76,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableWebSecurity @EnableConfigurationProperties({ FineractProperties.class, LiquibaseProperties.class }) @ComponentScan(basePackages = "org.apache.fineract", excludeFilters = { - @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = ScheduledJobRunnerConfig.class), - @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = CacheConfig.class) }) + @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = ScheduledJobRunnerConfig.class) }) @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) public class TestConfiguration { @@ -199,9 +196,4 @@ public class TestConfiguration { public JobRepository jobRepository() { return mock(JobRepository.class, RETURNS_MOCKS); } - - @Bean - public JCacheCacheManager jCacheCacheManager() { - return new JCacheCacheManager(); - } } diff --git a/fineract-provider/src/test/java/org/apache/fineract/CucumberTestSuite.java b/fineract-provider/src/test/java/org/apache/fineract/TestSuite.java similarity index 90% rename from fineract-provider/src/test/java/org/apache/fineract/CucumberTestSuite.java rename to fineract-provider/src/test/java/org/apache/fineract/TestSuite.java index d2b56f1c3..a19862348 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/CucumberTestSuite.java +++ b/fineract-provider/src/test/java/org/apache/fineract/TestSuite.java @@ -25,12 +25,12 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; -// This configuration class is used for Cucumber tests, it's invoked via Cucumber glue (cucumber.properties) @CucumberContextConfiguration @ExtendWith(SpringExtension.class) @TestPropertySource("classpath:application-test.properties") @WebAppConfiguration @ContextConfiguration(classes = TestConfiguration.class) -public class CucumberTestSuite { +// @SpringBootTest(classes = TestConfiguration.class) +public class TestSuite { } diff --git a/fineract-provider/src/test/java/org/apache/fineract/bulk/BulkAspectTest.java b/fineract-provider/src/test/java/org/apache/fineract/bulk/BulkAspectTest.java deleted file mode 100644 index bb4229090..000000000 --- a/fineract-provider/src/test/java/org/apache/fineract/bulk/BulkAspectTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.bulk; - -import org.apache.fineract.AbstractSpringTest; -import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.SpyBean; - -public class BulkAspectTest extends AbstractSpringTest { - - @Autowired - private BulkTestEvent testEvent; - @SpyBean - private BusinessEventNotifierService notifier; - - @Test - public void testEventOnFail() { - - Assertions.assertThrows(IllegalStateException.class, () -> testEvent.processCommand(null)); - Mockito.verify(notifier, Mockito.times(1)).startExternalEventRecording(); - Mockito.verify(notifier, Mockito.times(0)).stopExternalEventRecording(); - Mockito.verify(notifier, Mockito.times(1)).resetEventRecording(); - } -} diff --git a/fineract-provider/src/test/java/org/apache/fineract/bulk/BulkTestEvent.java b/fineract-provider/src/test/java/org/apache/fineract/bulk/BulkTestEvent.java deleted file mode 100644 index d3897b965..000000000 --- a/fineract-provider/src/test/java/org/apache/fineract/bulk/BulkTestEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.bulk; - -import org.apache.fineract.commands.handler.NewCommandSourceHandler; -import org.apache.fineract.infrastructure.core.api.JsonCommand; -import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; -import org.springframework.stereotype.Component; - -@Component -@BulkEventSupport -public class BulkTestEvent implements NewCommandSourceHandler { - - private final NestedBulkTestEvent nestedBulkTestEvent; - - public BulkTestEvent(NestedBulkTestEvent nestedBulkTestEvent) { - this.nestedBulkTestEvent = nestedBulkTestEvent; - } - - @Override - public CommandProcessingResult processCommand(JsonCommand command) { - nestedBulkTestEvent.exec(); - return new CommandProcessingResult(1L); - } -} diff --git a/fineract-provider/src/test/java/org/apache/fineract/bulk/NestedBulkTestEvent.java b/fineract-provider/src/test/java/org/apache/fineract/bulk/NestedBulkTestEvent.java deleted file mode 100644 index 41cc009db..000000000 --- a/fineract-provider/src/test/java/org/apache/fineract/bulk/NestedBulkTestEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.bulk; - -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; -import org.springframework.stereotype.Component; - -@Component -@BulkEventSupport -public class NestedBulkTestEvent { - - public void exec() { - throw new IllegalStateException("Not implemented"); - } -} diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/DummyTasklet.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/DummyTasklet.java deleted file mode 100644 index 8b860aab5..000000000 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/DummyTasklet.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.portfolio.loanaccount.service; - -import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport; -import org.apache.fineract.portfolio.loanaccount.domain.ChangedTransactionDetail; -import org.springframework.batch.core.StepContribution; -import org.springframework.batch.core.scope.context.ChunkContext; -import org.springframework.batch.core.step.tasklet.Tasklet; -import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class DummyTasklet implements Tasklet { - - private ChangedTransactionDetail changedTransactionDetail; - - @Autowired - private ReplayedTransactionBusinessEventService replayedTransactionBusinessService; - - @Override - @BulkEventSupport - public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { - replayedTransactionBusinessService.raiseTransactionReplayedEvents(changedTransactionDetail); - return RepeatStatus.FINISHED; - } - - public ChangedTransactionDetail getChangedTransactionDetail() { - return changedTransactionDetail; - } - - public void setChangedTransactionDetail(ChangedTransactionDetail changedTransactionDetail) { - this.changedTransactionDetail = changedTransactionDetail; - } -} diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceIntegrationTest.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceIntegrationTest.java index 090142fe0..824f22c15 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceIntegrationTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceIntegrationTest.java @@ -24,7 +24,6 @@ import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.verify; import java.util.Optional; -import org.apache.fineract.AbstractSpringTest; import org.apache.fineract.infrastructure.event.business.domain.loan.LoanAdjustTransactionBusinessEvent; import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService; import org.apache.fineract.portfolio.loanaccount.domain.ChangedTransactionDetail; @@ -32,85 +31,75 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.batch.core.StepContribution; -import org.springframework.batch.core.scope.context.ChunkContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.mockito.junit.jupiter.MockitoExtension; -class ReplayedTransactionBusinessEventServiceIntegrationTest extends AbstractSpringTest { +@ExtendWith(MockitoExtension.class) +class ReplayedTransactionBusinessEventServiceIntegrationTest { - @MockBean + @Mock private BusinessEventNotifierService businessEventNotifierService; - @MockBean + @Mock private LoanTransactionRepository loanTransactionRepository; - @Autowired - private DummyTasklet dummyTasklet; - - @Mock - private StepContribution stepContribution; - - @Mock - private ChunkContext chunkContext; + private ReplayedTransactionBusinessEventService underTest; @BeforeEach - void setUp() { - dummyTasklet.setChangedTransactionDetail(null); + public void setUp() { + underTest = new ReplayedTransactionBusinessEventServiceImpl(businessEventNotifierService, loanTransactionRepository); } @Test - public void testWhenParamIsNull() throws Exception { + public void testWhenParamIsNull() { // given - dummyTasklet.setChangedTransactionDetail(null); + ChangedTransactionDetail changedTransactionDetail = null; // when - dummyTasklet.execute(stepContribution, chunkContext); + underTest.raiseTransactionReplayedEvents(changedTransactionDetail); // then - verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).startExternalEventRecording(); verify(businessEventNotifierService, Mockito.times(0)) .notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class)); - verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording(); - verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).stopExternalEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording(); } @Test - public void testWhenParamHasNoMapping() throws Exception { + public void testWhenParamHasNoMapping() { // given ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail(); - dummyTasklet.setChangedTransactionDetail(changedTransactionDetail); // when - dummyTasklet.execute(stepContribution, chunkContext); + underTest.raiseTransactionReplayedEvents(changedTransactionDetail); // then - verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).startExternalEventRecording(); verify(businessEventNotifierService, Mockito.times(0)) .notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class)); - verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording(); - verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).stopExternalEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording(); } @Test - public void testWhenParamHasOneNewTransaction() throws Exception { + public void testWhenParamHasOneNewTransaction() { // given LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class); LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class); lenient().when(loanTransactionRepository.findById(1L)).thenReturn(Optional.of(oldLoanTransaction)); ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail(); changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction); - dummyTasklet.setChangedTransactionDetail(changedTransactionDetail); // when - dummyTasklet.execute(stepContribution, chunkContext); + underTest.raiseTransactionReplayedEvents(changedTransactionDetail); // then verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording(); verify(businessEventNotifierService, Mockito.times(1)) .notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class)); verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording(); - verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording(); } @Test - public void testWhenParamHasTwoNewTransaction() throws Exception { + public void testWhenParamHasTwoNewTransaction() { // given LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class); LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class); @@ -119,29 +108,28 @@ class ReplayedTransactionBusinessEventServiceIntegrationTest extends AbstractSpr ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail(); changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction); changedTransactionDetail.getNewTransactionMappings().put(2L, newLoanTransaction); - dummyTasklet.setChangedTransactionDetail(changedTransactionDetail); // when - dummyTasklet.execute(stepContribution, chunkContext); + underTest.raiseTransactionReplayedEvents(changedTransactionDetail); // then verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording(); verify(businessEventNotifierService, Mockito.times(2)) .notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class)); verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording(); - verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording(); + verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording(); } @Test public void testWhenParamHasError() { // given - doThrow(new RuntimeException()).when(businessEventNotifierService).notifyPostBusinessEvent(Mockito.any()); + doThrow(new RuntimeException()).when(businessEventNotifierService) + .notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class)); LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class); LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class); lenient().when(loanTransactionRepository.findById(1L)).thenReturn(Optional.of(oldLoanTransaction)); ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail(); changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction); - dummyTasklet.setChangedTransactionDetail(changedTransactionDetail); // when - assertThrows(RuntimeException.class, () -> dummyTasklet.execute(stepContribution, chunkContext)); + assertThrows(RuntimeException.class, () -> underTest.raiseTransactionReplayedEvents(changedTransactionDetail)); // then verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording(); verify(businessEventNotifierService, Mockito.times(1))