@Test public void testDoAction(){ System.out.println("doAction"); GatewayRequest messageDetails = new GatewayRequestImpl(); messageDetails.setDateFrom(new Date()); messageDetails.setMessage("a message for testing"); messageDetails.setDateTo(new Date()); messageDetails.setRecipientsNumber("000000000000"); messageDetails.setGatewayRequestDetails(mockGatewayRequestDetails); GatewayResponse response = new GatewayResponseImpl(); response.setGatewayRequest(messageDetails); response.setGatewayMessageId("werfet54y56g645v4e"); response.setMessageStatus(MStatus.PENDING); response.setRecipientNumber("000000000000"); response.setResponseText("Some gateway response message"); response.setId(15000000002l); mockService.log((LogType) anyObject(), (String) anyObject()); expectLastCall(); replay(mockService); instance.doAction(response); verify(mockService); }
public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessageStatus() == MStatus.DELIVERED){ logType = LogType.SUCCESS; } else if(response.getMessageStatus() == MStatus.SENT){ logType = LogType.SUCCESS; } else{ logType = LogType.FAILURE; } try{ getRegWs().log(logType, summary); } catch(Exception e){ logger.error("Error communicating with logging service", e); } }
LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessageStatus() == MStatus.DELIVERED){ logType = LogType.SUCCESS; } else if(response.getMessageStatus() == MStatus.SENT){ logType = LogType.SUCCESS; } else{ logType = LogType.FAILURE; } try{ getRegWs().log(logType, summary); } catch(Exception e){ logger.error("Error communicating with logging service", e); } } }
LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessageStatus() == MStatus.DELIVERED){ logType = LogType.SUCCESS; } else if(response.getMessageStatus() == MStatus.SENT){ logType = LogType.SUCCESS; } else{ logType = LogType.FAILURE; } try{ getRegWs().log(logType, summary); } catch(Exception e){ logger.error("Error communicating with logging service", e); } }  }
LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessageStatus() == MStatus.DELIVERED){ logType = LogType.SUCCESS; } else if(response.getMessageStatus() == MStatus.SENT){ logType = LogType.SUCCESS; } else{ logType = LogType.FAILURE; } try{ getRegWs().log(logType, summary); } catch(Exception e){ logger.error("Error communicating with logging service", e); } }  void doAction(GatewayResponse response); RegistrarService getRegWs(); void setRegWs(RegistrarService regWs); }
LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessageStatus() == MStatus.DELIVERED){ logType = LogType.SUCCESS; } else if(response.getMessageStatus() == MStatus.SENT){ logType = LogType.SUCCESS; } else{ logType = LogType.FAILURE; } try{ getRegWs().log(logType, summary); } catch(Exception e){ logger.error("Error communicating with logging service", e); } }  void doAction(GatewayResponse response); RegistrarService getRegWs(); void setRegWs(RegistrarService regWs);  }