@Test public void testShouldGetComplaintsEligibleForEscalation() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(new Resources().getFileContents("complaintSearchResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final ServiceResponse response = complaintRestRepositoryRepository.getComplaintsEligibleForEscalation("default", 1L); server.verify(); assertTrue(response.getServiceRequests() != null); }
public ServiceResponse getComplaintsEligibleForEscalation(String tenantId, Long userId) { String status = String.join(",", Arrays.asList("FORWARDED", "REGISTERED", "INPROGRESS", "REOPENED", "ONHOLD")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String escalationDate = simpleDateFormat.format(new Date()); final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().userInfo(getUser(userId)).build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ServiceResponse.class, tenantId, status, escalationDate); }
ComplaintRestRepository { public ServiceResponse getComplaintsEligibleForEscalation(String tenantId, Long userId) { String status = String.join(",", Arrays.asList("FORWARDED", "REGISTERED", "INPROGRESS", "REOPENED", "ONHOLD")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String escalationDate = simpleDateFormat.format(new Date()); final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().userInfo(getUser(userId)).build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ServiceResponse.class, tenantId, status, escalationDate); } }
ComplaintRestRepository { public ServiceResponse getComplaintsEligibleForEscalation(String tenantId, Long userId) { String status = String.join(",", Arrays.asList("FORWARDED", "REGISTERED", "INPROGRESS", "REOPENED", "ONHOLD")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String escalationDate = simpleDateFormat.format(new Date()); final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().userInfo(getUser(userId)).build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ServiceResponse.class, tenantId, status, escalationDate); } ComplaintRestRepository(final RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") final String pgrRestHost,
                                   @Value("${egov.services.pgr.escalation_complaints}") final String url); }
ComplaintRestRepository { public ServiceResponse getComplaintsEligibleForEscalation(String tenantId, Long userId) { String status = String.join(",", Arrays.asList("FORWARDED", "REGISTERED", "INPROGRESS", "REOPENED", "ONHOLD")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String escalationDate = simpleDateFormat.format(new Date()); final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().userInfo(getUser(userId)).build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ServiceResponse.class, tenantId, status, escalationDate); } ComplaintRestRepository(final RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") final String pgrRestHost,
                                   @Value("${egov.services.pgr.escalation_complaints}") final String url); ServiceResponse getComplaintsEligibleForEscalation(String tenantId, Long userId); }
ComplaintRestRepository { public ServiceResponse getComplaintsEligibleForEscalation(String tenantId, Long userId) { String status = String.join(",", Arrays.asList("FORWARDED", "REGISTERED", "INPROGRESS", "REOPENED", "ONHOLD")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String escalationDate = simpleDateFormat.format(new Date()); final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().userInfo(getUser(userId)).build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ServiceResponse.class, tenantId, status, escalationDate); } ComplaintRestRepository(final RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") final String pgrRestHost,
                                   @Value("${egov.services.pgr.escalation_complaints}") final String url); ServiceResponse getComplaintsEligibleForEscalation(String tenantId, Long userId);  }