use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse in project open-smart-grid-platform by OSGP.
the class ActualMeterReadsSteps method theGetActualMeterReadsRequestGeneratingAnErrorIsReceived.
@When("^the get actual meter reads request generating an error is received$")
public void theGetActualMeterReadsRequestGeneratingAnErrorIsReceived(final Map<String, String> settings) throws Throwable {
final ActualMeterReadsRequest request = ActualMeterReadsRequestFactory.fromParameterMap(settings);
final ActualMeterReadsAsyncResponse asyncResponse = this.requestClient.doRequest(request);
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
final ActualMeterReadsAsyncRequest actualMeterReadsAsyncRequest = ActualMeterReadsRequestFactory.fromScenarioContext();
assertThat(actualMeterReadsAsyncRequest).as("ActualMeterReadsAsyncRequest should not be null").isNotNull();
try {
final ActualMeterReadsResponse response = this.responseClient.getResponse(actualMeterReadsAsyncRequest);
fail("Expected exception, but got a response: %s", response.toString());
} catch (final Exception exception) {
ScenarioContext.current().put(PlatformKeys.RESPONSE, exception);
}
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringMonitoringEndpoint method getActualMeterReadsResponse.
@PayloadRoot(localPart = "ActualMeterReadsAsyncRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public ActualMeterReadsResponse getActualMeterReadsResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ActualMeterReadsAsyncRequest request) throws OsgpException {
log.debug("Incoming ActualMeterReadsAsyncRequest for meter: {}", request.getDeviceIdentification());
ActualMeterReadsResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), MeterReads.class, ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving the actual meter reads");
response = this.monitoringMapper.map(responseData.getMessageData(), ActualMeterReadsResponse.class);
} catch (final Exception e) {
this.handleRetrieveException(e, request, organisationIdentification);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse in project open-smart-grid-platform by OSGP.
the class MeterReadsMappingTest method testMeterReadsMapping.
/**
* Tests if a MeterReads object can be mapped.
*/
@Test
public void testMeterReadsMapping() {
// build test data
final OsgpMeterValue osgpMeterValue = new OsgpMeterValue(VALUE, OSGP_UNIT);
final MeterReads meterReads = new MeterReads(DATE, new ActiveEnergyValues(osgpMeterValue, osgpMeterValue, osgpMeterValue, osgpMeterValue, osgpMeterValue, osgpMeterValue));
// actual mapping
final ActualMeterReadsResponse actualMeterReadsResponse = this.monitoringMapper.map(meterReads, ActualMeterReadsResponse.class);
// check mapping
assertThat(actualMeterReadsResponse).isNotNull();
assertThat(actualMeterReadsResponse.getLogTime()).isNotNull();
this.checkOsgpMeterValueMapping(actualMeterReadsResponse.getActiveEnergyExport());
this.checkOsgpMeterValueMapping(actualMeterReadsResponse.getActiveEnergyExportTariffOne());
this.checkOsgpMeterValueMapping(actualMeterReadsResponse.getActiveEnergyExportTariffTwo());
this.checkOsgpMeterValueMapping(actualMeterReadsResponse.getActiveEnergyImport());
this.checkOsgpMeterValueMapping(actualMeterReadsResponse.getActiveEnergyImportTariffOne());
this.checkOsgpMeterValueMapping(actualMeterReadsResponse.getActiveEnergyImportTariffTwo());
// For more information on the mapping of Date to XmlGregorianCalendar
// objects, refer to the DateMappingTest
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse in project open-smart-grid-platform by OSGP.
the class ActualMeterReadsSteps method theActualMeterReadsResultShouldBeReturned.
@Then("^the actual meter reads result should be returned$")
public void theActualMeterReadsResultShouldBeReturned(final Map<String, String> settings) throws Throwable {
final ActualMeterReadsAsyncRequest asyncRequest = ActualMeterReadsRequestFactory.fromScenarioContext();
final ActualMeterReadsResponse response = this.responseClient.getResponse(asyncRequest);
assertThat(response).as("ActualMeterReadsResponse should not be null").isNotNull();
assertThat(response.getActiveEnergyExport()).as("ActiveEnergyExport should not be null").isNotNull();
assertThat(response.getActiveEnergyExportTariffOne()).as("ActiveEnergyExportTariffOne should not be null").isNotNull();
assertThat(response.getActiveEnergyExportTariffTwo()).as("ActiveEnergyExportTariffTwo should not be null").isNotNull();
assertThat(response.getActiveEnergyImport()).as("ActiveEnergyImport should not be null").isNotNull();
assertThat(response.getActiveEnergyImportTariffOne()).as("ActiveEnergyImportTariffOne should not be null").isNotNull();
assertThat(response.getActiveEnergyImportTariffTwo()).as("ActiveEnergyimportTariffTwo should not be null").isNotNull();
assertThat(response.getLogTime()).as("LogTime should not be null").isNotNull();
}
Aggregations