Search in sources :

Example 1 with SetConfigurationObjectRequestData

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

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

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

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

Aggregations

SetConfigurationObjectRequestData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequestData)4 Test (org.junit.jupiter.api.Test)3 SetConfigurationObjectRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetConfigurationObjectRequest)3 ConfigurationObject (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationObject)2 ConfigurationFlag (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlag)1 ConfigurationFlags (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlags)1