use of org.opensmartgridplatform.ws.schema.core.secret.management.ActivateSecretsRequest in project open-smart-grid-platform by OSGP.
the class SecretManagementService method activateNewKeys.
public void activateNewKeys(final MessageMetadata messageMetadata, final String deviceIdentification, final List<SecurityKeyType> keyTypes) {
final ActivateSecretsRequest request = new ActivateSecretsRequest();
request.setDeviceId(deviceIdentification);
request.setSecretTypes(new SecretTypes());
final List<SecretType> secretTypeList = request.getSecretTypes().getSecretType();
keyTypes.forEach(kt -> secretTypeList.add(kt.toSecretType()));
this.secretManagementClient.activateSecretsRequest(messageMetadata, request);
}
use of org.opensmartgridplatform.ws.schema.core.secret.management.ActivateSecretsRequest in project open-smart-grid-platform by OSGP.
the class SecretManagementServiceTest method testActivateKeys.
@Test
public void testActivateKeys() throws ProtocolAdapterException {
final List<SecurityKeyType> keyTypes = Arrays.asList(KEY_TYPE);
final ArgumentCaptor<ActivateSecretsRequest> activateSecretsCaptor = ArgumentCaptor.forClass(ActivateSecretsRequest.class);
// EXECUTE
this.secretManagementTestService.activateNewKeys(messageMetadata, DEVICE_IDENTIFICATION, keyTypes);
// ASSERT
verify(this.secretManagementClient).activateSecretsRequest(same(messageMetadata), activateSecretsCaptor.capture());
final ActivateSecretsRequest capturedArgument = activateSecretsCaptor.getValue();
assertThat(capturedArgument.getDeviceId()).isEqualTo(DEVICE_IDENTIFICATION);
assertThat(capturedArgument.getSecretTypes().getSecretType().get(0)).isEqualTo(KEY_TYPE.toSecretType());
}
Aggregations