use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse in project open-smart-grid-platform by OSGP.
the class GetAdministrativeStatus method theRetrieveAdministrativeStatusRequestIsReceivedForDevices.
@When("^the get administrative status request is received for devices$")
public void theRetrieveAdministrativeStatusRequestIsReceivedForDevices(final List<String> deviceIdentifications) throws Throwable {
final Map<String, String> parameterMap = new HashMap<>();
final Map<String, String> correlationUidMap = new HashMap<>();
for (final String deviceIdentification : deviceIdentifications) {
parameterMap.put(PlatformKeys.KEY_DEVICE_IDENTIFICATION, deviceIdentification);
final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory.fromParameterMap(parameterMap);
final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient.getAdministrativeStatus(getAdministrativeStatusRequest);
assertThat(getAdministrativeStatusAsyncResponse).as("Get administrative status asyncResponse should not be null").isNotNull();
correlationUidMap.put(deviceIdentification, getAdministrativeStatusAsyncResponse.getCorrelationUid());
}
ScenarioContext.current().put(CORRELATION_UID_BY_DEVICE_IDENTIFICATION, correlationUidMap);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse in project open-smart-grid-platform by OSGP.
the class AddDeviceSteps method aRequestToTheDeviceCanBePerformedAfterActivation.
@Then("^a request to the device can be performed after activation$")
public void aRequestToTheDeviceCanBePerformedAfterActivation() throws Throwable {
final Device device = this.activateDevice();
/*
* Fire any request that causes communication to the device, and check
* that the actual response is not an error.
*/
final GetAdministrativeStatusRequest request = new GetAdministrativeStatusRequest();
request.setDeviceIdentification(device.getDeviceIdentification());
final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient.getAdministrativeStatus(request);
final GetAdministrativeStatusAsyncRequest asyncRequest = new GetAdministrativeStatusAsyncRequest();
asyncRequest.setCorrelationUid(getAdministrativeStatusAsyncResponse.getCorrelationUid());
asyncRequest.setDeviceIdentification(device.getDeviceIdentification());
final GetAdministrativeStatusResponse getAdministrativeStatusResponse = this.smartMeteringConfigurationClient.retrieveGetAdministrativeStatusResponse(asyncRequest);
assertThat(getAdministrativeStatusResponse.getEnabled()).as("Administrative status should contain information if it is enabled").isNotNull();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getAdministrativeStatus.
@PayloadRoot(localPart = "GetAdministrativeStatusRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetAdministrativeStatusAsyncResponse getAdministrativeStatus(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetAdministrativeStatusRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.GET_ADMINISTRATIVE_STATUS).withMessageType(MessageType.GET_ADMINISTRATIVE_STATUS).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType.UNDEFINED);
this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
return this.configurationMapper.map(asyncResponse, GetAdministrativeStatusAsyncResponse.class);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse in project open-smart-grid-platform by OSGP.
the class GetAdministrativeStatus method theRetrieveAdministrativeStatusRequestIsReceived.
@When("^the get administrative status request is received$")
public void theRetrieveAdministrativeStatusRequestIsReceived(final Map<String, String> requestData) throws Throwable {
final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory.fromParameterMap(requestData);
final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient.getAdministrativeStatus(getAdministrativeStatusRequest);
LOGGER.info("Get administrative status asyncResponse is received {}", getAdministrativeStatusAsyncResponse);
assertThat(getAdministrativeStatusAsyncResponse).as("Get administrative status asyncResponse should not be null").isNotNull();
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, getAdministrativeStatusAsyncResponse.getCorrelationUid());
}
Aggregations