Search in sources :

Example 1 with GetAdministrativeStatusRequest

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

the class GetAdministrativeStatus method theRetrieveAdministrativeStatusRequestIsReceivedForDevices.

@When("^the get administrative status request is received for devices$")
public void theRetrieveAdministrativeStatusRequestIsReceivedForDevices(final List<String> deviceIdentifications) throws Throwable {
    final Map<String, String> parameterMap = new HashMap<>();
    final Map<String, String> correlationUidMap = new HashMap<>();
    for (final String deviceIdentification : deviceIdentifications) {
        parameterMap.put(PlatformKeys.KEY_DEVICE_IDENTIFICATION, deviceIdentification);
        final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory.fromParameterMap(parameterMap);
        final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient.getAdministrativeStatus(getAdministrativeStatusRequest);
        assertThat(getAdministrativeStatusAsyncResponse).as("Get administrative status asyncResponse should not be null").isNotNull();
        correlationUidMap.put(deviceIdentification, getAdministrativeStatusAsyncResponse.getCorrelationUid());
    }
    ScenarioContext.current().put(CORRELATION_UID_BY_DEVICE_IDENTIFICATION, correlationUidMap);
}
Also used : GetAdministrativeStatusAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse) HashMap(java.util.HashMap) GetAdministrativeStatusRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusRequest) When(io.cucumber.java.en.When)

Example 2 with GetAdministrativeStatusRequest

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

the class AddDeviceSteps method aRequestToTheDeviceCanBePerformedAfterActivation.

@Then("^a request to the device can be performed after activation$")
public void aRequestToTheDeviceCanBePerformedAfterActivation() throws Throwable {
    final Device device = this.activateDevice();
    /*
     * Fire any request that causes communication to the device, and check
     * that the actual response is not an error.
     */
    final GetAdministrativeStatusRequest request = new GetAdministrativeStatusRequest();
    request.setDeviceIdentification(device.getDeviceIdentification());
    final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient.getAdministrativeStatus(request);
    final GetAdministrativeStatusAsyncRequest asyncRequest = new GetAdministrativeStatusAsyncRequest();
    asyncRequest.setCorrelationUid(getAdministrativeStatusAsyncResponse.getCorrelationUid());
    asyncRequest.setDeviceIdentification(device.getDeviceIdentification());
    final GetAdministrativeStatusResponse getAdministrativeStatusResponse = this.smartMeteringConfigurationClient.retrieveGetAdministrativeStatusResponse(asyncRequest);
    assertThat(getAdministrativeStatusResponse.getEnabled()).as("Administrative status should contain information if it is enabled").isNotNull();
}
Also used : GetAdministrativeStatusAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse) Device(org.opensmartgridplatform.domain.core.entities.Device) DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice) GetAdministrativeStatusRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusRequest) GetAdministrativeStatusAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncRequest) GetAdministrativeStatusResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusResponse) Then(io.cucumber.java.en.Then)

Example 3 with GetAdministrativeStatusRequest

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

the class GetAdministrativeStatusRequestFactory method fromParameterMap.

public static GetAdministrativeStatusRequest fromParameterMap(final Map<String, String> requestParameters) {
    final GetAdministrativeStatusRequest getAdministrativeStatusRequest = new GetAdministrativeStatusRequest();
    getAdministrativeStatusRequest.setDeviceIdentification(requestParameters.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION));
    return getAdministrativeStatusRequest;
}
Also used : GetAdministrativeStatusRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusRequest)

Example 4 with GetAdministrativeStatusRequest

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

the class GetAdministrativeStatus method theRetrieveAdministrativeStatusRequestIsReceived.

@When("^the get administrative status request is received$")
public void theRetrieveAdministrativeStatusRequestIsReceived(final Map<String, String> requestData) throws Throwable {
    final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory.fromParameterMap(requestData);
    final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient.getAdministrativeStatus(getAdministrativeStatusRequest);
    LOGGER.info("Get administrative status asyncResponse is received {}", getAdministrativeStatusAsyncResponse);
    assertThat(getAdministrativeStatusAsyncResponse).as("Get administrative status asyncResponse should not be null").isNotNull();
    ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, getAdministrativeStatusAsyncResponse.getCorrelationUid());
}
Also used : GetAdministrativeStatusAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse) GetAdministrativeStatusRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusRequest) When(io.cucumber.java.en.When)

Example 5 with GetAdministrativeStatusRequest

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

the class FunctionalExceptionsSteps method theRetrieveAdministrativeStatusRequestForAnInvalidOrganisationIsReceived.

@When("^the get administrative status request for an invalid organisation is received$")
public void theRetrieveAdministrativeStatusRequestForAnInvalidOrganisationIsReceived(final Map<String, String> requestData) throws Throwable {
    final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory.fromParameterMap(requestData);
    if (requestData.containsKey(PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION)) {
        final String organisation = getString(requestData, PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION);
        ScenarioContext.current().put(PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION, organisation);
    }
    try {
        this.smartMeteringConfigurationClient.getAdministrativeStatus(getAdministrativeStatusRequest);
    } catch (final Exception exception) {
        ScenarioContext.current().put(PlatformKeys.RESPONSE, exception);
    }
}
Also used : ReadSettingsHelper.getString(org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString) GetAdministrativeStatusRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusRequest) When(io.cucumber.java.en.When)

Aggregations

GetAdministrativeStatusRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusRequest)5 When (io.cucumber.java.en.When)3 GetAdministrativeStatusAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncResponse)3 Then (io.cucumber.java.en.Then)1 HashMap (java.util.HashMap)1 DlmsDevice (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)1 GetAdministrativeStatusAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusAsyncRequest)1 GetAdministrativeStatusResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusResponse)1 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)1 Device (org.opensmartgridplatform.domain.core.entities.Device)1