Search in sources :

Example 1 with SetPushSetupSmsAsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsAsyncRequest in project open-smart-grid-platform by OSGP.

the class SetPushSetupSmsRequestFactory method fromScenarioContext.

public static SetPushSetupSmsAsyncRequest fromScenarioContext() {
    final SetPushSetupSmsAsyncRequest asyncRequest = new SetPushSetupSmsAsyncRequest();
    asyncRequest.setCorrelationUid(RequestFactoryHelper.getCorrelationUidFromScenarioContext());
    asyncRequest.setDeviceIdentification(RequestFactoryHelper.getDeviceIdentificationFromScenarioContext());
    return asyncRequest;
}
Also used : SetPushSetupSmsAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsAsyncRequest)

Example 2 with SetPushSetupSmsAsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsAsyncRequest in project open-smart-grid-platform by OSGP.

the class SetPushSetupSms method thePushSetupSmsShouldBeSetOnTheDevice.

@Then("^the PushSetupSms should be set on the device$")
public void thePushSetupSmsShouldBeSetOnTheDevice(final Map<String, String> settings) throws Throwable {
    final SetPushSetupSmsAsyncRequest setPushSetupSmsAsyncRequest = SetPushSetupSmsRequestFactory.fromScenarioContext();
    final SetPushSetupSmsResponse setPushSetupSmsResponse = this.smartMeteringConfigurationClient.getSetPushSetupSmsResponse(setPushSetupSmsAsyncRequest);
    assertThat(setPushSetupSmsResponse).as("SetPushSetupSmsResponse was null").isNotNull();
    assertThat(setPushSetupSmsResponse.getResult()).as("SetPushSetupSmsResponse result was null").isNotNull();
    assertThat(setPushSetupSmsResponse.getResult()).as("SetPushSetupSmsResponse should be OK").isEqualTo(OsgpResultType.OK);
    final GetSpecificAttributeValueResponse specificAttributeValues = this.getSpecificAttributeValues(settings);
    assertThat(specificAttributeValues).as("GetSpecificAttributeValuesResponse was null").isNotNull();
    assertThat(specificAttributeValues.getResult()).as("GetSpecificAttributeValuesResponse result was null").isNotNull();
    assertThat(specificAttributeValues.getResult()).as("GetSpecificAttributeValuesResponse should be OK").isEqualTo(OsgpResultType.OK);
    final String hostAndPort = ScenarioContext.current().get(PlatformSmartmeteringKeys.HOSTNAME) + ":" + ScenarioContext.current().get(PlatformSmartmeteringKeys.PORT);
    final byte[] expectedBytes = (hostAndPort.getBytes(StandardCharsets.US_ASCII));
    final String expected = Arrays.toString(expectedBytes);
    final String actual = specificAttributeValues.getAttributeValueData();
    assertThat(actual.contains(expected)).as("PushSetupSms was not set on device").isTrue();
}
Also used : GetSpecificAttributeValueResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueResponse) SetPushSetupSmsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsResponse) SetPushSetupSmsAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsAsyncRequest) Then(io.cucumber.java.en.Then)

Aggregations

SetPushSetupSmsAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsAsyncRequest)2 Then (io.cucumber.java.en.Then)1 GetSpecificAttributeValueResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueResponse)1 SetPushSetupSmsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsResponse)1