Search in sources :

Example 1 with ImageTransferProperties

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.firmware.ImageTransfer.ImageTransferProperties in project open-smart-grid-platform by OSGP.

the class UpdateFirmwareConfig method imageTransferProperties.

@Bean
public ImageTransferProperties imageTransferProperties() {
    final ImageTransferProperties imageTransferProperties = new ImageTransfer.ImageTransferProperties();
    imageTransferProperties.setVerificationStatusCheckInterval(this.verificationStatusCheckInterval);
    imageTransferProperties.setVerificationStatusCheckTimeout(this.verificationStatusCheckTimeout);
    imageTransferProperties.setInitiationStatusCheckInterval(this.initiationStatusCheckInterval);
    imageTransferProperties.setInitiationStatusCheckTimeout(this.initiationStatusCheckTimeout);
    return imageTransferProperties;
}
Also used : ImageTransferProperties(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.firmware.ImageTransfer.ImageTransferProperties) Bean(org.springframework.context.annotation.Bean)

Example 2 with ImageTransferProperties

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.firmware.ImageTransfer.ImageTransferProperties in project open-smart-grid-platform by OSGP.

the class UpdateFirmwareCommandExecutorIntegrationTest method setUp.

@BeforeEach
void setUp() {
    this.connectionStub = new DlmsConnectionStub();
    this.connectionManagerStub = new DlmsConnectionManagerStub(this.connectionStub);
    this.connectionStub.setDefaultReturnValue(DataObject.newArrayData(Collections.emptyList()));
    this.connectionStub.addReturnValue(this.createAttributeAddressForImageTransfer(ImageTransferAttribute.IMAGE_TRANSFER_ENABLED), DataObject.newBoolData(true));
    this.connectionStub.addReturnValue(this.createAttributeAddressForImageTransfer(ImageTransferAttribute.IMAGE_TRANSFER_STATUS), DataObject.newInteger32Data(1), 5);
    this.connectionStub.addReturnValue(this.createAttributeAddressForImageTransfer(ImageTransferAttribute.IMAGE_TRANSFER_STATUS), DataObject.newInteger32Data(6));
    this.connectionStub.addReturnValue(this.createAttributeAddressForImageTransfer(ImageTransferAttribute.IMAGE_BLOCK_SIZE), DataObject.newUInteger32Data(100));
    this.connectionStub.addReturnValue(this.createAttributeAddressForImageTransfer(ImageTransferAttribute.IMAGE_FIRST_NOT_TRANSFERRED_BLOCK_NUMBER), DataObject.newUInteger32Data(100));
    this.messageMetadata = MessageMetadata.newBuilder().withCorrelationUid("123456").build();
    final MethodResult methodResult = mock(MethodResult.class);
    when(methodResult.getResultCode()).thenReturn(MethodResultCode.SUCCESS);
    final ImageTransferProperties imageTransferProperties = new ImageTransfer.ImageTransferProperties();
    imageTransferProperties.setVerificationStatusCheckInterval(this.verificationStatusCheckInterval);
    imageTransferProperties.setVerificationStatusCheckTimeout(this.verificationStatusCheckTimeout);
    imageTransferProperties.setInitiationStatusCheckInterval(this.initiationStatusCheckInterval);
    imageTransferProperties.setInitiationStatusCheckTimeout(this.initiationStatusCheckTimeout);
    this.connectionStub.setDefaultMethodResult(methodResult);
    this.commandExecutor = new UpdateFirmwareCommandExecutor(this.dlmsDeviceRepository, this.firmwareFileCachingRepository, this.firmwareImageIdentifierCachingRepository, this.macGenerationService, imageTransferProperties);
}
Also used : DlmsConnectionManagerStub(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.stub.DlmsConnectionManagerStub) DlmsConnectionStub(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.stub.DlmsConnectionStub) ImageTransferProperties(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.firmware.ImageTransfer.ImageTransferProperties) MethodResult(org.openmuc.jdlms.MethodResult) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ImageTransferProperties (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.firmware.ImageTransfer.ImageTransferProperties)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 MethodResult (org.openmuc.jdlms.MethodResult)1 DlmsConnectionManagerStub (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.stub.DlmsConnectionManagerStub)1 DlmsConnectionStub (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.stub.DlmsConnectionStub)1 Bean (org.springframework.context.annotation.Bean)1