use of org.opensmartgridplatform.domain.core.valueobjects.RelayMap in project open-smart-grid-platform by OSGP.
the class ConfigurationManagementServiceTest method testTrySetConfiguration.
@Test
void testTrySetConfiguration() throws FunctionalException, UnknownEntityException {
final RelayMap relayMap = new RelayMap(1, 1, RelayType.LIGHT, "1");
final List<RelayMap> relayMapList = Collections.singletonList(relayMap);
when(this.organisationDomainService.searchOrganisation(any(String.class))).thenReturn(TEST_ORGANISATION);
when(this.deviceDomainService.searchActiveDevice(any(), any())).thenReturn(this.device);
when(this.configuration.getRelayConfiguration()).thenReturn(new RelayConfiguration(relayMapList));
when(this.ssldRepository.findById(any())).thenReturn(java.util.Optional.of(this.ssld));
when(this.domainCoreMapper.map(any(), any())).thenReturn(this.configurationDto);
doNothing().when(this.ssld).updateOutputSettings(any());
when(this.device.getIpAddress()).thenReturn(IP_ADDRESS);
this.configurationManagementService.setConfiguration(this.correlationIds, this.configuration, SCHEDULE_TIME, MESSAGE_TYPE, MESSAGE_PRIORITY);
verify(this.osgpCoreRequestMessageSender).sendWithScheduledTime(this.requestMessageArgumentCaptor.capture(), this.messageTypeArgumentCaptor.capture(), this.messagePriorityArgumentCaptor.capture(), this.ipAddressArgumentCaptor.capture(), this.scheduledTimeArgumentCaptor.capture());
this.checkRequestMessageArgumentCaptor();
assertThat(this.messageTypeArgumentCaptor.getValue()).isEqualTo(MESSAGE_TYPE);
assertThat(this.messagePriorityArgumentCaptor.getValue()).isEqualTo(MESSAGE_PRIORITY);
assertThat(this.ipAddressArgumentCaptor.getValue()).isEqualTo(IP_ADDRESS);
assertThat(this.scheduledTimeArgumentCaptor.getValue()).isEqualTo(SCHEDULE_TIME);
}
Aggregations