fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fineract] ptuomola commented on a change in pull request #817: Step 1 of improving SchedulerJobHelper to be more reliable and prevent flaky tests (FINERACT-922)
Date Fri, 22 May 2020 03:46:10 GMT

ptuomola commented on a change in pull request #817:
URL: https://github.com/apache/fineract/pull/817#discussion_r429027848



##########
File path: fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java
##########
@@ -51,21 +60,28 @@ public SchedulerJobHelper(final RequestSpecification requestSpec, final
Response
         this.response202Spec = responseSpec;
     }
 
-    private List getAllSchedulerJobs() {
+    private List<Map<String, Object>> getAllSchedulerJobs() {
         final String GET_ALL_SCHEDULER_JOBS_URL = "/fineract-provider/api/v1/jobs?" + Utils.TENANT_IDENTIFIER;
         System.out.println("------------------------ RETRIEVING ALL SCHEDULER JOBS -------------------------");
-        final ArrayList response = Utils.performServerGet(requestSpec, response200Spec, GET_ALL_SCHEDULER_JOBS_URL,
"");
+        List<Map<String, Object>> response = Utils.performServerGet(requestSpec,
response200Spec, GET_ALL_SCHEDULER_JOBS_URL, "");
+        assertNotNull(response);
         return response;
     }
 
+    private <T> List<T> getAllSchedulerJobDetails(Function<Map<String,
Object>, T> mapper) {
+        return getAllSchedulerJobs().stream().map(mapper).collect(Collectors.toList());
+    }
+
     public List<Integer> getAllSchedulerJobIds() {
-        ToIntFunction<Map> mapper = map -> (Integer) map.get("jobId");
-        return getAllSchedulerJobs().stream().mapToInt(mapper).boxed().collect(Collectors.toList());
+        return getAllSchedulerJobDetails(map -> (Integer) map.get("jobId"));
+    }
+
+    public List<String> getAllSchedulerJobNames() {
+        return getAllSchedulerJobDetails(map -> (String) map.get("displayName"));
     }
 
     public Map<String, Object> getSchedulerJobById(int jobId) {
         final String GET_SCHEDULER_JOB_BY_ID_URL = "/fineract-provider/api/v1/jobs/" + jobId
+ "?" + Utils.TENANT_IDENTIFIER;
-        System.out.println("------------------------ RETRIEVING SCHEDULER JOB BY ID -------------------------");

Review comment:
       Yep - OK to resolve. 




----------------------------------------------------------------
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.

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



Mime
View raw message