Search in sources :

Example 1 with GetSpecificAttributeValueAsyncRequest

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);
}
Also used : GetSpecificAttributeValueAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest) GetSpecificAttributeValueAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest)

Example 2 with GetSpecificAttributeValueAsyncRequest

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();
}
Also used : GetSpecificAttributeValueAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest) GetSpecificAttributeValueResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueResponse) Then(io.cucumber.java.en.Then)

Example 3 with GetSpecificAttributeValueAsyncRequest

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;
}
Also used : GetSpecificAttributeValueAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest)

Example 4 with GetSpecificAttributeValueAsyncRequest

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);
    }
}
Also used : GetSpecificAttributeValueAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest) GetSpecificAttributeValueAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest) When(io.cucumber.java.en.When)

Aggregations

GetSpecificAttributeValueAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncRequest)4 GetSpecificAttributeValueAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueAsyncResponse)2 GetSpecificAttributeValueRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest)2 Then (io.cucumber.java.en.Then)1 When (io.cucumber.java.en.When)1 GetSpecificAttributeValueResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueResponse)1