[ 
https://issues.apache.org/jira/browse/FINERACT-820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17020556#comment-17020556
 ] 

Angel Cajas edited comment on FINERACT-820 at 1/21/20 10:17 PM:
----------------------------------------------------------------

Hi, about this issue. I've seen there is a similar test in 
ClientLoanIntegrationTest that does a validation after getting the day of the 
week

 today.get(Calendar.DAY_OF_WEEK) - 1.

The validation is 

if (dayOfWeek.compareTo(0) == 0)

{   dayOfWeek = 7; }

Apparently this is done because Fineract has a CalendarWeekDaysType class that 
has constants for days of the week that go from Monday=1 to Sunday=7. Java 
Calendar class has its values from Sunday=1 to Saturday=7. So even if 
repeatsOnDay is given a valid value, the test would fail if it requires that 
repeatsOnDay to be today.


was (Author: angelboxes):
Hi, about this issue. I've seen there is a similar test in 
ClientLoanIntegrationTest that does a validation after getting the day of the 
week

 today.get(Calendar.DAY_OF_WEEK) - 1.

The validation is 

if (dayOfWeek.compareTo(0) == 0) {
  dayOfWeek = 7;
}

Apparently it is done like that because Fineract has a CalendarWeekDaysType 
class that has constants that go from Monday 1 to Sunday 7, 7. Java Calendar 
goes from Sunday 1 to Saturday 7. So even if repeatsOnDay is given a valid 
value if the test requires that day of the week to be today it would fail.

> LoanReschedulingWithinCenterTest is flaky and always fails on Sundays
> ---------------------------------------------------------------------
>
>                 Key: FINERACT-820
>                 URL: https://issues.apache.org/jira/browse/FINERACT-820
>             Project: Apache Fineract
>          Issue Type: Improvement
>            Reporter: Michael Vorburger
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> https://github.com/apache/fineract/pull/678 for FINERACT-726 just failed due 
> to:
> {noformat}> Task :integrationTest                                             
>                                                                               
>                                           
>                                                                               
>                                                                               
>                                 
> 344 tests completed, 2 failed, 14 skipped{noformat}
> due to:
> 1. org.apache.fineract.integrationtests.LoanReschedulingWithinCenterTest
> {noformat}        at 
> org.apache.fineract.integrationtests.common.Utils.performServerPost(Utils.java:156)
>         at 
> org.apache.fineract.integrationtests.common.CalendarHelper.createMeetingForGroup(CalendarHelper.java:101)
>         at 
> org.apache.fineract.integrationtests.LoanReschedulingWithinCenterTest.createCalendarMeeting(LoanReschedulingWithinCenterTest.java:181)
>         at 
> org.apache.fineract.integrationtests.LoanReschedulingWithinCenterTest.testCenterReschedulingLoansWithInterestRecalculationEnabled(LoanReschedulingWithinCenterTest.java:97)
> -----------------------------------LOGIN-----------------------------------------
> ------------------------ RETRIEVING ALL GLOBAL CONFIGURATIONS 
> -------------------------
> map : {dateFormat=dd MMMM yyyy, name=Office_PLBT, locale=en, openingDate=01 
> July 2007, parentId=1}
> map : {firstname=michael_U2MM2, officeId=1, dateFormat=dd MMMM yyyy, 
> joiningDate=20 September 2011, isLoanOfficer=true, locale=en, 
> lastname=Doe_URN3}
> ------------------------CREATING CENTER-------------------------
> ------------------------ RETRIEVING CENTER AT 180-------------------------
> ---------------------------------CREATING A MEETING CALENDAR FOR THE 
> GROUP------------------------------
> /fineract-provider/api/v1/centers/180/calendars?tenantIdentifier=default
> map : {repeatsOnDay=0, dateFormat=dd MMMM yyyy, repeating=true, interval=2, 
> typeId=1, locale=en, title=groups_CollectionMeetingF3FP, startDate=05 January 
> 2020, frequency=2}
> HTTP/1.1 400 Bad Request
> Server: Apache-Coyote/1.1
> X-Notification-Refresh: true
> Access-Control-Allow-Origin: *
> Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
> Cache-Control: no-cache, no-store, max-age=0, must-revalidate
> Pragma: no-cache
> Expires: 0
> Strict-Transport-Security: max-age=31536000 ; includeSubDomains
> X-XSS-Protection: 1; mode=block
> X-Frame-Options: DENY
> X-Content-Type-Options: nosniff
> Content-Type: application/json
> Transfer-Encoding: chunked
> Date: Sun, 05 Jan 2020 17:57:32 GMT
> Connection: close
> {
>     "developerMessage": "The request was invalid. This 
> typically will happen due to validation errors which are provided.",
>     "httpStatusCode": "400",
>     "defaultUserMessage": "Validation errors exist.",
>     "userMessageGlobalisationCode": 
> "validation.msg.validation.errors.exist",
>     "errors": [
>         {
>             "developerMessage": "The parameter repeatsOnDay 
> must be between 1 and 7.",
>             "defaultUserMessage": "The parameter repeatsOnDay 
> must be between 1 and 7.",
>             "userMessageGlobalisationCode": 
> "validation.msg.calendar.repeatsOnDay.is.not.within.expected.range",
>             "parameterName": "repeatsOnDay",
>             "value": null,
>             "args": [
>                 {
>                     "value": 0
>                 },
>                 {
>                     "value": 1
>                 },
>                 {
>                     "value": 7
>                 }
>             ]
>         }
>     ]
> }{noformat}
> 2. testCenterReschedulingMultiTrancheLoansWithInterestRecalculationEnabled
> If _The parameter repeatsOnDay must be between 1 and 7._ then probably doing 
> {{repeatsOnDay = today.get(Calendar.DAY_OF_WEEK) - 1;}} in 
> https://github.com/apache/fineract/blob/develop/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java
>  isn't great?
> {noformat}{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to