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();
}
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();
}
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();
}
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());
}
Aggregations