Search in sources :

Example 1 with GetKeysAsyncRequest

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

the class GetKeys method theGetKeysResponseIsReturned.

@Then("^the get keys response should return the requested keys$")
public void theGetKeysResponseIsReturned(final Map<String, String> expectedValues) throws Throwable {
    final GetKeysAsyncRequest asyncRequest = GetKeysRequestFactory.fromScenarioContext();
    final GetKeysResponse response = this.smartMeteringConfigurationClient.retrieveGetKeysResponse(asyncRequest);
    assertThat(response).isNotNull();
    assertThat(response.getResult()).as(OPERATION + ", Checking result:").isEqualTo(OsgpResultType.OK);
    final List<GetKeysResponseData> responseDataList = response.getGetKeysResponseData();
    assertThat(responseDataList).noneMatch(getKeysResponseData -> ArrayUtils.isEmpty(getKeysResponseData.getSecretValue()));
    final List<SecretType> secretTypesInResponse = responseDataList.stream().map(GetKeysResponseData::getSecretType).collect(Collectors.toList());
    final List<SecretType> expectedSecretTypes = getSecretTypesFromParameterMap(expectedValues);
    assertThat(secretTypesInResponse).containsExactlyInAnyOrderElementsOf(expectedSecretTypes);
}
Also used : GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) SecretType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SecretType) GetKeysAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysAsyncRequest) GetKeysResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponse) Then(io.cucumber.java.en.Then)

Example 2 with GetKeysAsyncRequest

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

the class GetKeysRequestFactory method fromScenarioContext.

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

Aggregations

GetKeysAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysAsyncRequest)2 Then (io.cucumber.java.en.Then)1 GetKeysResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponse)1 GetKeysResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData)1 SecretType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SecretType)1