Skip to content
Open
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 @@ -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, 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, 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,7 @@ 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, startDate, frequency, interval, repeatsOnDay));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +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,
centerMeetingNewStartDate);
CalendarHelper.updateMeetingCalendarForCenter(centerId, calendarId.toString(), oldMeetingDate, centerMeetingNewStartDate);

ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanId);
// VERIFY RESCHEDULED DATE
Expand Down Expand Up @@ -209,8 +208,7 @@ private Integer createCalendarMeeting(Integer centerId) {
repeatsOnDay = 7;
}

Integer calendarId = CalendarHelper.createMeetingForGroup(this.requestSpec, this.responseSpec, centerId, startDate, frequency,
interval, repeatsOnDay.toString());
Integer calendarId = CalendarHelper.createMeetingForGroup(centerId, startDate, frequency, interval, repeatsOnDay.toString());
LOG.info("calendarId {}", calendarId);
return calendarId;
}
Expand Down Expand Up @@ -308,8 +306,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,
centerMeetingNewStartDate);
CalendarHelper.updateMeetingCalendarForCenter(centerId, calendarId.toString(), oldMeetingDate, centerMeetingNewStartDate);

ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanID);
// VERIFY RESCHEDULED DATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ 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, startDate, frequency, interval, repeatsOnDay));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@
package org.apache.fineract.integrationtests;

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

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 +30,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();
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"));
assertEquals("error.msg.password.validation.policy.id.invalid", exception.getUserMessageGlobalisationCode());
}

}
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);
Integer calendarID = CalendarHelper.createMeetingForGroup(groupID, startDate, frequency, interval, null);
LOG.info("caladerId -------------------- {}", calendarID);
final Integer loanProductID = createLoanProduct();
final Integer loanID = applyForLoanApplication(groupID, loanProductID, calendarID, clientID);
Expand Down
Loading