use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject 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.ConfigurationObject in project open-smart-grid-platform by OSGP.
the class BundledGetConfigurationObjectSteps method theBundleResponseShouldContainAConfigurationObjectResponse.
@Then("^the bundle response should contain a get configuration object response with values$")
public void theBundleResponseShouldContainAConfigurationObjectResponse(final Map<String, String> values) throws Throwable {
final Response response = this.getNextBundleResponse();
assertThat(response instanceof GetConfigurationObjectResponse).as("response should be a GetConfigurationResponse object").isTrue();
final ConfigurationObject configurationObject = ((GetConfigurationObjectResponse) response).getConfigurationObject();
assertThat(configurationObject.getGprsOperationMode().toString()).as("The gprs operation mode is not equal").isEqualTo(values.get("GprsOperationMode"));
configurationObject.getConfigurationFlags().getConfigurationFlag().forEach(f -> this.testConfigurationFlag(f, values));
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject in project open-smart-grid-platform by OSGP.
the class SimulatedConfigurationObjectSteps method deviceSimulationOfShouldBeWithConfigurationObject.
@Then("device simulation of {string} should be with configuration object")
public void deviceSimulationOfShouldBeWithConfigurationObject(final String deviceIdentification, final Map<String, String> settings) {
final ConfigurationObject expectedConfigurationObject = ConfigurationObjectFactory.fromParameterMap(settings);
final ObjectNode expectedValue = this.createStructureForConfigurationObject(expectedConfigurationObject, new JsonNodeFactory(false));
final ObjectNode actualValue = this.deviceSimulatorSteps.getDlmsAttributeValue(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, OBJECT_DESCRIPTION);
assertThat(actualValue).as("Simulated ConfigurationObject value").isEqualTo(expectedValue);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject in project open-smart-grid-platform by OSGP.
the class SimulatedConfigurationObjectSteps method deviceSimulationOfConfigurationObject.
@Given("device simulation of {string} with configuration object")
public void deviceSimulationOfConfigurationObject(final String deviceIdentification, final Map<String, String> settings) {
this.deviceSimulatorSteps.deviceSimulationOfEquipmentIdentifier(deviceIdentification);
final ConfigurationObject configurationObject = ConfigurationObjectFactory.fromParameterMap(settings);
final ObjectNode attributeValue = this.createStructureForConfigurationObject(configurationObject, new JsonNodeFactory(false));
this.deviceSimulatorSteps.setDlmsAttributeValue(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, attributeValue, OBJECT_DESCRIPTION);
}
Aggregations