Search in sources :

Example 1 with ActualMeterReadsAsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncRequest 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);
    }
}
Also used : ActualMeterReadsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse) ActualMeterReadsRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsRequest) ActualMeterReadsAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncRequest) ActualMeterReadsAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncResponse) When(io.cucumber.java.en.When)

Example 2 with ActualMeterReadsAsyncRequest

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

the class ActualMeterReadsRequestFactory method fromScenarioContext.

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

Example 3 with ActualMeterReadsAsyncRequest

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

Aggregations

ActualMeterReadsAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncRequest)3 ActualMeterReadsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse)2 Then (io.cucumber.java.en.Then)1 When (io.cucumber.java.en.When)1 ActualMeterReadsAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncResponse)1 ActualMeterReadsRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsRequest)1