@Test public void testUpdateMessageStatuses() { System.out.println("updateMessageStatuses"); GatewayResponse response = new GatewayResponseImpl(); response.setGatewayMessageId("werfet54y56g645v4e"); response.setMessageStatus(MStatus.PENDING); response.setRecipientNumber("000000000000"); response.setResponseText("Some gateway response message"); List<GatewayResponse> responses = new ArrayList<GatewayResponse>(); responses.add(response); expect( mockCore.createGatewayResponse() ).andReturn(new GatewayResponseImpl()); expect( mockCache.getResponses((GatewayResponse) anyObject()) ).andReturn(responses); mockWorker.updateMessageStatus((GatewayResponse)anyObject()); expectLastCall(); replay(mockCore, mockCache, mockGateway, mockWorker); instance.updateMessageStatuses(); verify(mockCore, mockCache, mockGateway, mockWorker); }
@Transactional(readOnly = true) public void updateMessageStatuses() { logger.info("Updating GatewayResponse objects"); GatewayResponse gwResp = coreManager.createGatewayResponse(); gwResp.setMessageStatus(MStatus.PENDING); List<GatewayResponse> pendingMessages = cache.getResponses(gwResp); for (GatewayResponse response : pendingMessages) { try { updateMessageStatus(response); } catch (Exception e) { logger.error("SMS message update error"); } } }
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional(readOnly = true) public void updateMessageStatuses() { logger.info("Updating GatewayResponse objects"); GatewayResponse gwResp = coreManager.createGatewayResponse(); gwResp.setMessageStatus(MStatus.PENDING); List<GatewayResponse> pendingMessages = cache.getResponses(gwResp); for (GatewayResponse response : pendingMessages) { try { updateMessageStatus(response); } catch (Exception e) { logger.error("SMS message update error"); } } } }
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional(readOnly = true) public void updateMessageStatuses() { logger.info("Updating GatewayResponse objects"); GatewayResponse gwResp = coreManager.createGatewayResponse(); gwResp.setMessageStatus(MStatus.PENDING); List<GatewayResponse> pendingMessages = cache.getResponses(gwResp); for (GatewayResponse response : pendingMessages) { try { updateMessageStatus(response); } catch (Exception e) { logger.error("SMS message update error"); } } }  }
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional(readOnly = true) public void updateMessageStatuses() { logger.info("Updating GatewayResponse objects"); GatewayResponse gwResp = coreManager.createGatewayResponse(); gwResp.setMessageStatus(MStatus.PENDING); List<GatewayResponse> pendingMessages = cache.getResponses(gwResp); for (GatewayResponse response : pendingMessages) { try { updateMessageStatus(response); } catch (Exception e) { logger.error("SMS message update error"); } } }  @Transactional void scheduleMessage(GatewayRequest gatewayRequest); @Transactional void scheduleMessage(GatewayRequestDetails gatewayRequestDetails); @Transactional void scheduleTransactionalMessage(GatewayRequest gatewayRequest); @Transactional(readOnly = true) void sendScheduledMessages(); Map<Boolean, Set<GatewayResponse>> sendTransactionalMessage(GatewayRequest gatewayRequest); @Transactional Map<Boolean, Set<GatewayResponse>> sendMessage(GatewayRequest gatewayRequest); @Transactional(readOnly = true) void updateMessageStatuses(); CacheService getCache(); void setCache(CacheService cache); GatewayManager getGatewayManager(); void setGatewayManager(GatewayManager gatewayManager); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); SMSMessagingServiceWorker getWorker(); void setWorker(SMSMessagingServiceWorker worker); }
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional(readOnly = true) public void updateMessageStatuses() { logger.info("Updating GatewayResponse objects"); GatewayResponse gwResp = coreManager.createGatewayResponse(); gwResp.setMessageStatus(MStatus.PENDING); List<GatewayResponse> pendingMessages = cache.getResponses(gwResp); for (GatewayResponse response : pendingMessages) { try { updateMessageStatus(response); } catch (Exception e) { logger.error("SMS message update error"); } } }  @Transactional void scheduleMessage(GatewayRequest gatewayRequest); @Transactional void scheduleMessage(GatewayRequestDetails gatewayRequestDetails); @Transactional void scheduleTransactionalMessage(GatewayRequest gatewayRequest); @Transactional(readOnly = true) void sendScheduledMessages(); Map<Boolean, Set<GatewayResponse>> sendTransactionalMessage(GatewayRequest gatewayRequest); @Transactional Map<Boolean, Set<GatewayResponse>> sendMessage(GatewayRequest gatewayRequest); @Transactional(readOnly = true) void updateMessageStatuses(); CacheService getCache(); void setCache(CacheService cache); GatewayManager getGatewayManager(); void setGatewayManager(GatewayManager gatewayManager); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); SMSMessagingServiceWorker getWorker(); void setWorker(SMSMessagingServiceWorker worker);  }