Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fineract-test.messaging.jms.broker-password=${ACTIVEMQ_BROKER_PASSWORD:}
fineract-test.messaging.jms.topic-name=${ACTIVEMQ_TOPIC_NAME:}

fineract-test.event.verification-enabled=${EVENT_VERIFICATION_ENABLED:false}
fineract-test.event.wait-timeout-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:5000}
fineract-test.event.wait-timeout-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:15000}
fineract-test.event.delay-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100}
fineract-test.event.interval-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,6 @@
<include file="parts/0238_transaction_summary_report_update_originator_inline_join.xml" relativeToChangelogFile="true" />
<include file="parts/0239_add_retained_earning_job.xml" relativeToChangelogFile="true"/>
<include file="parts/0240_add_retained_earning_global_configuration.xml" relativeToChangelogFile="true"/>
<include file="parts/0242_fix_group_summary_report_parameters.xml" relativeToChangelogFile="true"/>
<include file="parts/0242_update_m_tellers_unique_key.xml" relativeToChangelogFile="true" />
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?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="add-group-summary-counts-group-id-parameter">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(1) from stretchy_report where id = 96 and report_name = 'GroupSummaryCounts'</sqlCheck>
<sqlCheck expectedResult="1">select count(1) from stretchy_parameter where id = 1019 and parameter_variable = 'groupId'</sqlCheck>
<sqlCheck expectedResult="0">select count(1) from stretchy_report_parameter where report_id = 96 and parameter_id = 1019</sqlCheck>
</preConditions>
<insert tableName="stretchy_report_parameter">
<column name="report_id" valueNumeric="96"/>
<column name="parameter_id" valueNumeric="1019"/>
<column name="report_parameter_name" value="groupId"/>
</insert>
<rollback>
<delete tableName="stretchy_report_parameter">
<where>report_id = 96 and parameter_id = 1019 and report_parameter_name = 'groupId'</where>
</delete>
</rollback>
</changeSet>

<changeSet author="fineract" id="add-group-summary-amounts-group-id-parameter">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(1) from stretchy_report where id = 97 and report_name = 'GroupSummaryAmounts'</sqlCheck>
<sqlCheck expectedResult="1">select count(1) from stretchy_parameter where id = 1019 and parameter_variable = 'groupId'</sqlCheck>
<sqlCheck expectedResult="0">select count(1) from stretchy_report_parameter where report_id = 97 and parameter_id = 1019</sqlCheck>
</preConditions>
<insert tableName="stretchy_report_parameter">
<column name="report_id" valueNumeric="97"/>
<column name="parameter_id" valueNumeric="1019"/>
<column name="report_parameter_name" value="groupId"/>
</insert>
<rollback>
<delete tableName="stretchy_report_parameter">
<where>report_id = 97 and parameter_id = 1019 and report_parameter_name = 'groupId'</where>
</delete>
</rollback>
</changeSet>

