@Test public void testProcessMessageRequests(){ System.out.println("processMessageRequests"); List<MessageRequest> messageList = new ArrayList<MessageRequest>(); MessageRequest msgReq1 = new MessageRequestImpl(); msgReq1.setDateFrom(new Date()); msgReq1.setDateTo(new Date()); msgReq1.setId(19000000002l); msgReq1.setTryNumber(1); msgReq1.setMessageType(MessageType.TEXT); msgReq1.setRecipientName("Tester"); msgReq1.setRecipientNumber("000000000000"); msgReq1.setStatus(MStatus.QUEUED); messageList.add(msgReq1); GatewayRequest gwReq = new GatewayRequestImpl(); gwReq.setGatewayRequestDetails(new GatewayRequestDetailsImpl()); expect( mockCore.createMessageRequestDAO() ).andReturn(mockRequestDao); expect( mockRequestDao.getMsgByStatus((MStatus) anyObject()) ).andReturn(messageList); expect( mockCore.createLanguageDAO() ).andReturn(mockLangDao); expect( mockLangDao.getByCode((String) anyObject()) ).andReturn(new LanguageImpl()); replay(mockCore, mockRequestDao, mockStore); instance.processMessageRequests(); verify(mockCore, mockRequestDao, mockStore); }
@Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info("MessageRequest fetched: " + numMsgs); logger.debug(messages); Language defaultLanguage = coreManager.createLanguageDAO().getByCode(defaultLang); logger.info("Building GatewayRequests..."); for (MessageRequest message : messages) { try { processMessageRequest(message, defaultLanguage); } catch (Exception e) { logger.error("Error while processing message requests: ", e); } } logger.info("Messages processed successfully"); }
OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info("MessageRequest fetched: " + numMsgs); logger.debug(messages); Language defaultLanguage = coreManager.createLanguageDAO().getByCode(defaultLang); logger.info("Building GatewayRequests..."); for (MessageRequest message : messages) { try { processMessageRequest(message, defaultLanguage); } catch (Exception e) { logger.error("Error while processing message requests: ", e); } } logger.info("Messages processed successfully"); } }
OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info("MessageRequest fetched: " + numMsgs); logger.debug(messages); Language defaultLanguage = coreManager.createLanguageDAO().getByCode(defaultLang); logger.info("Building GatewayRequests..."); for (MessageRequest message : messages) { try { processMessageRequest(message, defaultLanguage); } catch (Exception e) { logger.error("Error while processing message requests: ", e); } } logger.info("Messages processed successfully"); } OMIServiceImpl(); }
OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info("MessageRequest fetched: " + numMsgs); logger.debug(messages); Language defaultLanguage = coreManager.createLanguageDAO().getByCode(defaultLang); logger.info("Building GatewayRequests..."); for (MessageRequest message : messages) { try { processMessageRequest(message, defaultLanguage); } catch (Exception e) { logger.error("Error while processing message requests: ", e); } } logger.info("Messages 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 processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info("MessageRequest fetched: " + numMsgs); logger.debug(messages); Language defaultLanguage = coreManager.createLanguageDAO().getByCode(defaultLang); logger.info("Building GatewayRequests..."); for (MessageRequest message : messages) { try { processMessageRequest(message, defaultLanguage); } catch (Exception e) { logger.error("Error while processing message requests: ", e); } } logger.info("Messages 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);  }