use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileCommandExecutorTest method executeWithoutSelectiveAccess.
@Test
public void executeWithoutSelectiveAccess() throws ProtocolAdapterException {
final DlmsDevice dlmsDevice = new DlmsDevice();
dlmsDevice.setSelectiveAccessSupported(false);
this.executor.execute(this.conn, dlmsDevice, this.getPowerQualityProfileRequestDataDto, messageMetadata);
verify(this.getPowerQualityProfileNoSelectiveAccessHandler).handle(any(DlmsConnectionManager.class), any(DlmsDevice.class), any(GetPowerQualityProfileRequestDataDto.class));
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileCommandExecutorTest method executeWithSelectiveAccess.
@Test
public void executeWithSelectiveAccess() throws ProtocolAdapterException {
final DlmsDevice dlmsDevice = new DlmsDevice();
dlmsDevice.setSelectiveAccessSupported(true);
this.executor.execute(this.conn, dlmsDevice, this.getPowerQualityProfileRequestDataDto, messageMetadata);
verify(this.getPowerQualityProfileSelectiveAccessHandler).handle(any(DlmsConnectionManager.class), any(DlmsDevice.class), any(GetPowerQualityProfileRequestDataDto.class));
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.
the class DlmsHelperTest method testGetWithListWorkaround.
@Test
public void testGetWithListWorkaround() throws ProtocolAdapterException, IOException {
final DlmsConnection dlmsConnection = mock(DlmsConnection.class);
final DlmsConnectionManager connectionManager = mock(DlmsConnectionManager.class);
final DlmsDevice dlmsDevice = mock(DlmsDevice.class);
when(connectionManager.getConnection()).thenReturn(dlmsConnection);
final AttributeAddress[] attrAddresses = new AttributeAddress[1];
attrAddresses[0] = mock(AttributeAddress.class);
when(dlmsDevice.isWithListSupported()).thenReturn(false);
this.dlmsHelper.getWithList(connectionManager, dlmsDevice, attrAddresses);
verify(dlmsConnection).get(attrAddresses[0]);
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.
the class DeviceConverter method convertTo.
@Override
public DlmsDevice convertTo(final SmartMeteringDeviceDto source, final Type<DlmsDevice> destinationType, final MappingContext context) {
final DlmsDevice dlmsDevice = new DlmsDevice();
dlmsDevice.setDeviceIdentification(source.getDeviceIdentification());
dlmsDevice.setCommunicationMethod(source.getCommunicationMethod());
dlmsDevice.setCommunicationProvider(source.getCommunicationProvider());
dlmsDevice.setIccId(source.getIccId());
dlmsDevice.setHls3Active(source.isHls3Active());
dlmsDevice.setHls4Active(source.isHls4Active());
dlmsDevice.setHls5Active(source.isHls5Active());
dlmsDevice.setMbusIdentificationNumber(source.getMbusIdentificationNumber());
dlmsDevice.setMbusManufacturerIdentification(source.getMbusManufacturerIdentification());
dlmsDevice.setProtocol(source.getProtocolName(), source.getProtocolVersion());
return dlmsDevice;
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.
the class DeviceKeyProcessingServiceTest method testNoKeyProcessRunning.
@Test
public void testNoKeyProcessRunning() {
final DlmsDevice dlmsDevice = new DlmsDevice();
dlmsDevice.setDeviceIdentification(DEVICE_IDENTIFICATION);
when(this.dlmsDeviceRepository.findByDeviceIdentification(DEVICE_IDENTIFICATION)).thenReturn(dlmsDevice);
when(this.dlmsDeviceRepository.setProcessingStartTime(eq(DEVICE_IDENTIFICATION), any(Instant.class))).thenReturn(1);
assertDoesNotThrow(() -> this.deviceKeyProcessingService.startProcessing(DEVICE_IDENTIFICATION));
}
Aggregations