<changeSet author="fineract" id="add-group-saving-summary-group-id-parameter">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(1) from stretchy_report where id = 117 and report_name = 'GroupSavingSummary'</sqlCheck>
<sqlCheck expectedResult="1">select count(1) from stretchy_parameter where id = 1019 and parameter_variable = 'groupId'</sqlCheck>
<sqlCheck expectedResult="0">select count(1) from stretchy_report_parameter where report_id = 117 and parameter_id = 1019</sqlCheck>
</preConditions>
<insert tableName="stretchy_report_parameter">
<column name="report_id" valueNumeric="117"/>
<column name="parameter_id" valueNumeric="1019"/>
<column name="report_parameter_name" value="groupId"/>
</insert>
<rollback>
<delete tableName="stretchy_report_parameter">
<where>report_id = 117 and parameter_id = 1019 and report_parameter_name = 'groupId'</where>
</delete>
</rollback>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* 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.integrationtests;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.util.Locale;
import org.apache.fineract.integrationtests.common.GroupHelper;
import org.apache.fineract.integrationtests.common.Utils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class GroupSummaryReportsIntegrationTest extends BaseLoanIntegrationTest {

private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;

@BeforeEach
public void setup() {
Locale.setDefault(Locale.ENGLISH);
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Fineract-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}

@Test
public void shouldRunGroupSummaryReportsWithNumericGroupIdParameter() {
final Integer groupId = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
assertNotNull(groupId);

assertGroupSummaryReportRuns("GroupSummaryCounts", groupId);
assertGroupSummaryReportRuns("GroupSummaryAmounts", groupId);
assertGroupSummaryReportRuns("GroupSavingSummary", groupId);
}

private void assertGroupSummaryReportRuns(final String reportName, final Integer groupId) {
final String response = Utils.performServerGet(this.requestSpec, this.responseSpec, "/fineract-provider/api/v1/runreports/"
+ reportName + "?R_groupId=" + groupId + "&genericResultSet=false&" + Utils.TENANT_IDENTIFIER, null);

assertNotNull(response);
assertFalse(response.toLowerCase(Locale.ROOT).contains("operator does not exist"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.fineract.integrationtests;

import static org.apache.fineract.integrationtests.common.BusinessDateHelper.runAt;
import static org.awaitility.Awaitility.await;

import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder;
Expand All @@ -28,6 +29,7 @@
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.time.Duration;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
Expand Down Expand Up @@ -66,6 +68,7 @@
public class SavingsInterestPostingTest {

private static final Logger LOG = LoggerFactory.getLogger(SavingsInterestPostingTest.class);
private static final int DUPLICATE_PREVENTION_ACCOUNT_COUNT = 50;
private static ResponseSpecification responseSpec;
private static RequestSpecification requestSpec;
private AccountHelper accountHelper;
Expand Down Expand Up @@ -417,7 +420,7 @@ public void testPostInterestForDuplicatePrevention() {

final String startDateString = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
List<Integer> accountIdList = new CopyOnWriteArrayList<>();
ParallelExecutionHelper.runInParallel(IntStream.range(0, 200).boxed().toList(), (i) -> {
ParallelExecutionHelper.runInParallel(IntStream.range(0, DUPLICATE_PREVENTION_ACCOUNT_COUNT).boxed().toList(), (i) -> {
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
final Integer accountId = createTrackedSavingsAccount(clientId, productId, startDateString);

Expand All @@ -426,14 +429,17 @@ public void testPostInterestForDuplicatePrevention() {
savingsAccountHelper.depositToSavingsAccount(accountId, amount, startDateString, CommonConstants.RESPONSE_RESOURCE_ID);
accountIdList.add(accountId);
});
Assertions.assertEquals(200, accountIdList.size(), "ERROR: Expected 200");
Assertions.assertEquals(DUPLICATE_PREVENTION_ACCOUNT_COUNT, accountIdList.size(),
"ERROR: Expected " + DUPLICATE_PREVENTION_ACCOUNT_COUNT);

schedulerJobHelper.executeAndAwaitJob(POST_INTEREST_JOB_NAME);
schedulerJobHelper.executeAndAwaitJob(POST_INTEREST_JOB_NAME);

ParallelExecutionHelper.runInParallel(accountIdList, (accountId) -> {
List<HashMap> txs = getInterestTransactions(accountId);
Assertions.assertEquals(1, txs.size(), "ERROR: Duplicate interest postings exist.");
await().atMost(Duration.ofMinutes(2)).pollInterval(Duration.ofSeconds(2)).untilAsserted(() -> {
ParallelExecutionHelper.runInParallel(accountIdList, (accountId) -> {
List<HashMap> txs = getInterestTransactions(accountId);
Assertions.assertEquals(1, txs.size(), "ERROR: Duplicate interest postings exist for account " + accountId);
});
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.fineract.integrationtests.common;

import java.time.Duration;
import java.util.function.Consumer;
import java.util.function.Function;
import okhttp3.logging.HttpLoggingInterceptor;
Expand All @@ -26,6 +27,8 @@

public final class FineractClientHelper {

private static final Duration READ_TIMEOUT = Duration.ofSeconds(180);

private static final FineractClient DEFAULT_FINERACT_CLIENT = createNewFineractClient(ConfigProperties.Backend.USERNAME,
ConfigProperties.Backend.PASSWORD);

Expand All @@ -43,7 +46,7 @@ public static FineractClient createNewFineractClient(String username, String pas
String url = System.getProperty("fineract.it.url", buildURI());
// insecure(true) should *ONLY* ever be used for https://localhost:8443, NOT in real clients!!
FineractClient.Builder builder = FineractClient.builder().insecure(true).baseURL(url).tenant(ConfigProperties.Backend.TENANT)
.basicAuth(username, password).logging(HttpLoggingInterceptor.Level.NONE);
.basicAuth(username, password).logging(HttpLoggingInterceptor.Level.NONE).readTimeout(READ_TIMEOUT);
customizer.accept(builder);
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
*/
package org.apache.fineract.integrationtests.common;

import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Function;
import org.apache.fineract.client.feign.FineractFeignClient;
import org.apache.fineract.integrationtests.ConfigProperties;

public final class FineractFeignClientHelper {

private static final int READ_TIMEOUT_SECONDS = 180;

private static final FineractFeignClient DEFAULT_FINERACT_FEIGN_CLIENT = createNewFineractFeignClient(ConfigProperties.Backend.USERNAME,
ConfigProperties.Backend.PASSWORD);

Expand All @@ -46,7 +49,7 @@ public static FineractFeignClient createNewFineractFeignClient(String username,
Consumer<FineractFeignClient.Builder> customizer) {
String url = System.getProperty("fineract.it.url", buildURI());
FineractFeignClient.Builder builder = FineractFeignClient.builder().baseUrl(url).credentials(username, password)
.disableSslVerification(true);
.disableSslVerification(true).readTimeout(READ_TIMEOUT_SECONDS, TimeUnit.SECONDS);
customizer.accept(builder);
return builder.build();
}
Expand Down
Loading