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 @@ -64,7 +64,7 @@ public class DisbursalAndRepaymentScheduleTest {
private Integer loanRescheduleRequestId;
private Integer clientId;
private Integer groupId;
private Integer groupCalendarId;
private Long groupCalendarId;
private Integer loanProductId;
private Integer loanId;
private final String loanPrincipalAmount = "100000.00";
Expand Down Expand Up @@ -157,14 +157,14 @@ public void testRescheduleJLGLoanSynk() {
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);

CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
groupMeetingNewStartDate, "2", "2", "2"); // New
// meeting
// dates
// will be
// the
// tuesday
// after the
CalendarHelper.updateMeetingCalendarForGroup(this.groupId.longValue(), this.groupCalendarId.toString(), groupMeetingNewStartDate,
"2", "2", "2"); // New
// meeting
// dates
// will be
// the
// tuesday
// after the
// coming
// monday

Expand Down Expand Up @@ -284,16 +284,16 @@ public void testChangeGroupMeetingMaturedOnDate() {
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);

CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
groupMeetingNewStartDate, "2", "2", "2"); // New
// meeting
// dates
// will be
// the
// tuesday
// after the
// coming
// monday
CalendarHelper.updateMeetingCalendarForGroup(this.groupId.longValue(), this.groupCalendarId.toString(), groupMeetingNewStartDate,
"2", "2", "2"); // New
// meeting
// dates
// will be
// the
// tuesday
// after the
// coming
// monday

Calendar expectedMaturityCalendar = Calendar.getInstance();
expectedMaturityCalendar.setFirstDayOfWeek(Calendar.MONDAY);
Expand Down Expand Up @@ -340,8 +340,8 @@ private void createGroupEntityWithCalendar(final String frequency, final String

final String startDate = groupActivationDate;

this.setGroupCalendarId(CalendarHelper.createMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, startDate,
frequency, interval, repeatsOnDay));
this.setGroupCalendarId(CalendarHelper
.createMeetingCalendarForGroup(this.groupId.longValue(), startDate, frequency, interval, repeatsOnDay).getResourceId());
}

