@Test public void testComplaintStatusMappingService() throws Exception { String status = "REGISTERED"; List<ComplaintStatus> complaintStatuses = Collections.singletonList( new ComplaintStatus(1L, "REGISTERED","default","00001") ); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(status, Arrays.asList(1L, 2L),"default"); when(complaintStatusService.getNextStatuses(complaintStatusSearchCriteria)).thenReturn(complaintStatuses); mockMvc.perform( post("/v1/nextstatuses/_search") .param("currentStatusCode", status) .contentType(MediaType.APPLICATION_JSON) .content(resources.getFileContents("complaintStatusRequest.json")) ) .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(resources.getFileContents("serviceStatusResponse.json"))); }
@PostMapping("/nextstatuses/_search") public ServiceStatusResponse getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatusCode, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatusCode, roles,tenantId); List<org.egov.workflow.domain.model.ComplaintStatus> domainStatuses = complaintStatusService .getNextStatuses(complaintStatusSearchCriteria); return new ServiceStatusResponse(null, domainStatuses); }
ServiceStatusController { @PostMapping("/nextstatuses/_search") public ServiceStatusResponse getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatusCode, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatusCode, roles,tenantId); List<org.egov.workflow.domain.model.ComplaintStatus> domainStatuses = complaintStatusService .getNextStatuses(complaintStatusSearchCriteria); return new ServiceStatusResponse(null, domainStatuses); } }
ServiceStatusController { @PostMapping("/nextstatuses/_search") public ServiceStatusResponse getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatusCode, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatusCode, roles,tenantId); List<org.egov.workflow.domain.model.ComplaintStatus> domainStatuses = complaintStatusService .getNextStatuses(complaintStatusSearchCriteria); return new ServiceStatusResponse(null, domainStatuses); } @Autowired  ServiceStatusController(ComplaintStatusService complaintStatusService, KeywordStatusMappingService keywordStatusMappingService); }
ServiceStatusController { @PostMapping("/nextstatuses/_search") public ServiceStatusResponse getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatusCode, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatusCode, roles,tenantId); List<org.egov.workflow.domain.model.ComplaintStatus> domainStatuses = complaintStatusService .getNextStatuses(complaintStatusSearchCriteria); return new ServiceStatusResponse(null, domainStatuses); } @Autowired  ServiceStatusController(ComplaintStatusService complaintStatusService, KeywordStatusMappingService keywordStatusMappingService); @PostMapping("/statuses/_search") ServiceStatusResponse getAllStatus(@RequestBody final ComplaintStatusRequest request,
                                              @RequestParam(defaultValue = "Complaint") final String keyword,
                                              @RequestParam(defaultValue = "default") final String tenantId); @PostMapping("/nextstatuses/_search") ServiceStatusResponse getNextStatuses(@RequestBody final ComplaintStatusRequest request,
                                                 @RequestParam final String currentStatusCode,
                                                 @RequestParam(defaultValue = "default") final String tenantId); }
ServiceStatusController { @PostMapping("/nextstatuses/_search") public ServiceStatusResponse getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatusCode, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatusCode, roles,tenantId); List<org.egov.workflow.domain.model.ComplaintStatus> domainStatuses = complaintStatusService .getNextStatuses(complaintStatusSearchCriteria); return new ServiceStatusResponse(null, domainStatuses); } @Autowired  ServiceStatusController(ComplaintStatusService complaintStatusService, KeywordStatusMappingService keywordStatusMappingService); @PostMapping("/statuses/_search") ServiceStatusResponse getAllStatus(@RequestBody final ComplaintStatusRequest request,
                                              @RequestParam(defaultValue = "Complaint") final String keyword,
                                              @RequestParam(defaultValue = "default") final String tenantId); @PostMapping("/nextstatuses/_search") ServiceStatusResponse getNextStatuses(@RequestBody final ComplaintStatusRequest request,
                                                 @RequestParam final String currentStatusCode,
                                                 @RequestParam(defaultValue = "default") final String tenantId);  }