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 2023/01/17 08:41:57 UTC
[fineract] branch develop updated: [FINERACT-1859] Missing configuration for LoanAccountsStayedLockedBusinessEvent
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
The following commit(s) were added to refs/heads/develop by this push:
new 4a250b7a5 [FINERACT-1859] Missing configuration for LoanAccountsStayedLockedBusinessEvent
4a250b7a5 is described below
commit 4a250b7a56a6611753bf43a134c42d7a57858d97
Author: taskain7 <ta...@gmail.com>
AuthorDate: Mon Jan 16 18:28:35 2023 +0100
[FINERACT-1859] Missing configuration for LoanAccountsStayedLockedBusinessEvent
---
... => LoanAccountsStayedLockedBusinessEvent.java} | 4 +--
.../cob/loan/StayedLockedLoansTasklet.java | 2 +-
.../ExternalEventSourceProviderConfig.java | 2 +-
.../db/changelog/tenant/changelog-tenant.xml | 1 +
...tion_for_stayed_locked_loans_business_event.xml | 31 ++++++++++++++++
...nalEventConfigurationValidationServiceTest.java | 42 +++++++++++-----------
.../common/ExternalEventConfigurationHelper.java | 5 +++
7 files changed, 63 insertions(+), 24 deletions(-)
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountStayedLockedBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountsStayedLockedBusinessEvent.java
similarity index 88%
rename from fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountStayedLockedBusinessEvent.java
rename to fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountsStayedLockedBusinessEvent.java
index e8d097aad..274210414 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountStayedLockedBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountsStayedLockedBusinessEvent.java
@@ -21,12 +21,12 @@ package org.apache.fineract.cob.loan;
import java.util.List;
import org.apache.fineract.infrastructure.event.business.domain.AbstractBusinessEvent;
-public class LoanAccountStayedLockedBusinessEvent extends AbstractBusinessEvent<List<Long>> {
+public class LoanAccountsStayedLockedBusinessEvent extends AbstractBusinessEvent<List<Long>> {
private static final String CATEGORY = "Loan COB";
private static final String TYPE = "LoanAccountsStayedLockedBusinessEvent";
- public LoanAccountStayedLockedBusinessEvent(List<Long> value) {
+ public LoanAccountsStayedLockedBusinessEvent(List<Long> value) {
super(value);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/StayedLockedLoansTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/cob/loan/StayedLockedLoansTasklet.java
index df418d92f..f3ea0a6b9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/StayedLockedLoansTasklet.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/loan/StayedLockedLoansTasklet.java
@@ -41,7 +41,7 @@ public class StayedLockedLoansTasklet implements Tasklet {
List<LoanAccountLock> loanAccountLocks = loanAccountLockRepository.findAll();
if (!loanAccountLocks.isEmpty()) {
List<Long> loanIds = loanAccountLocks.stream().map(LoanAccountLock::getLoanId).toList();
- businessEventNotifierService.notifyPostBusinessEvent(new LoanAccountStayedLockedBusinessEvent(loanIds));
+ businessEventNotifierService.notifyPostBusinessEvent(new LoanAccountsStayedLockedBusinessEvent(loanIds));
}
return RepeatStatus.FINISHED;
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/validation/ExternalEventSourceProviderConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/validation/ExternalEventSourceProviderConfig.java
index b76ac648f..779edb4cd 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/validation/ExternalEventSourceProviderConfig.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/validation/ExternalEventSourceProviderConfig.java
@@ -26,7 +26,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class ExternalEventSourceProviderConfig {
- private static final String EXTERNAL_EVENT_CLASSES_BASE_PACKAGE = "org.apache.fineract.infrastructure.event.business.domain";
+ private static final String EXTERNAL_EVENT_CLASSES_BASE_PACKAGE = "org.apache.fineract";
@Bean
public ExternalEventSourceProvider fineractExternalEventSourceProvider() {
diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
index ed63ba0e3..685cd5e0a 100644
--- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
+++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
@@ -99,4 +99,5 @@
<include file="parts/0077_add_overpaid_date_for_loan.xml" relativeToChangelogFile="true" />
<include file="parts/0078_add_configuration_cob_bulk_event.xml" relativeToChangelogFile="true" />
<include file="parts/0079_add_charge_off_details_to_loan.xml" relativeToChangelogFile="true" />
+ <include file="parts/0080_add_external_event_configuration_for_stayed_locked_loans_business_event.xml" relativeToChangelogFile="true" />
</databaseChangeLog>
diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0080_add_external_event_configuration_for_stayed_locked_loans_business_event.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0080_add_external_event_configuration_for_stayed_locked_loans_business_event.xml
new file mode 100644
index 000000000..17dbc1746
--- /dev/null
+++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0080_add_external_event_configuration_for_stayed_locked_loans_business_event.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
+ <changeSet author="fineract" id="1">
+ <insert tableName="m_external_event_configuration">
+ <column name="type" value="LoanAccountsStayedLockedBusinessEvent"/>
+ <column name="enabled" valueBoolean="false"/>
+ </insert>
+ </changeSet>
+</databaseChangeLog>
diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java
index abf792af6..495d46faa 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java
@@ -93,7 +93,8 @@ public class ExternalEventConfigurationValidationServiceTest {
"SavingsCloseBusinessEvent", "SavingsCreateBusinessEvent", "SavingsDepositBusinessEvent",
"SavingsPostInterestBusinessEvent", "SavingsRejectBusinessEvent", "SavingsWithdrawalBusinessEvent",
"ShareAccountApproveBusinessEvent", "ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
- "LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent");
+ "LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent",
+ "LoanAccountsStayedLockedBusinessEvent", "MockBusinessEvent");
List<FineractPlatformTenant> tenants = Arrays
.asList(new FineractPlatformTenant(1L, "default", "Default Tenant", "Europe/Budapest", null));
@@ -102,7 +103,7 @@ public class ExternalEventConfigurationValidationServiceTest {
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurations);
- List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
+ List<String> sourcePackage = Arrays.asList("org.apache.fineract");
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
// when
underTest.afterPropertiesSet();
@@ -122,7 +123,7 @@ public class ExternalEventConfigurationValidationServiceTest {
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(new ArrayList<>());
- List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
+ List<String> sourcePackage = Arrays.asList("org.apache.fineract");
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
// when
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
@@ -140,21 +141,21 @@ public class ExternalEventConfigurationValidationServiceTest {
public void givenMissingEventConfigurationWhenValidatedThenThrowException() throws Exception {
// given
- List<String> configurationWithMissingCentersCreateBusinessEvent = Arrays.asList("MockBusinessEvent", "ClientActivateBusinessEvent",
- "ClientCreateBusinessEvent", "ClientRejectBusinessEvent", "FixedDepositAccountCreateBusinessEvent",
- "GroupsCreateBusinessEvent", "LoanAcceptTransferBusinessEvent", "LoanAddChargeBusinessEvent",
- "LoanAdjustTransactionBusinessEvent", "LoanApplyOverdueChargeBusinessEvent", "LoanApprovedBusinessEvent",
- "LoanBalanceChangedBusinessEvent", "LoanChargebackTransactionBusinessEvent", "LoanChargePaymentPostBusinessEvent",
- "LoanChargePaymentPreBusinessEvent", "LoanChargeRefundBusinessEvent", "LoanCloseAsRescheduleBusinessEvent",
- "LoanCloseBusinessEvent", "LoanCreatedBusinessEvent", "LoanCreditBalanceRefundPostBusinessEvent",
- "LoanCreditBalanceRefundPreBusinessEvent", "LoanDeleteChargeBusinessEvent", "LoanDisbursalBusinessEvent",
- "LoanDisbursalTransactionBusinessEvent", "LoanForeClosurePostBusinessEvent", "LoanForeClosurePreBusinessEvent",
- "LoanInitiateTransferBusinessEvent", "LoanInterestRecalculationBusinessEvent", "LoanProductCreateBusinessEvent",
- "LoanReassignOfficerBusinessEvent", "LoanRefundPostBusinessEvent", "LoanRefundPreBusinessEvent",
- "LoanRejectedBusinessEvent", "LoanRejectTransferBusinessEvent", "LoanRemoveOfficerBusinessEvent",
- "LoanRepaymentDueBusinessEvent", "LoanRepaymentOverdueBusinessEvent", "LoanRescheduledDueCalendarChangeBusinessEvent",
- "LoanRescheduledDueHolidayBusinessEvent", "LoanScheduleVariationsAddedBusinessEvent",
- "LoanScheduleVariationsDeletedBusinessEvent", "LoanStatusChangedBusinessEvent",
+ List<String> configurationWithMissingCentersCreateBusinessEvent = Arrays.asList("MockBusinessEvent", "MockBusinessEvent",
+ "ClientActivateBusinessEvent", "ClientCreateBusinessEvent", "ClientRejectBusinessEvent",
+ "FixedDepositAccountCreateBusinessEvent", "GroupsCreateBusinessEvent", "LoanAcceptTransferBusinessEvent",
+ "LoanAddChargeBusinessEvent", "LoanAdjustTransactionBusinessEvent", "LoanApplyOverdueChargeBusinessEvent",
+ "LoanApprovedBusinessEvent", "LoanBalanceChangedBusinessEvent", "LoanChargebackTransactionBusinessEvent",
+ "LoanChargePaymentPostBusinessEvent", "LoanChargePaymentPreBusinessEvent", "LoanChargeRefundBusinessEvent",
+ "LoanCloseAsRescheduleBusinessEvent", "LoanCloseBusinessEvent", "LoanCreatedBusinessEvent",
+ "LoanCreditBalanceRefundPostBusinessEvent", "LoanCreditBalanceRefundPreBusinessEvent", "LoanDeleteChargeBusinessEvent",
+ "LoanDisbursalBusinessEvent", "LoanDisbursalTransactionBusinessEvent", "LoanForeClosurePostBusinessEvent",
+ "LoanForeClosurePreBusinessEvent", "LoanInitiateTransferBusinessEvent", "LoanInterestRecalculationBusinessEvent",
+ "LoanProductCreateBusinessEvent", "LoanReassignOfficerBusinessEvent", "LoanRefundPostBusinessEvent",
+ "LoanRefundPreBusinessEvent", "LoanRejectedBusinessEvent", "LoanRejectTransferBusinessEvent",
+ "LoanRemoveOfficerBusinessEvent", "LoanRepaymentDueBusinessEvent", "LoanRepaymentOverdueBusinessEvent",
+ "LoanRescheduledDueCalendarChangeBusinessEvent", "LoanRescheduledDueHolidayBusinessEvent",
+ "LoanScheduleVariationsAddedBusinessEvent", "LoanScheduleVariationsDeletedBusinessEvent", "LoanStatusChangedBusinessEvent",
"LoanTransactionGoodwillCreditPostBusinessEvent", "LoanTransactionGoodwillCreditPreBusinessEvent",
"LoanTransactionMakeRepaymentPostBusinessEvent", "LoanTransactionMakeRepaymentPreBusinessEvent",
"LoanTransactionMerchantIssuedRefundPostBusinessEvent", "LoanTransactionMerchantIssuedRefundPreBusinessEvent",
@@ -168,7 +169,8 @@ public class ExternalEventConfigurationValidationServiceTest {
"SavingsCloseBusinessEvent", "SavingsCreateBusinessEvent", "SavingsDepositBusinessEvent",
"SavingsPostInterestBusinessEvent", "SavingsRejectBusinessEvent", "SavingsWithdrawalBusinessEvent",
"ShareAccountApproveBusinessEvent", "ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
- "LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent");
+ "LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent",
+ "LoanAccountsStayedLockedBusinessEvent");
List<FineractPlatformTenant> tenants = Arrays
.asList(new FineractPlatformTenant(1L, "default", "Default Tenant", "Europe/Budapest", null));
@@ -177,7 +179,7 @@ public class ExternalEventConfigurationValidationServiceTest {
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurationWithMissingCentersCreateBusinessEvent);
- List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
+ List<String> sourcePackage = Arrays.asList("org.apache.fineract");
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
// when
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java
index 572b60867..9ee19cc48 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java
@@ -440,6 +440,11 @@ public class ExternalEventConfigurationHelper {
loanDelinquencyRangeChangeBusinessEvent.put("enabled", false);
defaults.add(loanDelinquencyRangeChangeBusinessEvent);
+ Map<String, Object> loanAccountsStayedLockedBusinessEvent = new HashMap<>();
+ loanAccountsStayedLockedBusinessEvent.put("type", "LoanAccountsStayedLockedBusinessEvent");
+ loanAccountsStayedLockedBusinessEvent.put("enabled", false);
+ defaults.add(loanAccountsStayedLockedBusinessEvent);
+
return defaults;
}