Search in sources :

Example 1 with AddDeviceAsyncRequest

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

the class AddDeviceSteps method theAddDeviceResponseShouldBeReturned.

@Then("^the add device response should be returned$")
public void theAddDeviceResponseShouldBeReturned(final Map<String, String> responseParameters) throws Throwable {
    final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID);
    final Map<String, String> extendedParameters = SettingsHelper.addDefault(responseParameters, PlatformKeys.KEY_CORRELATION_UID, correlationUid);
    final AddDeviceAsyncRequest addDeviceAsyncRequest = AddDeviceRequestFactory.fromParameterMapAsync(extendedParameters);
    final AddDeviceResponse response = this.smartMeteringInstallationClient.getAddDeviceResponse(addDeviceAsyncRequest);
    final String expectedResult = responseParameters.get(PlatformKeys.KEY_RESULT);
    assertThat(response.getResult()).as("Result").isNotNull();
    assertThat(response.getResult().name()).as("Result").isEqualTo(expectedResult);
}
Also used : AddDeviceAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest) AddDeviceResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse) Then(io.cucumber.java.en.Then)

Example 2 with AddDeviceAsyncRequest

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

the class AddDeviceRequestFactory method fromParameterMapAsync.

public static AddDeviceAsyncRequest fromParameterMapAsync(final Map<String, String> requestParameters) {
    final String correlationUid = RequestFactoryHelper.getCorrelationUidFromScenarioContext();
    final String deviceIdentification = RequestFactoryHelper.getDeviceIdentificationFromStepData(requestParameters);
    final AddDeviceAsyncRequest addDeviceAsyncRequest = new AddDeviceAsyncRequest();
    addDeviceAsyncRequest.setCorrelationUid(correlationUid);
    addDeviceAsyncRequest.setDeviceIdentification(deviceIdentification);
    return addDeviceAsyncRequest;
}
Also used : AddDeviceAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest)

Example 3 with AddDeviceAsyncRequest

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

the class FunctionalExceptionsSteps method receivingASmartmeteringAddDeviceRequestWithAnInvalidDsmrVersion.

@When("^receiving a smartmetering add device request with an invalid DSMR version$")
public void receivingASmartmeteringAddDeviceRequestWithAnInvalidDsmrVersion(final Map<String, String> settings) throws Throwable {
    final AddDeviceRequest request = AddDeviceRequestFactory.fromParameterMap(settings);
    try {
        final AddDeviceAsyncResponse asyncResponse = this.smartMeteringInstallationClient.addDevice(request);
        final AddDeviceAsyncRequest addDeviceAsyncRequest = new AddDeviceAsyncRequest();
        addDeviceAsyncRequest.setCorrelationUid(asyncResponse.getCorrelationUid());
        addDeviceAsyncRequest.setDeviceIdentification(asyncResponse.getDeviceIdentification());
        this.smartMeteringInstallationClient.getAddDeviceResponse(addDeviceAsyncRequest);
    } catch (final Exception exception) {
        ScenarioContext.current().put(PlatformKeys.RESPONSE, exception);
    }
}
Also used : AddDeviceAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest) AddDeviceRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceRequest) AddDeviceAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncResponse) When(io.cucumber.java.en.When)

Example 4 with AddDeviceAsyncRequest

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

the class AddDeviceSteps method retrievingTheAddDeviceResponseResultsInAnException.

@Then("^retrieving the AddDevice response results in an exception$")
public void retrievingTheAddDeviceResponseResultsInAnException() throws WebServiceSecurityException {
    final AddDeviceAsyncRequest addDeviceAsyncRequest = AddDeviceRequestFactory.fromScenarioContext();
    try {
        this.smartMeteringInstallationClient.getAddDeviceResponse(addDeviceAsyncRequest);
        Assertions.fail("A SoapFaultClientException should be thrown");
    } catch (final SoapFaultClientException e) {
        ScenarioContext.current().put(PlatformKeys.RESPONSE, e);
    }
}
Also used : AddDeviceAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) Then(io.cucumber.java.en.Then)

Example 5 with AddDeviceAsyncRequest

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

the class AddDeviceRequestFactory method fromScenarioContext.

public static AddDeviceAsyncRequest fromScenarioContext() {
    final String correlationUid = RequestFactoryHelper.getCorrelationUidFromScenarioContext();
    final String deviceIdentification = RequestFactoryHelper.getDeviceIdentificationFromScenarioContext();
    final AddDeviceAsyncRequest addDeviceAsyncRequest = new AddDeviceAsyncRequest();
    addDeviceAsyncRequest.setCorrelationUid(correlationUid);
    addDeviceAsyncRequest.setDeviceIdentification(deviceIdentification);
    return addDeviceAsyncRequest;
}
Also used : AddDeviceAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest)

Aggregations

AddDeviceAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest)6 Then (io.cucumber.java.en.Then)3 When (io.cucumber.java.en.When)1 AddDeviceAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncResponse)1 AddDeviceRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceRequest)1 AddDeviceResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse)1 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)1 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)1