Search in sources :

Example 1 with SetConfigurationObjectRequest

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

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

Example 3 with SetConfigurationObjectRequest

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());
}
Also used : SetConfigurationObjectRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest) SetConfigurationObjectAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectAsyncResponse) When(io.cucumber.java.en.When)

Example 4 with SetConfigurationObjectRequest

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();
}
Also used : 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 5 with SetConfigurationObjectRequest

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

Aggregations

SetConfigurationObjectRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest)5 Test (org.junit.jupiter.api.Test)3 SetConfigurationObjectRequestData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData)3 ConfigurationObject (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject)2 When (io.cucumber.java.en.When)1 ConfigurationFlag (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlag)1 ConfigurationFlags (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlags)1 SetConfigurationObjectAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectAsyncResponse)1