use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectRequestFactory method fromParameterMap.
public static SetConfigurationObjectRequest fromParameterMap(final Map<String, String> requestParameters) {
final SetConfigurationObjectRequest setConfigurationObjectRequest = new SetConfigurationObjectRequest();
setConfigurationObjectRequest.setDeviceIdentification(requestParameters.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION));
setConfigurationObjectRequest.setSetConfigurationObjectRequestData(SetConfigurationObjectRequestDataFactory.fromParameterMap(requestParameters));
return setConfigurationObjectRequest;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest 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.SetConfigurationObjectRequest in project open-smart-grid-platform by OSGP.
the class SetConfigurationObject method theSetConfigurationObjectRequestIsReceived.
@When("^the set configuration object request is received$")
public void theSetConfigurationObjectRequestIsReceived(final Map<String, String> requestData) throws Throwable {
final SetConfigurationObjectRequest setConfigurationObjectRequest = SetConfigurationObjectRequestFactory.fromParameterMap(requestData);
final SetConfigurationObjectAsyncResponse setConfigurationObjectAsyncResponse = this.smartMeteringConfigurationClient.setConfigurationObject(setConfigurationObjectRequest);
LOGGER.info("Set configuration object response is received {}", setConfigurationObjectAsyncResponse);
assertThat(setConfigurationObjectAsyncResponse).as("Set configuration object response should not be null").isNotNull();
ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, setConfigurationObjectAsyncResponse.getCorrelationUid());
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest 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.SetConfigurationObjectRequest 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();
}
Aggregations