You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/11/29 16:17:59 UTC

[GitHub] [fineract] adamsaghy commented on a diff in pull request #2778: [FINERACT-1678] Fix Inline COB execution

adamsaghy commented on code in PR #2778:
URL: https://github.com/apache/fineract/pull/2778#discussion_r1034968902


##########
fineract-provider/src/test/java/org/apache/fineract/cob/common/InitialisationTaskletStepDefinitions.java:
##########
@@ -48,11 +59,22 @@ public InitialisationTaskletStepDefinitions() {
             } else {
                 lenient().when(this.userRepository.fetchSystemUser()).thenReturn(appUser);
             }
-
+            HashMap<BusinessDateType, LocalDate> businessDates = new HashMap<>();
+            LocalDate businessDate = LocalDate.now(ZoneId.systemDefault());
+            LocalDate cobBusinessDate = businessDate.minusDays(1);
+            businessDates.put(BusinessDateType.BUSINESS_DATE, businessDate);
+            businessDates.put(BusinessDateType.COB_DATE, cobBusinessDate);
+            ThreadLocalContextUtil.setBusinessDates(businessDates);
+            JobExecution jobExecution = new JobExecution(1L);
+            jobExecution.getExecutionContext().put(LoanCOBConstant.BUSINESS_DATE_PARAMETER_NAME,
+                    cobBusinessDate.format(DateTimeFormatter.ISO_DATE));
+            StepExecution stepExecution = new StepExecution("step", jobExecution);
+            StepContext stepContext = new StepContext(stepExecution);
+            chunkContext = new ChunkContext(stepContext);
         });
 
         When("InitialisationTasklet.execute method executed", () -> {
-            resultItem = this.initialisationTasklet.execute(null, null);
+            resultItem = this.initialisationTasklet.execute(null, chunkContext);

Review Comment:
   I dont see any assertion whether the proper dates were provided and set into the ThreadLocalContextUtil...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org