@Test public void handleMessageShouldCallUpdateFirmware() throws OsgpException { final FirmwareFileDto firmwareFileDto = this.setupFirmwareFileDto(); final ResponseMessage responseMessage = this.setupResponseMessage(firmwareFileDto); this.getFirmwareFileResponseMessageProcessor .handleMessage(this.dlmsConnectionManagerMock, this.dlmsDevice, responseMessage); verify(this.firmwareService, times(1)) .updateFirmware(this.dlmsConnectionManagerMock, this.dlmsDevice, firmwareFileDto); }
@Override protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable response) throws OsgpException { if (!(response instanceof ResponseMessage)) { throw new ProtocolAdapterException("Invalid response type, expected ResponseMessage object."); } final ResponseMessage responseMessage = (ResponseMessage) response; if (ResponseMessageResultType.OK.equals(responseMessage.getResult())) { final FirmwareFileDto firmwareFileDto = (FirmwareFileDto) responseMessage.getDataObject(); return this.firmwareService.updateFirmware(conn, device, firmwareFileDto); } else { throw new ProtocolAdapterException("Get Firmware File failed.", responseMessage.getOsgpException()); } }
GetFirmwareFileResponseMessageProcessor extends OsgpResponseMessageProcessor { @Override protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable response) throws OsgpException { if (!(response instanceof ResponseMessage)) { throw new ProtocolAdapterException("Invalid response type, expected ResponseMessage object."); } final ResponseMessage responseMessage = (ResponseMessage) response; if (ResponseMessageResultType.OK.equals(responseMessage.getResult())) { final FirmwareFileDto firmwareFileDto = (FirmwareFileDto) responseMessage.getDataObject(); return this.firmwareService.updateFirmware(conn, device, firmwareFileDto); } else { throw new ProtocolAdapterException("Get Firmware File failed.", responseMessage.getOsgpException()); } } }
GetFirmwareFileResponseMessageProcessor extends OsgpResponseMessageProcessor { @Override protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable response) throws OsgpException { if (!(response instanceof ResponseMessage)) { throw new ProtocolAdapterException("Invalid response type, expected ResponseMessage object."); } final ResponseMessage responseMessage = (ResponseMessage) response; if (ResponseMessageResultType.OK.equals(responseMessage.getResult())) { final FirmwareFileDto firmwareFileDto = (FirmwareFileDto) responseMessage.getDataObject(); return this.firmwareService.updateFirmware(conn, device, firmwareFileDto); } else { throw new ProtocolAdapterException("Get Firmware File failed.", responseMessage.getOsgpException()); } } protected  GetFirmwareFileResponseMessageProcessor(); }
GetFirmwareFileResponseMessageProcessor extends OsgpResponseMessageProcessor { @Override protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable response) throws OsgpException { if (!(response instanceof ResponseMessage)) { throw new ProtocolAdapterException("Invalid response type, expected ResponseMessage object."); } final ResponseMessage responseMessage = (ResponseMessage) response; if (ResponseMessageResultType.OK.equals(responseMessage.getResult())) { final FirmwareFileDto firmwareFileDto = (FirmwareFileDto) responseMessage.getDataObject(); return this.firmwareService.updateFirmware(conn, device, firmwareFileDto); } else { throw new ProtocolAdapterException("Get Firmware File failed.", responseMessage.getOsgpException()); } } protected  GetFirmwareFileResponseMessageProcessor(); @SuppressWarnings("squid:S1193") // SilentException cannot be caught since it does not extend Exception. @Override void processMessage(final ObjectMessage message); }
GetFirmwareFileResponseMessageProcessor extends OsgpResponseMessageProcessor { @Override protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable response) throws OsgpException { if (!(response instanceof ResponseMessage)) { throw new ProtocolAdapterException("Invalid response type, expected ResponseMessage object."); } final ResponseMessage responseMessage = (ResponseMessage) response; if (ResponseMessageResultType.OK.equals(responseMessage.getResult())) { final FirmwareFileDto firmwareFileDto = (FirmwareFileDto) responseMessage.getDataObject(); return this.firmwareService.updateFirmware(conn, device, firmwareFileDto); } else { throw new ProtocolAdapterException("Get Firmware File failed.", responseMessage.getOsgpException()); } } protected  GetFirmwareFileResponseMessageProcessor(); @SuppressWarnings("squid:S1193") // SilentException cannot be caught since it does not extend Exception. @Override void processMessage(final ObjectMessage message);  }