Search in sources :

Example 6 with ConfigurationObject

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();
}
Also used : ConfigurationObject(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject) SetConfigurationObjectRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest) SetConfigurationObjectRequestData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData) Test(org.junit.jupiter.api.Test)

Example 7 with ConfigurationObject

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));
}
Also used : GetConfigurationObjectResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectResponse) Response(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response) ConfigurationObject(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject) GetConfigurationObjectResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectResponse) Then(io.cucumber.java.en.Then)

Example 8 with ConfigurationObject

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);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ConfigurationObject(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) Then(io.cucumber.java.en.Then)

Example 9 with ConfigurationObject

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);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ConfigurationObject(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) Given(io.cucumber.java.en.Given)

Aggregations

ConfigurationObject (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject)9 ConfigurationFlags (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlags)3 JsonNodeFactory (com.fasterxml.jackson.databind.node.JsonNodeFactory)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 Then (io.cucumber.java.en.Then)2 Test (org.junit.jupiter.api.Test)2 ConfigurationFlag (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlag)2 SetConfigurationObjectRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest)2 SetConfigurationObjectRequestData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData)2 Given (io.cucumber.java.en.Given)1 ArrayList (java.util.ArrayList)1 GetConfigurationObjectResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectResponse)1 SetConfigurationObjectRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetConfigurationObjectRequest)1 Response (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response)1 GprsOperationModeType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GprsOperationModeType)1