Search in sources :

Example 1 with SetConfigurationRequest

use of org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationRequest in project open-smart-grid-platform by OSGP.

the class SetConfigurationSteps method receivingASetConfigurationRequest.

/**
 * Sends a Set Configuration request to the platform for a given device identification.
 *
 * @param requestParameters The table with the request parameters.
 * @throws Throwable
 */
@When("^receiving a set configuration request$")
public void receivingASetConfigurationRequest(final Map<String, String> requestParameters) throws Throwable {
    final SetConfigurationRequest request = new SetConfigurationRequest();
    request.setDeviceIdentification(getString(requestParameters, PlatformKeys.KEY_DEVICE_IDENTIFICATION, PlatformCommonDefaults.DEFAULT_DEVICE_IDENTIFICATION));
    final Configuration config = new Configuration();
    if (StringUtils.isNotEmpty(requestParameters.get(PlatformCommonKeys.KEY_LIGHTTYPE))) {
        final LightType lightType = getEnum(requestParameters, PlatformKeys.KEY_LIGHTTYPE, LightType.class);
        config.setLightType(lightType);
    }
    if (StringUtils.isNotEmpty(getString(requestParameters, PlatformCommonKeys.DC_LIGHTS)) || StringUtils.isNotEmpty(getString(requestParameters, PlatformCommonKeys.DC_MAP))) {
        this.addFilledDaliConfigurationToConfiguration(requestParameters, config);
    }
    if (StringUtils.isNotEmpty(getString(requestParameters, PlatformCommonKeys.RC_TYPE)) || StringUtils.isNotEmpty(getString(requestParameters, PlatformCommonKeys.RELAY_CONF))) {
        this.addFilledRelayConfigurationToConfiguration(requestParameters, config);
    }
    final LinkType preferredLinkType = getEnum(requestParameters, PlatformKeys.KEY_PREFERRED_LINKTYPE, LinkType.class);
    config.setPreferredLinkType(preferredLinkType);
    if (requestParameters.containsKey(PlatformKeys.OSGP_IP_ADDRESS) && StringUtils.isNotEmpty(requestParameters.get(PlatformKeys.OSGP_IP_ADDRESS))) {
        config.setOsgpIpAddress(requestParameters.get(PlatformKeys.OSGP_IP_ADDRESS));
    }
    if (requestParameters.containsKey(PlatformKeys.OSGP_PORT) && StringUtils.isNotEmpty(requestParameters.get(PlatformKeys.OSGP_PORT))) {
        config.setOsgpPortNumber(getInteger(requestParameters, PlatformKeys.OSGP_PORT));
    }
    request.setConfiguration(config);
    try {
        ScenarioContext.current().put(PlatformKeys.RESPONSE, this.client.setConfiguration(request));
    } catch (final SoapFaultClientException ex) {
        ScenarioContext.current().put(PlatformKeys.RESPONSE, ex);
    }
}
Also used : LightType(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.LightType) DaliConfiguration(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.DaliConfiguration) RelayConfiguration(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.RelayConfiguration) Configuration(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.Configuration) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) LinkType(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.LinkType) SetConfigurationRequest(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationRequest) When(io.cucumber.java.en.When)

Example 2 with SetConfigurationRequest

use of org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationRequest in project open-smart-grid-platform by OSGP.

the class AuthorizeDeviceFunctionsSteps method setConfiguration.

private void setConfiguration(final Map<String, String> requestParameters) throws WebServiceSecurityException, GeneralSecurityException, IOException {
    final SetConfigurationRequest request = new SetConfigurationRequest();
    request.setDeviceIdentification(getString(requestParameters, PlatformCommonKeys.KEY_DEVICE_IDENTIFICATION, PlatformCommonDefaults.DEFAULT_DEVICE_IDENTIFICATION));
    final Configuration config = new Configuration();
    config.setLightType(PlatformCommonDefaults.CONFIGURATION_LIGHTTYPE);
    config.setPreferredLinkType(PlatformCommonDefaults.CONFIGURATION_PREFERRED_LINKTYPE);
    request.setConfiguration(config);
    ScenarioContext.current().put(PlatformCommonKeys.RESPONSE, this.coreConfigurationManagementClient.setConfiguration(request));
}
Also used : Configuration(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.Configuration) SetConfigurationRequest(org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationRequest)

Aggregations

Configuration (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.Configuration)2 SetConfigurationRequest (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationRequest)2 When (io.cucumber.java.en.When)1 DaliConfiguration (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.DaliConfiguration)1 LightType (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.LightType)1 LinkType (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.LinkType)1 RelayConfiguration (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.RelayConfiguration)1 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)1