use of org.opensmartgridplatform.adapter.protocol.dlms.application.mapping.DataObjectToEventListConverter in project open-smart-grid-platform by OSGP.
the class FindEventsCommandExecutorTest method before.
@BeforeEach
public void before() throws ProtocolAdapterException, IOException {
final DataObject fromDate = mock(DataObject.class);
final DataObject toDate = mock(DataObject.class);
this.messageMetadata = MessageMetadata.newBuilder().withCorrelationUid("123456").build();
this.findEventsRequestDto = new FindEventsRequestDto(EventLogCategoryDto.POWER_QUALITY_EVENT_LOG, DateTime.now().minusDays(70), DateTime.now());
final DataObjectToEventListConverter dataObjectToEventListConverter = new DataObjectToEventListConverter(this.dlmsHelper);
final DlmsObjectConfigService dlmsObjectConfigService = new DlmsObjectConfigService(this.dlmsHelper, new DlmsObjectConfigConfiguration().getDlmsObjectConfigs());
this.executor = new FindEventsCommandExecutor(this.dlmsHelper, dataObjectToEventListConverter, dlmsObjectConfigService);
when(this.dlmsHelper.asDataObject(this.findEventsRequestDto.getFrom())).thenReturn(fromDate);
when(this.dlmsHelper.asDataObject(this.findEventsRequestDto.getUntil())).thenReturn(toDate);
when(this.dlmsHelper.convertDataObjectToDateTime(any(DataObject.class))).thenReturn(new CosemDateTimeDto());
when(this.conn.getDlmsMessageListener()).thenReturn(this.dlmsMessageListener);
when(this.conn.getConnection()).thenReturn(this.dlmsConnection);
when(this.dlmsConnection.get(any(AttributeAddress.class))).thenReturn(this.getResult);
}
Aggregations