@Test public void testProcessScheduledMessageFailed() { final ResponseMessageResultType result = ResponseMessageResultType.NOT_OK; final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); final Date scheduledRetryTime = calendar.getTime(); final RetryHeader retryHeader = new RetryHeader(1, 1, scheduledRetryTime); final ProtocolResponseMessage message = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(DEVICE_MESSAGE_DATA) .domain(DOMAIN) .domainVersion(DOMAIN_VERSION) .result(result) .dataObject(DATA_OBJECT) .scheduled(true) .retryHeader(retryHeader) .build(); final ScheduledTask scheduledTask = new ScheduledTask(DEVICE_MESSAGE_DATA, DOMAIN, DOMAIN, DATA_OBJECT, SCHEDULED_TIME); when(this.scheduledTaskService.findByCorrelationUid(anyString())).thenReturn(scheduledTask); this.deviceResponseMessageService.processMessage(message); verify(this.domainResponseMessageSender).send(message); verify(this.scheduledTaskService).deleteScheduledTask(scheduledTask); }
public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { synchronized (this) { this.deviceCommunicationInformationService.updateDeviceConnectionInformation(message); } if (message.isScheduled() && !message.bypassRetry()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduledTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (final FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }
DeviceResponseMessageService { public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { synchronized (this) { this.deviceCommunicationInformationService.updateDeviceConnectionInformation(message); } if (message.isScheduled() && !message.bypassRetry()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduledTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (final FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } } }
DeviceResponseMessageService { public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { synchronized (this) { this.deviceCommunicationInformationService.updateDeviceConnectionInformation(message); } if (message.isScheduled() && !message.bypassRetry()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduledTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (final FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }  }
DeviceResponseMessageService { public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { synchronized (this) { this.deviceCommunicationInformationService.updateDeviceConnectionInformation(message); } if (message.isScheduled() && !message.bypassRetry()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduledTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (final FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }  void processMessage(final ProtocolResponseMessage message); }
DeviceResponseMessageService { public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { synchronized (this) { this.deviceCommunicationInformationService.updateDeviceConnectionInformation(message); } if (message.isScheduled() && !message.bypassRetry()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduledTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (final FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }  void processMessage(final ProtocolResponseMessage message);  }