Search in sources :

Example 11 with SsldPendingFirmwareUpdate

use of org.opensmartgridplatform.domain.core.entities.SsldPendingFirmwareUpdate in project open-smart-grid-platform by OSGP.

the class FirmwareManagementServiceTest method testHandleGetFirmwareVersionWithMatchingFirmwareVersion.

@Test
void testHandleGetFirmwareVersionWithMatchingFirmwareVersion() {
    final List<FirmwareVersionDto> firmwareVersionDtos = Collections.emptyList();
    final SsldPendingFirmwareUpdate ssldPendingFirmwareUpdate = Mockito.mock(SsldPendingFirmwareUpdate.class);
    final List<SsldPendingFirmwareUpdate> ssldPendingFirmwareUpdates = Collections.singletonList(ssldPendingFirmwareUpdate);
    when(this.ssldPendingFirmwareUpdateRepository.findByDeviceIdentification(any(String.class))).thenReturn(ssldPendingFirmwareUpdates);
    when(ssldPendingFirmwareUpdate.getCorrelationUid()).thenReturn(CORRELATION_IDS.getCorrelationUid());
    when(ssldPendingFirmwareUpdate.getFirmwareModuleType()).thenReturn(FirmwareModuleType.SECURITY);
    when(ssldPendingFirmwareUpdate.getFirmwareVersion()).thenReturn(VERSION_1);
    when(this.domainCoreMapper.mapAsList(firmwareVersionDtos, FirmwareVersion.class)).thenReturn(Collections.singletonList(new FirmwareVersion(FirmwareModuleType.SECURITY, VERSION_1)));
    this.firmwareManagementService.handleGetFirmwareVersionResponse(firmwareVersionDtos, CORRELATION_IDS, "messageType", 1, ResponseMessageResultType.OK, null);
    verifyNoInteractions(this.webServiceResponseMessageSender);
    verify(this.ssldPendingFirmwareUpdateRepository).delete(any());
}
Also used : SsldPendingFirmwareUpdate(org.opensmartgridplatform.domain.core.entities.SsldPendingFirmwareUpdate) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) FirmwareVersionDto(org.opensmartgridplatform.dto.valueobjects.FirmwareVersionDto) FirmwareVersion(org.opensmartgridplatform.domain.core.valueobjects.FirmwareVersion) Test(org.junit.jupiter.api.Test)

Aggregations

SsldPendingFirmwareUpdate (org.opensmartgridplatform.domain.core.entities.SsldPendingFirmwareUpdate)11 Test (org.junit.jupiter.api.Test)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 FirmwareModuleType (org.opensmartgridplatform.domain.core.valueobjects.FirmwareModuleType)4 Date (java.util.Date)3 DeviceFirmwareFile (org.opensmartgridplatform.domain.core.entities.DeviceFirmwareFile)2 FirmwareFile (org.opensmartgridplatform.domain.core.entities.FirmwareFile)2 FirmwareModule (org.opensmartgridplatform.domain.core.entities.FirmwareModule)2 Organisation (org.opensmartgridplatform.domain.core.entities.Organisation)2 Ssld (org.opensmartgridplatform.domain.core.entities.Ssld)2 FirmwareVersion (org.opensmartgridplatform.domain.core.valueobjects.FirmwareVersion)2 FirmwareVersionDto (org.opensmartgridplatform.dto.valueobjects.FirmwareVersionDto)2 ComponentType (org.opensmartgridplatform.shared.exceptionhandling.ComponentType)2 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)2 Given (io.cucumber.java.en.Given)1 ArrayList (java.util.ArrayList)1 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)1 Device (org.opensmartgridplatform.domain.core.entities.Device)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)1