/**
Expand All @@ -362,7 +362,7 @@ private void createLoanProductEntity() {
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}

public void setGroupCalendarId(Integer groupCalendarId) {
public void setGroupCalendarId(Long groupCalendarId) {
this.groupCalendarId = groupCalendarId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void testCenterReschedulingLoansWithInterestRecalculationEnabled() {
Assertions.assertTrue(center.getStaffId() == staffId);
Assertions.assertTrue(center.isActive() == true);

Integer calendarId = createCalendarMeeting(centerId);
Long calendarId = createCalendarMeeting(centerId);

Integer clientId = createClient(officeId);

Expand Down Expand Up @@ -158,7 +158,7 @@ public void testCenterReschedulingLoansWithInterestRecalculationEnabled() {
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
todaysdate.add(Calendar.DAY_OF_MONTH, 1);
final String centerMeetingNewStartDate = dateFormat.format(todaysdate.getTime());
CalendarHelper.updateMeetingCalendarForCenter(this.requestSpec, this.responseSpec, centerId, calendarId.toString(), oldMeetingDate,
CalendarHelper.updateMeetingCalendarForCenter(centerId.longValue(), calendarId.toString(), oldMeetingDate,
centerMeetingNewStartDate);

ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanId);
Expand Down Expand Up @@ -196,7 +196,7 @@ private Integer createClient(Integer officeId) {
return clientId;
}

private Integer createCalendarMeeting(Integer centerId) {
private Long createCalendarMeeting(Integer centerId) {
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant());
Expand All @@ -209,8 +209,8 @@ private Integer createCalendarMeeting(Integer centerId) {
repeatsOnDay = 7;
}

Integer calendarId = CalendarHelper.createMeetingForGroup(this.requestSpec, this.responseSpec, centerId, startDate, frequency,
interval, repeatsOnDay.toString());
Long calendarId = CalendarHelper
.createMeetingForGroup(centerId.longValue(), startDate, frequency, interval, repeatsOnDay.toString()).getResourceId();
LOG.info("calendarId {}", calendarId);
return calendarId;
}
Expand All @@ -233,7 +233,7 @@ public void testCenterReschedulingMultiTrancheLoansWithInterestRecalculationEnab
Assertions.assertTrue(center.getStaffId() == staffId);
Assertions.assertTrue(center.isActive() == true);

Integer calendarId = createCalendarMeeting(centerId);
Long calendarId = createCalendarMeeting(centerId);

Integer clientId = createClient(officeId);

Expand Down Expand Up @@ -308,7 +308,7 @@ public void testCenterReschedulingMultiTrancheLoansWithInterestRecalculationEnab
String oldMeetingDate = dateFormat.format(todaysdate.getTime());
todaysdate.add(Calendar.DAY_OF_MONTH, 1);
final String centerMeetingNewStartDate = dateFormat.format(todaysdate.getTime());
CalendarHelper.updateMeetingCalendarForCenter(this.requestSpec, this.responseSpec, centerId, calendarId.toString(), oldMeetingDate,
CalendarHelper.updateMeetingCalendarForCenter(centerId.longValue(), calendarId.toString(), oldMeetingDate,
centerMeetingNewStartDate);

ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanID);
Expand Down Expand Up @@ -378,7 +378,7 @@ private Integer createLoanProductWithInterestRecalculation(final String repaymen
}

@SuppressWarnings("rawtypes")
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, Integer groupId, Integer calendarId,
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, Integer groupId, Long calendarId,
final Integer loanProductID, final String disbursementDate, final String restStartDate, final String repaymentStrategy,
final List<HashMap> charges, List<HashMap> tranches, List<HashMap> collaterals) {
final String graceOnInterestPayment = null;
Expand All @@ -390,7 +390,7 @@ private Integer applyForLoanApplicationForInterestRecalculation(final Integer cl
}

@SuppressWarnings({ "rawtypes", "unused" })
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, Integer groupId, Integer calendarId,
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, Integer groupId, Long calendarId,
final Integer loanProductID, final String disbursementDate, final String restStartDate, final String compoundingStartDate,
final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
final String graceOnPrincipalPayment, List<HashMap> tranches, List<HashMap> collaterals) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
private LoanTransactionHelper loanTransactionHelper;
private Integer clientId;
private Integer groupId;
private Integer groupCalendarId;
private Long groupCalendarId;
private Integer loanProductId;
private Integer loanId;
private final String loanPrincipalAmount = "100000.00";
Expand Down Expand Up @@ -219,8 +219,8 @@ private void createGroupEntityWithCalendar() {
final String interval = "1"; // Every one week
final String repeatsOnDay = "1"; // 1:Monday

this.setGroupCalendarId(CalendarHelper.createMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, startDate,
frequency, interval, repeatsOnDay));
this.setGroupCalendarId(CalendarHelper
.createMeetingCalendarForGroup(this.groupId.longValue(), startDate, frequency, interval, repeatsOnDay).getResourceId());
}

/**
Expand All @@ -242,11 +242,11 @@ private void createLoanProductEntity(final String minimumDaysBetweenDisbursalAnd
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}

public Integer getGroupCalendarId() {
public Long getGroupCalendarId() {
return groupCalendarId;
}

public void setGroupCalendarId(Integer groupCalendarId) {
public void setGroupCalendarId(Long groupCalendarId) {
this.groupCalendarId = groupCalendarId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@
package org.apache.fineract.integrationtests;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

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.HashMap;
import java.util.List;
import org.apache.fineract.integrationtests.common.CommonConstants;
import org.apache.fineract.client.feign.util.CallFailedRuntimeException;
import org.apache.fineract.integrationtests.common.PasswordPreferencesHelper;
import org.apache.fineract.integrationtests.common.Utils;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -36,51 +31,35 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({ "rawtypes", "unchecked" })
public class PasswordPreferencesIntegrationTest {

private static final Logger LOG = LoggerFactory.getLogger(PasswordPreferencesIntegrationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private ResponseSpecification generalResponseSpec;
private int originalPasswordPolicyId;

@BeforeEach
public void setUp() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.generalResponseSpec = new ResponseSpecBuilder().build();
originalPasswordPolicyId = PasswordPreferencesHelper.getActivePasswordPreference(requestSpec, responseSpec);
originalPasswordPolicyId = PasswordPreferencesHelper.getActivePasswordPreference().getId().intValue();
}

@AfterEach
void tearDown() {
PasswordPreferencesHelper.updatePasswordPreferences(requestSpec, responseSpec, Integer.toString(originalPasswordPolicyId));
PasswordPreferencesHelper.updatePasswordPreferences(Integer.toString(originalPasswordPolicyId));
}

@Test
public void updatePasswordPreferences() {
String validationPolicyId = "2";
PasswordPreferencesHelper.updatePasswordPreferences(requestSpec, responseSpec, validationPolicyId);
this.validateIfThePasswordIsUpdated(validationPolicyId);
}

private void validateIfThePasswordIsUpdated(String validationPolicyId) {
Integer id = PasswordPreferencesHelper.getActivePasswordPreference(requestSpec, responseSpec);
PasswordPreferencesHelper.updatePasswordPreferences(validationPolicyId);
Integer id = PasswordPreferencesHelper.getActivePasswordPreference().getId().intValue();
Comment thread
elnafateh marked this conversation as resolved.
assertEquals(validationPolicyId, id.toString());
LOG.info("---------------------------------PASSWORD PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");

}

@Test
public void updateWithInvalidPolicyId() {
String invalidValidationPolicyId = "2000";
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec,
invalidValidationPolicyId, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.password.validation.policy.id.invalid", error.get(0).get("userMessageGlobalisationCode"),
"Password Validation Policy with identifier 2000 does not exist");
final CallFailedRuntimeException exception = assertThrows(CallFailedRuntimeException.class,
() -> PasswordPreferencesHelper.updatePasswordPreferences("2000"));
assertTrue(exception.getDeveloperMessage().contains("Password Validation Policy with identifier 2000 does not exist"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void checkRepaymentSkipOnFirstDayOfMonth() {
final String startDate = "15 September 2011";
final String frequency = "3"; // Monthly
final String interval = "1"; // Every One Moth
Integer calendarID = CalendarHelper.createMeetingForGroup(requestSpec, responseSpec, groupID, startDate, frequency, interval, null);
Long calendarID = CalendarHelper.createMeetingForGroup(groupID.longValue(), startDate, frequency, interval, null).getResourceId();
LOG.info("caladerId -------------------- {}", calendarID);
final Integer loanProductID = createLoanProduct();
final Integer loanID = applyForLoanApplication(groupID, loanProductID, calendarID, clientID);
Expand All @@ -122,7 +122,7 @@ private Integer createLoanProduct() {
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}

private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID, Integer calendarID, Integer clientID) {
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID, Long calendarID, Integer clientID) {
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
List<HashMap> collaterals = new ArrayList<>();
final Integer collateralId = CollateralManagementHelper.createCollateralProduct(this.requestSpec, this.responseSpec);
Expand Down
Loading