@Ignore @Test public void testSendMessage() { System.out.println("sendMessage"); GatewayRequest messageDetails = new GatewayRequestImpl(); messageDetails.setDateFrom(new Date()); messageDetails.setMessage("a message for testing"); messageDetails.setDateTo(new Date()); messageDetails.setRecipientsNumber("000000000000"); messageDetails.setGatewayRequestDetails(mockGatewayRequestDetails); expect( mockHandler.parseMessageResponse((GatewayRequest) anyObject(), (String) anyObject()) ).andReturn(new HashSet<GatewayResponse>()); replay(mockHandler); Set<GatewayResponse> result = instance.sendMessage(messageDetails); assertNotNull(result); verify(mockHandler); }
public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { String gatewayResponse; if(messageDetails == null) return null; logger.debug("Building ORServe message gateway webservice proxy class"); URL wsdlURL = null; try { wsdlURL = new URL("http: } catch ( MalformedURLException e ) { logger.error("Error creating web service client", e); throw new MotechException(e.getMessage()); } logger.debug("Calling sendMessage method of ORServe message gateway"); logger.debug(messageDetails); try{ SMSMessenger messenger = new SMSMessenger(wsdlURL, new QName("http: SMSMessengerSoap soap = messenger.getSMSMessengerSoap(); gatewayResponse = soap.sendMessage(messageDetails.getMessage(), messageDetails.getRecipientsNumber(), getSenderId(), getProductCode(), String.valueOf(messageDetails.getGatewayRequestDetails().getNumberOfPages())); } catch(Exception ex){ logger.error("Error sending message", ex); throw new MotechException(ex.getMessage()); } messageDetails.setDateSent(new Date()); logger.debug("Parsing gateway response"); return messageHandler.parseMessageResponse(messageDetails, gatewayResponse); }
ORServeGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { String gatewayResponse; if(messageDetails == null) return null; logger.debug("Building ORServe message gateway webservice proxy class"); URL wsdlURL = null; try { wsdlURL = new URL("http: } catch ( MalformedURLException e ) { logger.error("Error creating web service client", e); throw new MotechException(e.getMessage()); } logger.debug("Calling sendMessage method of ORServe message gateway"); logger.debug(messageDetails); try{ SMSMessenger messenger = new SMSMessenger(wsdlURL, new QName("http: SMSMessengerSoap soap = messenger.getSMSMessengerSoap(); gatewayResponse = soap.sendMessage(messageDetails.getMessage(), messageDetails.getRecipientsNumber(), getSenderId(), getProductCode(), String.valueOf(messageDetails.getGatewayRequestDetails().getNumberOfPages())); } catch(Exception ex){ logger.error("Error sending message", ex); throw new MotechException(ex.getMessage()); } messageDetails.setDateSent(new Date()); logger.debug("Parsing gateway response"); return messageHandler.parseMessageResponse(messageDetails, gatewayResponse); } }
ORServeGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { String gatewayResponse; if(messageDetails == null) return null; logger.debug("Building ORServe message gateway webservice proxy class"); URL wsdlURL = null; try { wsdlURL = new URL("http: } catch ( MalformedURLException e ) { logger.error("Error creating web service client", e); throw new MotechException(e.getMessage()); } logger.debug("Calling sendMessage method of ORServe message gateway"); logger.debug(messageDetails); try{ SMSMessenger messenger = new SMSMessenger(wsdlURL, new QName("http: SMSMessengerSoap soap = messenger.getSMSMessengerSoap(); gatewayResponse = soap.sendMessage(messageDetails.getMessage(), messageDetails.getRecipientsNumber(), getSenderId(), getProductCode(), String.valueOf(messageDetails.getGatewayRequestDetails().getNumberOfPages())); } catch(Exception ex){ logger.error("Error sending message", ex); throw new MotechException(ex.getMessage()); } messageDetails.setDateSent(new Date()); logger.debug("Parsing gateway response"); return messageHandler.parseMessageResponse(messageDetails, gatewayResponse); }  }
ORServeGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { String gatewayResponse; if(messageDetails == null) return null; logger.debug("Building ORServe message gateway webservice proxy class"); URL wsdlURL = null; try { wsdlURL = new URL("http: } catch ( MalformedURLException e ) { logger.error("Error creating web service client", e); throw new MotechException(e.getMessage()); } logger.debug("Calling sendMessage method of ORServe message gateway"); logger.debug(messageDetails); try{ SMSMessenger messenger = new SMSMessenger(wsdlURL, new QName("http: SMSMessengerSoap soap = messenger.getSMSMessengerSoap(); gatewayResponse = soap.sendMessage(messageDetails.getMessage(), messageDetails.getRecipientsNumber(), getSenderId(), getProductCode(), String.valueOf(messageDetails.getGatewayRequestDetails().getNumberOfPages())); } catch(Exception ex){ logger.error("Error sending message", ex); throw new MotechException(ex.getMessage()); } messageDetails.setDateSent(new Date()); logger.debug("Parsing gateway response"); return messageHandler.parseMessageResponse(messageDetails, gatewayResponse); }  Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); String getMessageStatus(GatewayResponse response); MStatus mapMessageStatus(GatewayResponse response); String getProductCode(); void setProductCode(String productCode); String getSenderId(); void setSenderId(String senderId); GatewayMessageHandler getMessageHandler(); void setMessageHandler(GatewayMessageHandler messageHandler); }
ORServeGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { String gatewayResponse; if(messageDetails == null) return null; logger.debug("Building ORServe message gateway webservice proxy class"); URL wsdlURL = null; try { wsdlURL = new URL("http: } catch ( MalformedURLException e ) { logger.error("Error creating web service client", e); throw new MotechException(e.getMessage()); } logger.debug("Calling sendMessage method of ORServe message gateway"); logger.debug(messageDetails); try{ SMSMessenger messenger = new SMSMessenger(wsdlURL, new QName("http: SMSMessengerSoap soap = messenger.getSMSMessengerSoap(); gatewayResponse = soap.sendMessage(messageDetails.getMessage(), messageDetails.getRecipientsNumber(), getSenderId(), getProductCode(), String.valueOf(messageDetails.getGatewayRequestDetails().getNumberOfPages())); } catch(Exception ex){ logger.error("Error sending message", ex); throw new MotechException(ex.getMessage()); } messageDetails.setDateSent(new Date()); logger.debug("Parsing gateway response"); return messageHandler.parseMessageResponse(messageDetails, gatewayResponse); }  Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); String getMessageStatus(GatewayResponse response); MStatus mapMessageStatus(GatewayResponse response); String getProductCode(); void setProductCode(String productCode); String getSenderId(); void setSenderId(String senderId); GatewayMessageHandler getMessageHandler(); void setMessageHandler(GatewayMessageHandler messageHandler);  }