use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectRequestMappingTest method testWithCompleteObject.
/**
* Tests if mapping succeeds with a complete SetConfigurationRequestData object.
*/
@Test
public void testWithCompleteObject() {
// build test data
final ConfigurationObject configurationObject = new ConfigurationObject();
final ConfigurationFlag configurationFlag = new ConfigurationFlag();
configurationFlag.setConfigurationFlagType(FLAGTYPE);
configurationFlag.setEnabled(ISENABLED);
final ConfigurationFlags configurationFlags = new ConfigurationFlags();
configurationFlags.getConfigurationFlag().add(configurationFlag);
configurationObject.setConfigurationFlags(configurationFlags);
configurationObject.setGprsOperationMode(GPRSTYPE);
final SetConfigurationObjectRequestData setConfigurationObjectRequestData = new SetConfigurationObjectRequestData();
setConfigurationObjectRequestData.setConfigurationObject(configurationObject);
final SetConfigurationObjectRequest requestOriginal = new SetConfigurationObjectRequest();
requestOriginal.setDeviceIdentification(DEVICE_ID);
requestOriginal.setSetConfigurationObjectRequestData(setConfigurationObjectRequestData);
// actual mapping
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetConfigurationObjectRequest requestMapped = this.configurationMapper.map(requestOriginal, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetConfigurationObjectRequest.class);
// check mapping
assertThat(requestMapped).isNotNull();
assertThat(requestMapped.getDeviceIdentification()).isEqualTo(DEVICE_ID);
assertThat(requestMapped.getSetConfigurationObjectRequestData()).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject()).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject().getGprsOperationMode()).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject().getConfigurationFlags()).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject().getConfigurationFlags().getFlags()).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject().getConfigurationFlags().getFlags().get(0)).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject().getConfigurationFlags().getFlags().get(0).getConfigurationFlagType()).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject().getGprsOperationMode().name()).isEqualTo(GPRSTYPE.name());
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject().getConfigurationFlags().getFlags().get(0).getConfigurationFlagType().name()).isEqualTo(FLAGTYPE.name());
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectRequestMappingTest method testWithNullSetConfigurationObjectRequestData.
/**
* Tests if mapping succeeds when SetConfigurationObjectRequestData is null.
*/
@Test
public void testWithNullSetConfigurationObjectRequestData() {
// build test data
final SetConfigurationObjectRequestData setConfigurationObjectRequestData = null;
final SetConfigurationObjectRequest requestOriginal = new SetConfigurationObjectRequest();
requestOriginal.setDeviceIdentification(DEVICE_ID);
requestOriginal.setSetConfigurationObjectRequestData(setConfigurationObjectRequestData);
// actual mapping
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetConfigurationObjectRequest requestMapped = this.configurationMapper.map(requestOriginal, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetConfigurationObjectRequest.class);
// check mapping
assertThat(requestMapped).isNotNull();
assertThat(requestMapped.getDeviceIdentification()).isNotNull();
assertThat(requestMapped.getDeviceIdentification()).isEqualTo(DEVICE_ID);
assertThat(requestMapped.getSetConfigurationObjectRequestData()).isNull();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectRequestMappingTest method testWithNullConfigurationObject.
/**
* Tests if mapping succeeds when ConfigurationObject is null.
*/
@Test
public void testWithNullConfigurationObject() {
// build test data
final ConfigurationObject configurationObject = null;
final SetConfigurationObjectRequestData setConfigurationObjectRequestData = new SetConfigurationObjectRequestData();
setConfigurationObjectRequestData.setConfigurationObject(configurationObject);
final SetConfigurationObjectRequest requestOriginal = new SetConfigurationObjectRequest();
requestOriginal.setDeviceIdentification(DEVICE_ID);
requestOriginal.setSetConfigurationObjectRequestData(setConfigurationObjectRequestData);
// actual mapping
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetConfigurationObjectRequest requestMapped = this.configurationMapper.map(requestOriginal, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetConfigurationObjectRequest.class);
// check mapping
assertThat(requestMapped).isNotNull();
assertThat(requestMapped.getDeviceIdentification()).isNotNull();
assertThat(requestMapped.getDeviceIdentification()).isEqualTo(DEVICE_ID);
assertThat(requestMapped.getSetConfigurationObjectRequestData()).isNotNull();
assertThat(requestMapped.getSetConfigurationObjectRequestData().getConfigurationObject()).isNull();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectRequestDataFactory method fromParameterMap.
public static SetConfigurationObjectRequestData fromParameterMap(final Map<String, String> requestParameters) {
final SetConfigurationObjectRequestData setConfigurationObjectRequestData = new SetConfigurationObjectRequestData();
setConfigurationObjectRequestData.setConfigurationObject(ConfigurationObjectFactory.fromParameterMap(requestParameters));
return setConfigurationObjectRequestData;
}
Aggregations