use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ReplaceKeysAsyncResponse in project open-smart-grid-platform by OSGP.
the class ReplaceKeysSteps method theReplaceKeysRequestIsReceived.
@When("^the replace keys request is received$")
public void theReplaceKeysRequestIsReceived(final Map<String, String> settings) throws Throwable {
ScenarioContext.current().put(PlatformKeys.KEY_DEVICE_IDENTIFICATION, settings.get(PlatformKeys.KEY_DEVICE_IDENTIFICATION));
this.putKeyInScenarioContext(settings, PlatformKeys.KEY_DEVICE_AUTHENTICATIONKEY);
this.putKeyInScenarioContext(settings, PlatformKeys.KEY_DEVICE_ENCRYPTIONKEY);
final ReplaceKeysRequest request = ReplaceKeysRequestFactory.fromParameterMap(settings);
final ReplaceKeysAsyncResponse asyncResponse = this.smartMeteringConfigurationClient.replaceKeys(request);
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ReplaceKeysAsyncResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method replaceKeys.
@PayloadRoot(localPart = "ReplaceKeysRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public ReplaceKeysAsyncResponse replaceKeys(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ReplaceKeysRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData keySet = this.configurationMapper.map(request.getSetKeysRequestData(), org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData.class);
final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.REPLACE_KEYS).withMessageType(MessageType.REPLACE_KEYS).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, keySet);
this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
return this.configurationMapper.map(asyncResponse, ReplaceKeysAsyncResponse.class);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ReplaceKeysAsyncResponse in project open-smart-grid-platform by OSGP.
the class ReplaceKeysSteps method multipleReplaceKeysRequestsAreReceived.
@When("^multiple replace keys requests are received$")
public void multipleReplaceKeysRequestsAreReceived(final Map<String, String> settings) throws Throwable {
final List<Map<String, String>> listOfSettingsPerRequest = this.createSettingPerRequest(settings);
final List<String> correlationUIDs = new ArrayList<>();
for (final Map<String, String> settingsPerRequest : listOfSettingsPerRequest) {
final ReplaceKeysRequest request = ReplaceKeysRequestFactory.fromParameterMap(settingsPerRequest);
final ReplaceKeysAsyncResponse asyncResponse = this.smartMeteringConfigurationClient.replaceKeys(request);
correlationUIDs.add(asyncResponse.getCorrelationUid());
}
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, correlationUIDs);
}
Aggregations