FINERACT-1971: Fixing AggregateId of LoanOwnershipTransferBusinessEvent
This commit is contained in:
committed by
Peter Bagrij
parent
c36905e7b7
commit
0641fc6b99
+1
-1
@@ -40,6 +40,6 @@ public abstract class InvestorBusinessEvent extends AbstractBusinessEvent<Extern
|
||||
|
||||
@Override
|
||||
public Long getAggregateRootId() {
|
||||
return get().getId();
|
||||
return loan.getId();
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -23,11 +23,14 @@ import com.google.gson.Gson;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Builder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.client.util.JSON;
|
||||
import org.apache.fineract.infrastructure.event.external.service.validation.ExternalEventDTO;
|
||||
import org.apache.fineract.integrationtests.common.ExternalEventConfigurationHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
@Slf4j
|
||||
public final class ExternalEventHelper {
|
||||
@@ -89,4 +92,13 @@ public final class ExternalEventHelper {
|
||||
Utils.performServerDelete(requestSpec, responseSpec, url, null);
|
||||
}
|
||||
|
||||
public static void changeEventState(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, String eventName,
|
||||
boolean status) {
|
||||
final Map<String, Boolean> updatedConfigurations = ExternalEventConfigurationHelper.updateExternalEventConfigurations(requestSpec,
|
||||
responseSpec, "{\"externalEventConfigurations\":{\"" + eventName + "\":" + status + "}}\n");
|
||||
Assertions.assertEquals(updatedConfigurations.size(), 1);
|
||||
Assertions.assertTrue(updatedConfigurations.containsKey(eventName));
|
||||
Assertions.assertEquals(status, updatedConfigurations.get(eventName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+18
-1
@@ -62,6 +62,7 @@ import org.apache.fineract.client.models.PostInitiateTransferRequest;
|
||||
import org.apache.fineract.client.models.PostInitiateTransferResponse;
|
||||
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest;
|
||||
import org.apache.fineract.client.util.CallFailedRuntimeException;
|
||||
import org.apache.fineract.infrastructure.event.external.service.validation.ExternalEventDTO;
|
||||
import org.apache.fineract.integrationtests.common.BusinessDateHelper;
|
||||
import org.apache.fineract.integrationtests.common.BusinessStepHelper;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
@@ -74,11 +75,14 @@ import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
||||
import org.apache.fineract.integrationtests.common.externalevents.ExternalEventHelper;
|
||||
import org.apache.fineract.integrationtests.common.externalevents.ExternalEventsExtension;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -86,7 +90,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@ExtendWith(LoanTestLifecycleExtension.class)
|
||||
@ExtendWith({ LoanTestLifecycleExtension.class, ExternalEventsExtension.class })
|
||||
public class InitiateExternalAssetOwnerTransferTest {
|
||||
|
||||
private static ResponseSpecification RESPONSE_SPEC;
|
||||
@@ -146,6 +150,10 @@ public class InitiateExternalAssetOwnerTransferTest {
|
||||
GlobalConfigurationHelper.manageConfigurations(REQUEST_SPEC, RESPONSE_SPEC,
|
||||
GlobalConfigurationHelper.ENABLE_AUTOGENERATED_EXTERNAL_ID, true);
|
||||
setInitialBusinessDate("2020-03-02");
|
||||
|
||||
ExternalEventHelper.deleteAllExternalEvents(REQUEST_SPEC, new ResponseSpecBuilder().expectStatusCode(Matchers.is(204)).build());
|
||||
ExternalEventHelper.changeEventState(REQUEST_SPEC, RESPONSE_SPEC, "LoanOwnershipTransferBusinessEvent", true);
|
||||
|
||||
Integer clientID = createClient();
|
||||
Integer loanID = createLoanForClient(clientID);
|
||||
addPenaltyForLoan(loanID, "10");
|
||||
@@ -208,6 +216,15 @@ public class InitiateExternalAssetOwnerTransferTest {
|
||||
"9999-12-31", true, new BigDecimal("15767.420000"), new BigDecimal("15000.000000"),
|
||||
new BigDecimal("757.420000"), new BigDecimal("10.000000"), new BigDecimal("0.000000"),
|
||||
new BigDecimal("0.000000")));
|
||||
|
||||
List<ExternalEventDTO> allExternalEvents = ExternalEventHelper.getAllExternalEvents(REQUEST_SPEC, RESPONSE_SPEC);
|
||||
Assertions.assertEquals(1, allExternalEvents.size());
|
||||
Assertions.assertEquals("LoanOwnershipTransferBusinessEvent", allExternalEvents.get(0).getType());
|
||||
Assertions.assertEquals(Long.valueOf(loanID), allExternalEvents.get(0).getAggregateRootId());
|
||||
|
||||
ExternalEventHelper.deleteAllExternalEvents(REQUEST_SPEC, new ResponseSpecBuilder().expectStatusCode(Matchers.is(204)).build());
|
||||
ExternalEventHelper.changeEventState(REQUEST_SPEC, RESPONSE_SPEC, "LoanOwnershipTransferBusinessEvent", true);
|
||||
|
||||
getAndValidateThereIsActiveMapping(loanID);
|
||||
retrieveResponse = EXTERNAL_ASSET_OWNER_HELPER.retrieveTransfersByLoanId(loanID.longValue());
|
||||
LocalDate expectedDate = LocalDate.of(2020, 3, 2);
|
||||
|
||||
Reference in New Issue
Block a user