Search in sources :

Example 1 with SetConfigurationObjectRequestDataDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto in project open-smart-grid-platform by OSGP.

the class SetConfigurationObjectCommandExecutor method fromBundleRequestInput.

@Override
public ConfigurationObjectDto fromBundleRequestInput(final ActionRequestDto bundleInput) throws ProtocolAdapterException {
    this.checkActionRequestType(bundleInput);
    final SetConfigurationObjectRequestDataDto dto = (SetConfigurationObjectRequestDataDto) bundleInput;
    return dto.getConfigurationObject();
}
Also used : SetConfigurationObjectRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto)

Example 2 with SetConfigurationObjectRequestDataDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto in project open-smart-grid-platform by OSGP.

the class SetConfigurationObjectRequestMappingTest method testMappingWithNullConfigurationObject.

// Test if mapping with a null ConfigurationObject succeeds
@Test
public void testMappingWithNullConfigurationObject() {
    // build test data
    final String deviceIdentification = "nr1";
    final ConfigurationObjectDto configurationObject = null;
    final SetConfigurationObjectRequestDataDto setConfigurationObjectRequestData = new SetConfigurationObjectRequestDataDto(configurationObject);
    // actual mapping
    final SetConfigurationObjectRequestDto setConfigurationObjectRequest = new SetConfigurationObjectRequestDto(deviceIdentification, setConfigurationObjectRequestData);
    final SetConfigurationObjectRequestDto setConfigurationObjectRequestDto = this.configurationMapper.map(setConfigurationObjectRequest, SetConfigurationObjectRequestDto.class);
    // check values
    assertThat(setConfigurationObjectRequestDto).isNotNull();
    assertThat(setConfigurationObjectRequestDto.getDeviceIdentification()).isEqualTo(deviceIdentification);
    assertThat(setConfigurationObjectRequestDto.getSetConfigurationObjectRequestData().getConfigurationObject()).isNull();
}
Also used : ConfigurationObjectDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto) SetConfigurationObjectRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto) SetConfigurationObjectRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDto) Test(org.junit.jupiter.api.Test)

Example 3 with SetConfigurationObjectRequestDataDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto in project open-smart-grid-platform by OSGP.

the class SetConfigurationObjectRequestMappingTest method testSetConfigurationObjectRequestMappingNullObject.

// Tests if mapping a SetConfigurationObjectRequest with a null
// SetConfigurationObjectRequestData object succeeds.
@Test
public void testSetConfigurationObjectRequestMappingNullObject() {
    // build test data
    final String deviceIdentification = "nr1";
    final SetConfigurationObjectRequestDataDto setConfigurationObjectRequestData = null;
    // actual mapping
    final SetConfigurationObjectRequestDto setConfigurationObjectRequest = new SetConfigurationObjectRequestDto(deviceIdentification, setConfigurationObjectRequestData);
    final SetConfigurationObjectRequestDto setConfigurationObjectRequestDto = this.configurationMapper.map(setConfigurationObjectRequest, SetConfigurationObjectRequestDto.class);
    // check values
    assertThat(setConfigurationObjectRequestDto).isNotNull();
    assertThat(setConfigurationObjectRequestDto.getDeviceIdentification()).isEqualTo(deviceIdentification);
    assertThat(setConfigurationObjectRequestDto.getSetConfigurationObjectRequestData()).isNull();
}
Also used : SetConfigurationObjectRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto) SetConfigurationObjectRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDto) Test(org.junit.jupiter.api.Test)

Example 4 with SetConfigurationObjectRequestDataDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto in project open-smart-grid-platform by OSGP.

the class SetConfigurationObjectRequestMappingTest method checkSetConfigurationObjectRequestData.

// method to check values of all objects that are mapped when a
// SetConfigurationObjectRequest is mapped.
private void checkSetConfigurationObjectRequestData(final GprsOperationModeType gprsOperationModeType, final ConfigurationFlagType configurationFlagType, final ConfigurationFlags configurationFlags, final SetConfigurationObjectRequestDto setConfigurationObjectRequestDto) {
    // check if SetConfigurationObjectRequesDataDto object is present
    final SetConfigurationObjectRequestDataDto setConfigurationObjectRequestDataDto = setConfigurationObjectRequestDto.getSetConfigurationObjectRequestData();
    assertThat(setConfigurationObjectRequestDto).isNotNull();
    // check if ConfigurationObjectDto object is present
    final ConfigurationObjectDto configurationObjectDto = setConfigurationObjectRequestDataDto.getConfigurationObject();
    assertThat(configurationObjectDto).isNotNull();
    // check the GprsOperationModeTypeDto value
    final GprsOperationModeTypeDto gprsOperationModeTypeDto = configurationObjectDto.getGprsOperationMode();
    assertThat(gprsOperationModeTypeDto.name()).isEqualTo(gprsOperationModeType.name());
    // check if ConfigurationFlagsDto object is present, and if its List is
    // of an equal size.
    final ConfigurationFlagsDto configurationFlagsDto = configurationObjectDto.getConfigurationFlags();
    assertThat(configurationFlagsDto).isNotNull();
    assertThat(configurationFlagsDto.getFlags().size()).isEqualTo(configurationFlags.getFlags().size());
    // check ConfigurationObjectFlagTypeDto value.
    final ConfigurationFlagDto configurationFlagDto = configurationFlagsDto.getFlags().get(0);
    final ConfigurationFlagTypeDto configurationFlagTypeDto = configurationFlagDto.getConfigurationFlagType();
    assertThat(configurationFlagTypeDto.name()).isEqualTo(configurationFlagType.name());
}
Also used : GprsOperationModeTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GprsOperationModeTypeDto) ConfigurationFlagsDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagsDto) ConfigurationFlagDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagDto) ConfigurationObjectDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto) ConfigurationFlagTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagTypeDto) SetConfigurationObjectRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto)

Aggregations

SetConfigurationObjectRequestDataDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDataDto)4 Test (org.junit.jupiter.api.Test)2 ConfigurationObjectDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto)2 SetConfigurationObjectRequestDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDto)2 ConfigurationFlagDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagDto)1 ConfigurationFlagTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagTypeDto)1 ConfigurationFlagsDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagsDto)1 GprsOperationModeTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GprsOperationModeTypeDto)1