use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getSetPushSetupSmsResponse.
@PayloadRoot(localPart = "SetPushSetupSmsAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public SetPushSetupSmsResponse getSetPushSetupSmsResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetPushSetupSmsAsyncRequest request) throws OsgpException {
log.info("Incoming SetPushSetupAlarmAsyncRequest for organisation {} for meter: {}.", organisationIdentification, request.getDeviceIdentification());
SetPushSetupSmsResponse response = null;
try {
response = new SetPushSetupSmsResponse();
final ResponseData meterResponseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue()));
if (meterResponseData.getMessageData() instanceof String) {
response.setDescription((String) meterResponseData.getMessageData());
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupSmsResponse 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();
}
Aggregations