Date to LocalDate (scheduler excluded due to quartz)
This commit is contained in:
committed by
Arnold Gálovics
parent
f7e21f8db1
commit
1db8ef46fc
+2
-5
@@ -39,12 +39,10 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
@@ -1118,9 +1116,8 @@ public class AccountingScenarioIntegrationTest {
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
}
|
||||
|
||||
private LocalDate getDateAsLocalDate(String dateAsString) throws ParseException {
|
||||
final Date dateParsed = DateUtils.parseDate(dateAsString, "dd MMMM yyyy", null);
|
||||
return DateUtils.convertToLocalDate(dateParsed, this.systemTimeZone.toZoneId());
|
||||
private LocalDate getDateAsLocalDate(String dateAsString) {
|
||||
return LocalDate.parse(dateAsString, Utils.dateFormatter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-5
@@ -44,10 +44,10 @@ import org.junit.jupiter.api.Test;
|
||||
@Order(1)
|
||||
public class SchedulerJobsTest {
|
||||
|
||||
private final Map<Integer, Boolean> originalJobStatus = new HashMap<>();
|
||||
private RequestSpecification requestSpec;
|
||||
private SchedulerJobHelper schedulerJobHelper;
|
||||
private Boolean originalSchedulerStatus;
|
||||
private final Map<Integer, Boolean> originalJobStatus = new HashMap<>();
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
@@ -138,10 +138,13 @@ public class SchedulerJobsTest {
|
||||
@Test
|
||||
public void testTriggeringManualExecutionOfAllSchedulerJobs() {
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
GlobalConfigurationHelper.updateIsBusinessDateEnabled(requestSpec, responseSpec, Boolean.TRUE);
|
||||
for (String jobName : schedulerJobHelper.getAllSchedulerJobNames()) {
|
||||
schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||
try {
|
||||
GlobalConfigurationHelper.updateIsBusinessDateEnabled(requestSpec, responseSpec, Boolean.TRUE);
|
||||
for (String jobName : schedulerJobHelper.getAllSchedulerJobNames()) {
|
||||
schedulerJobHelper.executeAndAwaitJob(jobName);
|
||||
}
|
||||
} finally {
|
||||
GlobalConfigurationHelper.updateIsBusinessDateEnabled(requestSpec, responseSpec, Boolean.FALSE);
|
||||
}
|
||||
GlobalConfigurationHelper.updateIsBusinessDateEnabled(requestSpec, responseSpec, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-12
@@ -26,14 +26,11 @@ import io.restassured.path.json.JsonPath;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||
import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
|
||||
@@ -256,14 +253,10 @@ public class ProvisioningIntegrationTest {
|
||||
boolean provisioningetryAlreadyCreated = false;
|
||||
if (pageItems != null) {
|
||||
for (Map item : pageItems) {
|
||||
String date = (String) item.get("createdDate");
|
||||
DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy");
|
||||
Date date1 = formatter.parse(date);
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
String formattedString = simple
|
||||
.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(Utils.getZoneIdOfTenant()).toInstant()));
|
||||
Date currentDate = simple.parse(formattedString);
|
||||
if (date1.getTime() == currentDate.getTime()) {
|
||||
List<Integer> date = (ArrayList) item.get("createdDate");
|
||||
LocalDate localDate = LocalDate.of(date.get(0), date.get(1), date.get(2));
|
||||
|
||||
if (localDate.equals(Utils.getLocalDateOfTenant())) {
|
||||
provisioningetryAlreadyCreated = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user