@Test public void testProcessMessageResponses(){ System.out.println("processMessageResponses"); List<MessageRequest> msgList = new ArrayList<MessageRequest>(); MessageRequestImpl request = new MessageRequestImpl(); request.setId(19000000005l); request.setStatus(MStatus.PENDING); msgList.add(request); GatewayRequest gwReq = new GatewayRequestImpl(); gwReq.setMessageRequest(request); gwReq.setId(19000000006l); GatewayResponseImpl response = new GatewayResponseImpl(); response.setMessageStatus(MStatus.DELIVERED); response.setGatewayRequest(gwReq); List<GatewayResponse> responses = new ArrayList<GatewayResponse>(); responses.add(response); expect( mockCore.createGatewayResponseDAO() ).andReturn(mockResponseDao); expect( mockResponseDao.getByPendingMessageAndMaxTries(anyInt()) ).andReturn(responses); replay(mockCore, mockResponseDao); instance.processMessageResponses(); verify(mockCore, mockResponseDao); }
@Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logger.info("No updated gateway responses to process"); } logger.info("Fetched " + responses.size() + "updated message responses"); if (responses != null) { logger.info("Processing GatewayResponses..."); for (GatewayResponse response : responses) { try { processMessageResponse(response); } catch (Exception e) { logger.error("Error while getting message responses: ", e); } } } logger.info("GatewayResponses processed successfully"); }
OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logger.info("No updated gateway responses to process"); } logger.info("Fetched " + responses.size() + "updated message responses"); if (responses != null) { logger.info("Processing GatewayResponses..."); for (GatewayResponse response : responses) { try { processMessageResponse(response); } catch (Exception e) { logger.error("Error while getting message responses: ", e); } } } logger.info("GatewayResponses processed successfully"); } }
OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logger.info("No updated gateway responses to process"); } logger.info("Fetched " + responses.size() + "updated message responses"); if (responses != null) { logger.info("Processing GatewayResponses..."); for (GatewayResponse response : responses) { try { processMessageResponse(response); } catch (Exception e) { logger.error("Error while getting message responses: ", e); } } } logger.info("GatewayResponses processed successfully"); } OMIServiceImpl(); }
OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logger.info("No updated gateway responses to process"); } logger.info("Fetched " + responses.size() + "updated message responses"); if (responses != null) { logger.info("Processing GatewayResponses..."); for (GatewayResponse response : responses) { try { processMessageResponse(response); } catch (Exception e) { logger.error("Error while getting message responses: ", e); } } } logger.info("GatewayResponses processed successfully"); } OMIServiceImpl(); MessageStatus savePatientMessageRequest(String messageId,
                                                   NameValuePair[] personalInfo,
                                                   String patientNumber,
                                                   ContactNumberType patientNumberType,
                                                   String langCode,
                                                   MediaType mediaType,
                                                   Long notificationType,
                                                   Date startDate,
                                                   Date endDate,
                                                   String recipientId); MessageStatus saveCHPSMessageRequest(String messageId, NameValuePair[] personalInfo, String workerNumber, Patient[] patientList, String langCode, MediaType messageType, Long notificationType, Date startDate, Date endDate); MessageStatus sendMessage(MessageRequest message); MessageStatus sendMessage(MessageRequest message, String content); MessageStatus sendMessage(String content, String recipient); MessageStatus scheduleMessage(String content, String recipient); MessageStatus scheduleMessage(MessageRequest message, String content); MessageStatus sendDefaulterMessage(String messageId, String workerNumber, Care[] cares,
                                              CareMessageGroupingStrategy groupingStrategy,
                                              MediaType messageType, Date startDate, Date endDate); MessageStatus sendDeliveriesMessage(String messageId, String workerNumber, Patient[] patients, String deliveryStatus, MediaType messageType, Date startDate, Date endDate); MessageStatus sendUpcomingCaresMessage(String messageId, String workerNumber, Patient patient, MediaType messageType, Date startDate, Date endDate); MessageStatus sendBulkCaresMessage(String messageId, String workerNumber, Care[] cares,
                                              CareMessageGroupingStrategy groupingStrategy,
                                              MediaType messageType, Date startDate, Date endDate); @Transactional(readOnly = true) void processMessageRequests(); void processMessageRequest(MessageRequest message, Language defaultLanguage); @Transactional(readOnly = true) void processMessageRetries(); void processMessageRetry(MessageRequest message); @Transactional(readOnly = true) void processMessageResponses(); void processMessageResponse(GatewayResponse response); MessageStoreManager getStoreManager(); void setStoreManager(MessageStoreManager storeManager); OMPManager getOmpManager(); void setOmpManager(OMPManager ompManager); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); StatusHandler getStatHandler(); void setStatHandler(StatusHandler statHandler); String getDefaultLang(); void setDefaultLang(String defaultLang); int getMaxTries(); void setMaxTries(int maxRetries); void setOmiManager(OMIManager omiManager); OMIServiceWorker getWorker(); void setWorker(OMIServiceWorker worker); }
OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logger.info("No updated gateway responses to process"); } logger.info("Fetched " + responses.size() + "updated message responses"); if (responses != null) { logger.info("Processing GatewayResponses..."); for (GatewayResponse response : responses) { try { processMessageResponse(response); } catch (Exception e) { logger.error("Error while getting message responses: ", e); } } } logger.info("GatewayResponses processed successfully"); } OMIServiceImpl(); MessageStatus savePatientMessageRequest(String messageId,
                                                   NameValuePair[] personalInfo,
                                                   String patientNumber,
                                                   ContactNumberType patientNumberType,
                                                   String langCode,
                                                   MediaType mediaType,
                                                   Long notificationType,
                                                   Date startDate,
                                                   Date endDate,
                                                   String recipientId); MessageStatus saveCHPSMessageRequest(String messageId, NameValuePair[] personalInfo, String workerNumber, Patient[] patientList, String langCode, MediaType messageType, Long notificationType, Date startDate, Date endDate); MessageStatus sendMessage(MessageRequest message); MessageStatus sendMessage(MessageRequest message, String content); MessageStatus sendMessage(String content, String recipient); MessageStatus scheduleMessage(String content, String recipient); MessageStatus scheduleMessage(MessageRequest message, String content); MessageStatus sendDefaulterMessage(String messageId, String workerNumber, Care[] cares,
                                              CareMessageGroupingStrategy groupingStrategy,
                                              MediaType messageType, Date startDate, Date endDate); MessageStatus sendDeliveriesMessage(String messageId, String workerNumber, Patient[] patients, String deliveryStatus, MediaType messageType, Date startDate, Date endDate); MessageStatus sendUpcomingCaresMessage(String messageId, String workerNumber, Patient patient, MediaType messageType, Date startDate, Date endDate); MessageStatus sendBulkCaresMessage(String messageId, String workerNumber, Care[] cares,
                                              CareMessageGroupingStrategy groupingStrategy,
                                              MediaType messageType, Date startDate, Date endDate); @Transactional(readOnly = true) void processMessageRequests(); void processMessageRequest(MessageRequest message, Language defaultLanguage); @Transactional(readOnly = true) void processMessageRetries(); void processMessageRetry(MessageRequest message); @Transactional(readOnly = true) void processMessageResponses(); void processMessageResponse(GatewayResponse response); MessageStoreManager getStoreManager(); void setStoreManager(MessageStoreManager storeManager); OMPManager getOmpManager(); void setOmpManager(OMPManager ompManager); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); StatusHandler getStatHandler(); void setStatHandler(StatusHandler statHandler); String getDefaultLang(); void setDefaultLang(String defaultLang); int getMaxTries(); void setMaxTries(int maxRetries); void setOmiManager(OMIManager omiManager); OMIServiceWorker getWorker(); void setWorker(OMIServiceWorker worker);  }