use of org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.LightType 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);
}
}
Aggregations