use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse in project open-smart-grid-platform by OSGP.
the class ActualMeterReadsGasSteps method theActualMeterReadsResultShouldBeReturned.
@Then("^the actual meter reads gas result should be returned$")
public void theActualMeterReadsResultShouldBeReturned(final Map<String, String> settings) throws Throwable {
final ActualMeterReadsGasAsyncRequest asyncRequest = ActualMeterReadsGasRequestFactory.fromScenarioContext();
final ActualMeterReadsGasResponse response = this.responseClient.getResponse(asyncRequest);
assertThat(response).as("ActualMeterReadsGasResponse should not be null").isNotNull();
assertThat(response.getConsumption()).as("Consumption should not be null").isNotNull();
assertThat(response.getCaptureTime()).as("CaptureTime should not be null").isNotNull();
assertThat(response.getLogTime()).as("LogTime should not be null").isNotNull();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse in project open-smart-grid-platform by OSGP.
the class MeterReadsGasMappingTest method testMeterReadsGasMapping.
/**
* Tests if a MeterReadsGas object can be mapped
*/
@Test
public void testMeterReadsGasMapping() {
// build test data
final OsgpMeterValue osgpMeterValue = new OsgpMeterValue(VALUE, OSGP_UNIT);
final MeterReadsGas meterReadsGas = new MeterReadsGas(DATE, osgpMeterValue, DATE);
// actual mapping
final ActualMeterReadsGasResponse actualMeterReadsGasResponse = this.monitoringMapper.map(meterReadsGas, ActualMeterReadsGasResponse.class);
// check mapping
assertThat(actualMeterReadsGasResponse).isNotNull();
assertThat(actualMeterReadsGasResponse.getConsumption()).isNotNull();
assertThat(actualMeterReadsGasResponse.getConsumption().getUnit()).isNotNull();
assertThat(actualMeterReadsGasResponse.getConsumption().getValue()).isNotNull();
assertThat(actualMeterReadsGasResponse.getConsumption().getUnit()).isEqualTo(OSGP_UNITTYPE);
assertThat(actualMeterReadsGasResponse.getConsumption().getValue()).isEqualTo(VALUE);
// For more information on the mapping of Date to XmlGregorianCalendar
// objects, refer to the DateMappingTest
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringMonitoringEndpoint method getActualMeterReadsGasResponse.
@PayloadRoot(localPart = "ActualMeterReadsGasAsyncRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public ActualMeterReadsGasResponse getActualMeterReadsGasResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ActualMeterReadsGasAsyncRequest request) throws OsgpException {
log.debug("Incoming ActualMeterReadsGasAsyncRequest for meter: {}", request.getDeviceIdentification());
ActualMeterReadsGasResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), MeterReadsGas.class, ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving the actual meter reads for gas");
response = this.monitoringMapper.map(responseData.getMessageData(), ActualMeterReadsGasResponse.class);
} catch (final Exception e) {
this.handleRetrieveException(e, request, organisationIdentification);
}
return response;
}
Aggregations