use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse in project open-smart-grid-platform by OSGP.
the class SetPushSetupSms method getSpecificAttributeValues.
private GetSpecificAttributeValueResponse getSpecificAttributeValues(final Map<String, String> settings) throws WebServiceSecurityException, GeneralSecurityException, IOException {
// Make a specificAttributeValueRequest to read out the register for
// pushsetupsms on the device simulator. ClassID = 40, ObisCode =
// 0.2.25.9.0.255 and AttributeID = 3. This is the attribute that stores
// 'sendDestinationAndMethod' which we sent earlier in the form of
// host:port
final GetSpecificAttributeValueRequest request = new GetSpecificAttributeValueRequest();
request.setClassId(BigInteger.valueOf(40L));
request.setObisCode(this.getObisCodeValues());
request.setAttribute(BigInteger.valueOf(3L));
request.setDeviceIdentification(settings.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION));
final GetSpecificAttributeValueAsyncResponse asyncResponse = this.adHocRequestclient.doRequest(request);
final GetSpecificAttributeValueAsyncRequest asyncRequest = new GetSpecificAttributeValueAsyncRequest();
asyncRequest.setDeviceIdentification(asyncResponse.getDeviceIdentification());
asyncRequest.setCorrelationUid(asyncResponse.getCorrelationUid());
return this.adHocResponseClient.getResponse(asyncRequest);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse in project open-smart-grid-platform by OSGP.
the class SpecificAttributeValue method whenTheGetSpecificAttributeValueRequestIsReceived.
@When("^the get specific attribute value request is received$")
public void whenTheGetSpecificAttributeValueRequestIsReceived(final Map<String, String> settings) throws Throwable {
final GetSpecificAttributeValueRequest request = SpecificAttributeValueRequestFactory.fromParameterMap(settings);
final GetSpecificAttributeValueAsyncResponse asyncResponse = this.requestClient.doRequest(request);
assertThat(asyncResponse).as("AsyncResponse should not be null").isNotNull();
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringAdhocEndpoint method getSpecificAttributeValue.
@PayloadRoot(localPart = "GetSpecificAttributeValueRequest", namespace = SMARTMETER_ADHOC_NAMESPACE)
@ResponsePayload
public GetSpecificAttributeValueAsyncResponse getSpecificAttributeValue(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetSpecificAttributeValueRequest 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.SpecificAttributeValueRequest getSpecificAttributeValueRequest = this.adhocMapper.map(request, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecificAttributeValueRequest.class);
final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.GET_SPECIFIC_ATTRIBUTE_VALUE).withMessageType(MessageType.GET_SPECIFIC_ATTRIBUTE_VALUE).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, getSpecificAttributeValueRequest);
this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
return this.adhocMapper.map(asyncResponse, GetSpecificAttributeValueAsyncResponse.class);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse in project open-smart-grid-platform by OSGP.
the class FunctionalExceptionsSteps method whenTheGetSpecificAttributeValueRequestGeneratingAnErrorIsReceived.
@When("^the get specific attribute value request generating an error is received$")
public void whenTheGetSpecificAttributeValueRequestGeneratingAnErrorIsReceived(final Map<String, String> settings) throws Throwable {
final GetSpecificAttributeValueRequest request = SpecificAttributeValueRequestFactory.fromParameterMap(settings);
final GetSpecificAttributeValueAsyncResponse asyncResponse = this.getSpecificAttributeValueRequestClient.doRequest(request);
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
final GetSpecificAttributeValueAsyncRequest asyncRequest = SpecificAttributeValueRequestFactory.fromScenarioContext();
try {
this.getSpecificAttributeValueResponseClient.getResponse(asyncRequest);
} catch (final Exception exception) {
ScenarioContext.current().put(PlatformKeys.RESPONSE, exception);
}
}
Aggregations