use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest 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.GetSpecificAttributeValueAsyncRequest in project open-smart-grid-platform by OSGP.
the class SpecificAttributeValue method thenAGetSpecificAttributeValueResponseShouldBeReturned.
@Then("^a get specific attribute value response should be returned$")
public void thenAGetSpecificAttributeValueResponseShouldBeReturned(final Map<String, String> settings) throws Throwable {
final GetSpecificAttributeValueAsyncRequest asyncRequest = SpecificAttributeValueRequestFactory.fromScenarioContext();
final GetSpecificAttributeValueResponse response = this.responseClient.getResponse(asyncRequest);
assertThat(response.getResult().name()).as("Result is not as expected.").isEqualTo(settings.get(PlatformSmartmeteringKeys.RESULT));
final String actual = response.getAttributeValueData();
assertThat(StringUtils.isNotBlank(actual)).as("Result contains no data.").isTrue();
final String expected = settings.get(PlatformSmartmeteringKeys.RESPONSE_PART);
assertThat(actual.contains(expected)).as("Result data is not as expected; expected '" + expected + "' to be part of '" + actual + "'").isTrue();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest in project open-smart-grid-platform by OSGP.
the class SpecificAttributeValueRequestFactory method fromScenarioContext.
public static GetSpecificAttributeValueAsyncRequest fromScenarioContext() {
final GetSpecificAttributeValueAsyncRequest asyncRequest = new GetSpecificAttributeValueAsyncRequest();
asyncRequest.setCorrelationUid(RequestFactoryHelper.getCorrelationUidFromScenarioContext());
asyncRequest.setDeviceIdentification(RequestFactoryHelper.getDeviceIdentificationFromScenarioContext());
return asyncRequest;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest 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