use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysResponse in project open-smart-grid-platform by OSGP.
the class ConfigurationServiceTest method handleGetKeysResponse.
@Test
void handleGetKeysResponse() {
// CALL
this.instance.handleGetKeysResponse(messageMetadata, ResponseMessageResultType.OK, null, getKeysResponseDto);
// VERIFY
final GetKeysResponse expectedGetKeysResponse = new GetKeysResponse(Arrays.asList(new GetKeysResponseData(SecretType.E_METER_AUTHENTICATION_KEY, KEY_1), new GetKeysResponseData(SecretType.E_METER_MASTER_KEY, KEY_2)));
final ResponseMessage expectedResponseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withDataObject(expectedGetKeysResponse).withResult(ResponseMessageResultType.OK).build();
verify(this.webServiceResponseMessageSender).send(this.responseMessageCaptor.capture(), eq(MESSAGE_TYPE));
assertThat(this.responseMessageCaptor.getValue()).usingRecursiveComparison().isEqualTo(expectedResponseMessage);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysResponse in project open-smart-grid-platform by OSGP.
the class ConfigurationService method handleGetKeysResponse.
public void handleGetKeysResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetKeysResponseDto getKeysResponseDto) {
log.info("handleGetKeysResponse for MessageType: {}", messageMetadata.getMessageType());
final List<KeyDto> keys = getKeysResponseDto.getKeys();
final List<GetKeysResponseData> getKeysResponseData = keys.stream().map(key -> new GetKeysResponseData(SecretType.valueOf(key.getSecretType().name()), key.getSecret())).collect(Collectors.toList());
final GetKeysResponse getKeysResponse = new GetKeysResponse(getKeysResponseData);
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(resultType).withOsgpException(exception).withDataObject(getKeysResponse).build();
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Aggregations