Search in sources :

Example 11 with AsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest in project open-smart-grid-platform by OSGP.

the class StopDeviceSteps method thePlatformBuffersAStopDeviceResponseMessageForDevice.

@Then("the platform buffers a stop device response message for device {string}")
public void thePlatformBuffersAStopDeviceResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
    final StopDeviceTestAsyncRequest request = new StopDeviceTestAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
    request.setAsyncRequest(asyncRequest);
    Wait.until(() -> {
        StopDeviceTestResponse response = null;
        try {
            response = this.client.getStopDeviceTestResponse(request);
        } catch (final Exception e) {
        // do nothing
        }
        assertThat(response).isNotNull();
        assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformKeys.KEY_RESULT)));
    });
}
Also used : AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest) StopDeviceTestAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StopDeviceTestAsyncRequest) OsgpResultType(org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType) StopDeviceTestResponse(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StopDeviceTestResponse) StopDeviceTestAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StopDeviceTestAsyncRequest) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) Then(io.cucumber.java.en.Then)

Example 12 with AsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest in project open-smart-grid-platform by OSGP.

the class GetFirmwareVersionSteps method thePlatformBuffersAGetFirmwareVersionResponseMessage.

@Then("^the platform buffers a get firmware version response message for device \"([^\"]*)\"$")
public void thePlatformBuffersAGetFirmwareVersionResponseMessage(final String deviceIdentification, final Map<String, String> expectedResponseData) {
    final GetFirmwareVersionAsyncRequest request = new GetFirmwareVersionAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
    request.setAsyncRequest(asyncRequest);
    final GetFirmwareVersionResponse response = Wait.untilAndReturn(() -> {
        final GetFirmwareVersionResponse retval = this.client.getGetFirmwareVersion(request);
        assertThat(retval).isNotNull();
        assertThat(retval.getResult()).isEqualTo(getEnum(expectedResponseData, PlatformKeys.KEY_RESULT, OsgpResultType.class));
        return retval;
    });
    if (response.getFirmwareVersion() != null) {
        final FirmwareVersion fwv = response.getFirmwareVersion().get(0);
        if (fwv.getVersion() != null) {
            assertThat(fwv.getVersion()).isEqualTo(getString(expectedResponseData, PlatformKeys.FIRMWARE_VERSION));
        }
        if (fwv.getFirmwareModuleType() != null) {
            assertThat(fwv.getFirmwareModuleType()).isEqualTo(getEnum(expectedResponseData, PlatformKeys.KEY_FIRMWARE_MODULE_TYPE, FirmwareModuleType.class));
        }
    }
}
Also used : GetFirmwareVersionAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.GetFirmwareVersionAsyncRequest) GetFirmwareVersionAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.GetFirmwareVersionAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest) OsgpResultType(org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType) GetFirmwareVersionResponse(org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.GetFirmwareVersionResponse) FirmwareModuleType(org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.FirmwareModuleType) FirmwareVersion(org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.FirmwareVersion) Then(io.cucumber.java.en.Then)

Aggregations

Then (io.cucumber.java.en.Then)12 AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest)12 OsgpResultType (org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType)9 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)8 IOException (java.io.IOException)2 GeneralSecurityException (java.security.GeneralSecurityException)2 GetConfigurationAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.GetConfigurationAsyncRequest)2 GetConfigurationResponse (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.GetConfigurationResponse)2 SetConfigurationAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationAsyncRequest)2 StartDeviceTestAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestAsyncRequest)2 StartDeviceTestResponse (org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse)2 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)2 WebServiceSecurityException (org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException)2 SetRebootAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootAsyncRequest)1 SetRebootResponse (org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootResponse)1 Configuration (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.Configuration)1 DaliConfiguration (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.DaliConfiguration)1 IndexAddressMap (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.IndexAddressMap)1 LightType (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.LightType)1 LinkType (org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.LinkType)1