FINERACT-1112 Replace ZoneId.systemDefault() with tenant's timezone
This commit is contained in:
committed by
Petri Tuomola
parent
7b34e83843
commit
814455769b
+6
-6
@@ -31,13 +31,13 @@ import java.text.DecimalFormatSymbols;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
@@ -787,13 +787,13 @@ public class AccountingScenarioIntegrationTest {
|
||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
// MAKE 1
|
||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||
LocalDate fromDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate fromDateLocal = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
fromDateLocal = fromDateLocal.withYear((int) fromDateList.get(0));
|
||||
fromDateLocal = fromDateLocal.withMonth((int) fromDateList.get(1));
|
||||
fromDateLocal = fromDateLocal.withDayOfMonth((int) fromDateList.get(2));
|
||||
|
||||
List dueDateList = (List) loanSchedule.get(1).get("dueDate");
|
||||
LocalDate dueDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate dueDateLocal = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
dueDateLocal = dueDateLocal.withYear((int) dueDateList.get(0));
|
||||
dueDateLocal = dueDateLocal.withMonth((int) dueDateList.get(1));
|
||||
dueDateLocal = dueDateLocal.withDayOfMonth((int) dueDateList.get(2));
|
||||
@@ -891,13 +891,13 @@ public class AccountingScenarioIntegrationTest {
|
||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
// MAKE 1
|
||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||
LocalDate fromDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate fromDateLocal = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
fromDateLocal = fromDateLocal.withYear((int) fromDateList.get(0));
|
||||
fromDateLocal = fromDateLocal.withMonth((int) fromDateList.get(1));
|
||||
fromDateLocal = fromDateLocal.withDayOfMonth((int) fromDateList.get(2));
|
||||
|
||||
List dueDateList = (List) loanSchedule.get(1).get("dueDate");
|
||||
LocalDate dueDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate dueDateLocal = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
dueDateLocal = dueDateLocal.withYear((int) dueDateList.get(0));
|
||||
dueDateLocal = dueDateLocal.withMonth((int) dueDateList.get(1));
|
||||
dueDateLocal = dueDateLocal.withDayOfMonth((int) dueDateList.get(2));
|
||||
@@ -1042,7 +1042,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
private LocalDate getDateAsLocalDate(String dateAsString) throws ParseException {
|
||||
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
LocalDate date = LocalDate.ofInstant(df.parse(dateAsString).toInstant(), ZoneId.systemDefault());
|
||||
LocalDate date = LocalDate.ofInstant(df.parse(dateAsString).toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
+7
-4
@@ -32,7 +32,6 @@ import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
@@ -40,6 +39,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
@@ -4489,7 +4489,8 @@ public class ClientLoanIntegrationTest {
|
||||
|
||||
// FINERACT-885: As loan may not have started exactly four months ago,
|
||||
// make final payment today and not four months from start (as that may be in the future)
|
||||
fourMonthsfromNowCalendar.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
fourMonthsfromNowCalendar
|
||||
.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
final String now = Utils.convertDateToURLFormat(fourMonthsfromNowCalendar);
|
||||
|
||||
this.loanTransactionHelper.makeRefundByCash(now, Float.valueOf("20"), loanID);
|
||||
@@ -4658,7 +4659,8 @@ public class ClientLoanIntegrationTest {
|
||||
|
||||
// FINERACT-885: As loan may not have started exactly four months ago,
|
||||
// make final payment today and not four months from start (as that may be in the future)
|
||||
fourMonthsfromNowCalendar.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
fourMonthsfromNowCalendar
|
||||
.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
final String now = Utils.convertDateToURLFormat(fourMonthsfromNowCalendar);
|
||||
|
||||
this.loanTransactionHelper.makeRefundByCash(now, Float.valueOf("20"), loanID);
|
||||
@@ -4849,7 +4851,8 @@ public class ClientLoanIntegrationTest {
|
||||
|
||||
// FINERACT-885: As loan may not have started exactly four months ago,
|
||||
// make final payment today and not four months from start (as that may be in the future)
|
||||
fourMonthsfromNowCalendar.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
fourMonthsfromNowCalendar
|
||||
.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
final String now = Utils.convertDateToURLFormat(fourMonthsfromNowCalendar);
|
||||
|
||||
final String FROM_LOAN_ACCOUNT_TYPE = "1";
|
||||
|
||||
+5
-5
@@ -31,7 +31,6 @@ import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -40,6 +39,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
@@ -1788,7 +1788,7 @@ public class ClientSavingsIntegrationTest {
|
||||
savingsList.add(savingsId);
|
||||
|
||||
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy");
|
||||
LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate transactionDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String transactionDateValue = formatter.format(transactionDate);
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(i), DEPOSIT_AMOUNT,
|
||||
@@ -1821,7 +1821,7 @@ public class ClientSavingsIntegrationTest {
|
||||
balance -= chargeAmt;
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance");
|
||||
|
||||
String transactionDateValue = formatter.format(LocalDate.now(ZoneId.systemDefault()));
|
||||
String transactionDateValue = formatter.format(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(1), DEPOSIT_AMOUNT,
|
||||
transactionDateValue, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(1));
|
||||
@@ -1840,7 +1840,7 @@ public class ClientSavingsIntegrationTest {
|
||||
balance -= chargeAmt;
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance");
|
||||
|
||||
transactionDateValue = formatter.format(LocalDate.now(ZoneId.systemDefault()));
|
||||
transactionDateValue = formatter.format(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(2), DEPOSIT_AMOUNT,
|
||||
transactionDateValue, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(2));
|
||||
@@ -2030,7 +2030,7 @@ public class ClientSavingsIntegrationTest {
|
||||
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer releaseTransactionId = this.savingsAccountHelper.releaseAmount(savingsId, holdTransactionId);
|
||||
Date today = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date today = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
String todayDate = today.toString();
|
||||
SimpleDateFormat dt1 = new SimpleDateFormat("dd MMM yyyy");
|
||||
todayDate = dt1.format(today).toString();
|
||||
|
||||
+7
-5
@@ -27,11 +27,11 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
@@ -124,7 +124,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date todaysDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date todaysDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final String undoRejectDate = dateFormat.format(todaysDate);
|
||||
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
|
||||
@@ -156,7 +156,8 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
status = this.clientHelper.rejectClient(clientId);
|
||||
ClientStatusChecker.verifyClientRejected(status);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date tomorrowsDate = Date.from(Utils.getLocalDateOfTenant().plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date tomorrowsDate = Date
|
||||
.from(Utils.getLocalDateOfTenant().plusDays(1).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final String undoRejectDate = dateFormat.format(tomorrowsDate);
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
||||
@@ -232,7 +233,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date todaysDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date todaysDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final String undoWithdrawDate = dateFormat.format(todaysDate);
|
||||
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
@@ -264,7 +265,8 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
status = this.clientHelper.withdrawClient(clientId);
|
||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date tomorrowsDate = Date.from(Utils.getLocalDateOfTenant().plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date tomorrowsDate = Date
|
||||
.from(Utils.getLocalDateOfTenant().plusDays(1).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final String undoWithdrawDate = dateFormat.format(tomorrowsDate);
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||
|
||||
+5
-5
@@ -29,7 +29,6 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
@@ -39,6 +38,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
@@ -1566,10 +1566,10 @@ public class FixedDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(startDate.toLocalDate(), endDate.toLocalDate()));
|
||||
|
||||
@@ -1680,10 +1680,10 @@ public class FixedDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(startDate.toLocalDate(), endDate.toLocalDate()));
|
||||
|
||||
|
||||
+2
-2
@@ -29,7 +29,6 @@ import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -37,6 +36,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||
@@ -762,7 +762,7 @@ public class GroupSavingsIntegrationTest {
|
||||
assertEquals(expectedNextDueDate, nextDueDate);
|
||||
|
||||
this.savingsAccountHelper.closeSavingsAccountAndGetBackRequiredField(savingsId, "true", null,
|
||||
sdf.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())));
|
||||
sdf.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())));
|
||||
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -27,7 +27,6 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
@@ -37,6 +36,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
@@ -1920,10 +1920,10 @@ public class RecurringDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
ZonedDateTime start = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime start = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
ZonedDateTime end = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime end = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(start.toLocalDate(), end.toLocalDate()));
|
||||
|
||||
@@ -2061,10 +2061,10 @@ public class RecurringDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
ZonedDateTime start = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime start = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
ZonedDateTime end = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
ZonedDateTime end = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(start.toLocalDate(), end.toLocalDate()));
|
||||
|
||||
|
||||
+3
-2
@@ -19,10 +19,10 @@
|
||||
package org.apache.fineract.integrationtests.common;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -155,7 +155,8 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
||||
} else {
|
||||
map.put("active", "false");
|
||||
if (submittedDate == null) {
|
||||
map.put("submittedOnDate", Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
map.put("submittedOnDate",
|
||||
Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
} else {
|
||||
map.put("submittedOnDate", submittedDate);
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,12 +27,12 @@ import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||
@@ -237,7 +237,7 @@ public class ProvisioningIntegrationTest {
|
||||
Date date1 = formatter.parse(date);
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
String formattedString = simple
|
||||
.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
Date currentDate = simple.parse(formattedString);
|
||||
if (date1.getTime() == currentDate.getTime()) {
|
||||
provisioningetryAlreadyCreated = true;
|
||||
|
||||
+2
-1
@@ -40,6 +40,7 @@ import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -231,7 +232,7 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static LocalDate getLocalDateOfTenant() {
|
||||
LocalDate today = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate today = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
final ZoneId zone = ZoneId.of(TENANT_TIME_ZONE);
|
||||
if (zone != null) {
|
||||
today = LocalDate.now(zone);
|
||||
|
||||
+5
-3
@@ -26,10 +26,10 @@ import io.restassured.path.json.JsonPath;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.report.ReportData;
|
||||
import org.slf4j.Logger;
|
||||
@@ -109,7 +109,8 @@ public class CampaignsHelper {
|
||||
map.put("providerId", 1);
|
||||
map.put("triggerType", triggerType);
|
||||
if (2 == triggerType) {
|
||||
map.put("recurrenceStartDate", LocalDateTime.now(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
map.put("recurrenceStartDate",
|
||||
LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
map.put("frequency", 1);
|
||||
map.put("interval", "1");
|
||||
}
|
||||
@@ -136,7 +137,8 @@ public class CampaignsHelper {
|
||||
map.put("providerId", 1);
|
||||
map.put("triggerType", triggerType);
|
||||
if (2 == triggerType) {
|
||||
map.put("recurrenceStartDate", LocalDateTime.now(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
map.put("recurrenceStartDate",
|
||||
LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
}
|
||||
map.put("campaignName", Utils.randomNameGenerator("Campaign_Name_", 5));
|
||||
map.put("campaignType", 1);
|
||||
|
||||
+7
-4
@@ -21,12 +21,12 @@ package org.apache.fineract.integrationtests.common.provisioning;
|
||||
import com.google.gson.Gson;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||
|
||||
@@ -42,7 +42,8 @@ public final class ProvisioningHelper {
|
||||
map.put("loanProducts", addLoanProducts(loanProducts));
|
||||
map.put("definitions", addProvisioningCategories(categories, liability, expense));
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
String formattedString = simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
String formattedString = simple
|
||||
.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
Random rand = new Random();
|
||||
String criteriaName = "General Provisioning Criteria" + formattedString + rand.nextLong();
|
||||
map.put("criteriaName", criteriaName);
|
||||
@@ -56,7 +57,8 @@ public final class ProvisioningHelper {
|
||||
map.put("locale", "en");
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
map.put("date", simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())));
|
||||
map.put("date",
|
||||
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())));
|
||||
String provisioningEntryCreateJson = new Gson().toJson(map);
|
||||
return provisioningEntryCreateJson;
|
||||
}
|
||||
@@ -67,7 +69,8 @@ public final class ProvisioningHelper {
|
||||
map.put("locale", "en");
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
map.put("date", simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())));
|
||||
map.put("date",
|
||||
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())));
|
||||
String provisioningEntryCreateJson = new Gson().toJson(map);
|
||||
return provisioningEntryCreateJson;
|
||||
}
|
||||
|
||||
+9
-5
@@ -26,13 +26,13 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
||||
@@ -202,7 +202,8 @@ public class ShareAccountIntegrationTests {
|
||||
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
|
||||
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
|
||||
Assertions.assertEquals(
|
||||
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())),
|
||||
simple.format(
|
||||
Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())),
|
||||
simple.format(date));
|
||||
}
|
||||
}
|
||||
@@ -252,7 +253,8 @@ public class ShareAccountIntegrationTests {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2));
|
||||
Date rejectedDate = cal.getTime();
|
||||
Assertions.assertEquals(simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())),
|
||||
Assertions.assertEquals(
|
||||
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())),
|
||||
simple.format(rejectedDate));
|
||||
|
||||
List<Map<String, Object>> transactions = (List<Map<String, Object>>) shareAccountData.get("purchasedShares");
|
||||
@@ -276,7 +278,8 @@ public class ShareAccountIntegrationTests {
|
||||
} else if (transactionType.equals("charge.payment")) {
|
||||
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
|
||||
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
|
||||
Date transactionDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date transactionDate = Date
|
||||
.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
Assertions.assertEquals(simple.format(transactionDate), simple.format(date));
|
||||
}
|
||||
}
|
||||
@@ -363,7 +366,8 @@ public class ShareAccountIntegrationTests {
|
||||
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
|
||||
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
|
||||
Assertions.assertEquals(
|
||||
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())),
|
||||
simple.format(
|
||||
Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())),
|
||||
simple.format(date));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user