Search in sources :

Example 1 with ActualMeterReadsGasResponse

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

Example 2 with ActualMeterReadsGasResponse

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
}
Also used : MeterReadsGas(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MeterReadsGas) ActualMeterReadsGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse) OsgpMeterValue(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.OsgpMeterValue) Test(org.junit.jupiter.api.Test)

Example 3 with ActualMeterReadsGasResponse

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;
}
Also used : ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) ActualMeterReadsGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

ActualMeterReadsGasResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse)3 Then (io.cucumber.java.en.Then)1 Test (org.junit.jupiter.api.Test)1 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)1 ActualMeterReadsGasAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasAsyncRequest)1 MeterReadsGas (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.MeterReadsGas)1 OsgpMeterValue (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.OsgpMeterValue)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1